Skip to content

Commit

Permalink
chore: optimize sui example
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Nov 7, 2024
1 parent 9843a1f commit cf18d6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/example/components/chains/aptosMartian/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export default function Example() {
const res = await provider?.signMessage(obj);
return JSON.stringify(res);
}}
onValidate={(request: string, result: string) => {
onValidate={async (request: string, result: string) => {
const { fullMessage, signature } = JSON.parse(result) as SignMessageResponse;

const account = await provider?.account();
const isValidSignature = nacl.sign.detached.verify(
Buffer.from(fullMessage),
hexToBytes(signature),
hexToBytes(stripHexPrefix(account?.publicKey)),
hexToBytes(stripHexPrefix(signature)),
hexToBytes(stripHexPrefix(account?.publicKey ?? '')),
);

return Promise.resolve(isValidSignature.toString());
Expand Down

0 comments on commit cf18d6d

Please sign in to comment.