Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #82 from 0xmaayan/maayan/injected-aptos-signature-…
Browse files Browse the repository at this point in the history
…encoding-fix

fix signature encoding to respect Signature data type
  • Loading branch information
JesseTheRobot authored May 29, 2024
2 parents 5be38c2 + 8fb197f commit a2d5c42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/signing/chains/InjectedAptosSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export default class InjectedAptosSigner implements Signer {

async sign(message: Uint8Array): Promise<Uint8Array> {
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<boolean> {
Expand Down

0 comments on commit a2d5c42

Please sign in to comment.