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

Question - How to validate the nonce? #327

Open
Rossco8 opened this issue Oct 31, 2023 · 0 comments
Open

Question - How to validate the nonce? #327

Rossco8 opened this issue Oct 31, 2023 · 0 comments

Comments

@Rossco8
Copy link

Rossco8 commented Oct 31, 2023

When using a v4 Local token, how do I validate the nonce when decoding?

my_key = secrets.token_bytes(32)
my_nonce = secrets.token_bytes(32)

data = json.dumps({"hello": "world"})
key = Key.new(version=4, purpose="local", key=my_key)
 
token = pyseto.encode(
    key,
    payload=data.encode("utf-8"),
    nonce=my_nonce,
    serializer=json
)
decoded = pyseto.decode(key, token)
-> How do I know what nonce was used here <-

Whether I provide my own nonce or allow one to be created for me by default, I can not see any property or method at the decode step

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

1 participant