From 98815bef6cd068cf00b9ef3f4ccc3810591250eb Mon Sep 17 00:00:00 2001 From: Dmytro Vynnyk Date: Tue, 17 Dec 2024 19:27:47 +0100 Subject: [PATCH 1/2] Fix issue with double approvals --- src/types/Transaction.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/types/Transaction.ts b/src/types/Transaction.ts index 7ce8badef..cdb61d4cc 100644 --- a/src/types/Transaction.ts +++ b/src/types/Transaction.ts @@ -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) { From 8d5ab924ab146d76964ebeb2e8f78dbab378a476 Mon Sep 17 00:00:00 2001 From: Dmytro Vynnyk Date: Tue, 17 Dec 2024 19:28:39 +0100 Subject: [PATCH 2/2] Remove alg bytes from sign method and add signAndAddAlgorithmBytes --- src/types/keypair/PrivateKey.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/types/keypair/PrivateKey.ts b/src/types/keypair/PrivateKey.ts index e62359767..eae86d1fd 100644 --- a/src/types/keypair/PrivateKey.ts +++ b/src/types/keypair/PrivateKey.ts @@ -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 { + 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 { + public async signAndAddAlgorithmBytes(msg: Uint8Array): Promise { const signature = await this.priv.sign(msg); const algBytes = Uint8Array.of(this.alg); return concat([algBytes, signature]);