Skip to content

Commit

Permalink
Merge pull request #467 from casper-ecosystem/feat-utils-and-fixes
Browse files Browse the repository at this point in the history
Feat utils and fixes
  • Loading branch information
Comp0te authored Dec 17, 2024
2 parents 7122398 + 8d5ab92 commit 782838c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/types/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,6 @@ export class Transaction {
const hex = new HexBytes(signature);
const approval = new Approval(publicKey, hex);

this.approvals.push(approval);

if (this.originTransactionV1) {
this.originTransactionV1.approvals.push(approval);
} else if (this.originDeployV1) {
Expand Down
11 changes: 10 additions & 1 deletion src/types/keypair/PrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,21 @@ export class PrivateKey {
return this.priv.toPem();
}

/**
* Signs a message using the private key.
* @param msg - The message to sign.
* @returns A promise resolving to the signature bytes.
*/
public async sign(msg: Uint8Array): Promise<Uint8Array> {
return await this.priv.sign(msg);
}

/**
* Signs a message using the private key and includes the algorithm byte in the signature.
* @param msg - The message to sign.
* @returns A promise resolving to the signature bytes with the algorithm byte.
*/
public async sign(msg: Uint8Array): Promise<Uint8Array> {
public async signAndAddAlgorithmBytes(msg: Uint8Array): Promise<Uint8Array> {
const signature = await this.priv.sign(msg);
const algBytes = Uint8Array.of(this.alg);
return concat([algBytes, signature]);
Expand Down

0 comments on commit 782838c

Please sign in to comment.