NEWTON

NEWTON


Popular tags

    signing a message using account.signMessage(data) | starknet.js

    Asked

    4 months ago

    16

    views


    0

    I’m signing a message using

    account.signMessage(data) 
    

    and immediately verifying the signature with the same data and it’s returning false. I don’t see any issue open on this subject on starknet.js. Is this something you’ve already encountered by any chance?

    here’s the code:

    const data = { types: proposeTypes, primaryType: 'Propose', domain, message }; const sig = await user.account.signMessage(data); let res = await user.account.verifyMessage(data, sig); // returns `false`

    I see that’s the expected way to use signMessage through the tests (https://github.com/0xs34n/starknet.js/blob/b20819424dea824c96ac31e0542733c84d87d441/__tests__/account.test.ts#L125-L126).

    So I guess something’s going wrong when it comes to either hashing the data and signing it or hashing the data and verifying the signature?

    btw: for those wondering: verifyMessage only works if the account is deployed: if you’re doing this with an account not deployed (basically just a keypair) then this won’t work :)

      starknet.jscairo-langcairo

    Newton

    asked

    4 months ago


    0 answers

    There are no answers for this question yet
    Want to give yours?

    Your answer

    NEWTON

    NEWTON