You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The end result is the returned signature cannot be verified (or to be precise: cannot be verified unless you know about JSON.stringify).
It may not be a problem for JS/Node, but it is a problem if you sign a message on fronted with JS and try to verify it on backend (tested with hashgraph/hedera-sdk-go/v2 and crypto/ed25519).
I see two solutions to this problem:
Keep the behavior but document it (with examples of JSON.stringified values for backend devs)
Had a conversation with Pluto @teacoat on Discord.
try to sign a message which is 'Hello World!', but apparently, the library is JSON.stringifying it, which changes 'Hello World!' into '"Hello World!"' - it adds these double quotes.
We have a work around but just wanted to make sure you were going to use this as it stands?
Signing message with: https://github.com/Hashpack/hashconnect#sign
What it says it does is it takes
dataToSign
and signs it.What it actuall do is (AFAIK) it first
JSON.stringify
thedataToSign
and then signs it.Extra characters are added discretely to the message (which changes the signature):
The end result is the returned signature cannot be verified (or to be precise: cannot be verified unless you know about JSON.stringify).
It may not be a problem for JS/Node, but it is a problem if you sign a message on fronted with JS and try to verify it on backend (tested with
hashgraph/hedera-sdk-go/v2
andcrypto/ed25519
).I see two solutions to this problem:
string | object
withUint8Array | string
where the string is expected to be hex encoded byte array: https://github.com/Hashpack/hashconnect/blob/main/lib/src/message/relayMessage.ts#L115The text was updated successfully, but these errors were encountered: