Closed jp30566347 closed 2 years ago
Hello @jp-melanson , thank you for reporting this issue. The expected argument is Uint8Array
. Here is a working code snippet:
const signAndVerify = async () => {
const message = "Hello";
const encodedMsg = decodeUTF8(message);
const signature = await magic.solana.signMessage(encodedMsg);
const verifiedMsg = nacl.sign.detached.verify(
encodedMsg,
signature,
base58_to_binary(userMetadata.publicAddress)
);
console.log("Sig verified:", verifiedMsg);
};
You may also check out this working Codesandbox demo.
✅ Prerequisites
magic-sdk
)?❓ Question
Why the signMessage function always throws this error?
I've been trying to invoke it using a
string
as well as aUint8Array
but no luck. The Uint8Array is created fromtweetnacl-ts
lib'sdecodeUTF8
function.🌎 Environment
magic-sdk
npm