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

Commit

Permalink
fix: Add code to handle the new Aptos Signature object
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTheRobot committed May 28, 2024
1 parent 5be38c2 commit 5370a5c
Show file tree
Hide file tree
Showing 3 changed files with 349 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"path-browserify": "^1.0.1",
"perf_hooks": "^0.0.1",
"prettier": "~2.3.0",
"prettier-eslint": "^16.3.0",
"pretty-quick": "^3.1.2",
"process": "^0.11.10",
"resolve-tspaths": "^0.8.8",
Expand Down
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.toUnit8Array();
}

static async verify(pk: Buffer, message: Uint8Array, signature: Uint8Array): Promise<boolean> {
Expand Down
Loading

0 comments on commit 5370a5c

Please sign in to comment.