Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nonce check in verify function #54

Open
HelloRickey opened this issue May 30, 2023 · 2 comments
Open

Add nonce check in verify function #54

HelloRickey opened this issue May 30, 2023 · 2 comments

Comments

@HelloRickey
Copy link

Hey @bytesbay, I like web3-token very much, and I am using it, would you consider adding a nonce check in verify, if the nonce is incorrect, verify will fail.

@bytesbay
Copy link
Owner

Hey , sounds reasonable.
Lets clarify the check - if the nonce in token is less than the one passed in verify.opts so the verify will fail, am i right? @HelloRickey

@HelloRickey
Copy link
Author

@bytesbay Sorry, I just saw this message.
I might be confusing the nonce of Web3Token.sign with the nonce of metamask.

The nonce I passed in Web3Token.sign is 1686623665501
But metamask shows 61545035
截屏2023-06-13 10 35 24
Metamask seems to recalculate the nonce of Web3Token.sign?

Is it necessary to add nonce verification in verify?

const { address, body } = await Web3Token. verify(token, {
   domain: 'worldofdefish.com',
   //nonce verification
   nonce:'1686623665501'
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants