There’s various random posts over the last few years explaining how to sign and verify a message, but they’re using random web3 libraries, some of which have been deprecated or merged into other projects.
Is there a canonical (as of Jan 2022) and simple way to sign a message using WalletConnect, and then verify that signature, using the algosdk for Javascript? Ideally assuming zero prior knowledge about how many Buffers, or UInt8 arrays, or hex encodings/decodings any of the inputs/outputs may require?
And just to vent my frustrations: has no one encapsulated all of that ceremony into dead simple sign(message)
and verify(message, signature)
functions yet?
Additional Info Someone suggested that algosdk.verifyBytes()
will verify a signature, but the docs say that it needs an array of bytes (is this the original message?) but that “the bytes should have been signed with “MX” prepended for domain separation.” That’s where it totally lost me.
ADDITIONAL Additional Info Is it possible that Algorand Wallet doesn’t support the signMessage()
function on WalletConnect? I’ve noticed that if I have my wallet open and ready when I try to sign a message, I get back an error, Uncaught (in promise) Error: Method not found
within a second of sending off the sendMessage()
call. However, if my wallet is closed, I won’t get any error message when trying to sendMessage()
until I open the wallet app. So it seems like the wallet itself is responding with Method not found
, when I assumed it was WalletConnect complaining about my function call. Is there some other way to sign a message that isn’t standard to the WalletConnect spec?