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

Branca builder incorrectly sets timestamp to non-zero on new() #22

Closed
brycx opened this issue Nov 29, 2020 · 0 comments
Closed

Branca builder incorrectly sets timestamp to non-zero on new() #22

brycx opened this issue Nov 29, 2020 · 0 comments

Comments

@brycx
Copy link
Collaborator

brycx commented Nov 29, 2020

The Branca builder sets the timestamp to the current system time when calling new():

let timestamp = SystemTime::now()

But encode() then checks if it is non-zero. If it is zero, it uses the current system time to encode the token. If it is not zero, it uses the timestamp field of the Branca struct:

if timestamp == 0 {

This means, if an instance of Branca is created at one point, and some given time later is used to encode a token, the token would use the timestamp of when the instance was created, not when the token was created.

@brycx brycx closed this as completed in 289cf60 Nov 29, 2020
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