From 8fb197f3c8dfb08d06404ddbb7c400ca4372441f Mon Sep 17 00:00:00 2001 From: maayan Date: Tue, 28 May 2024 21:58:31 -0400 Subject: [PATCH] fix signature encoding to respect Signature data --- src/signing/chains/InjectedAptosSigner.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/signing/chains/InjectedAptosSigner.ts b/src/signing/chains/InjectedAptosSigner.ts index f56e843..9b65b23 100644 --- a/src/signing/chains/InjectedAptosSigner.ts +++ b/src/signing/chains/InjectedAptosSigner.ts @@ -28,11 +28,12 @@ export default class InjectedAptosSigner implements Signer { async sign(message: Uint8Array): Promise { if (!this.provider.signMessage) throw new Error("Selected Wallet does not support message signing"); - const signature = await this.provider.signMessage({ + const signingResponse = await this.provider.signMessage({ message: Buffer.from(message).toString("hex"), nonce: "bundlr", }); - return Buffer.from(signature.signature, "hex"); + const signature = signingResponse.signature; + return typeof signature === "string" ? Buffer.from(signature, "hex") : signature.data.toUint8Array(); } static async verify(pk: Buffer, message: Uint8Array, signature: Uint8Array): Promise {