Skip to content

Commit

Permalink
Remove alg bytes from sign method and add signAndAddAlgorithmBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
Comp0te committed Dec 17, 2024
1 parent 98815be commit 8d5ab92
Showing 1 changed file with 10 additions and 1 deletion.
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 8d5ab92

Please sign in to comment.