-
Notifications
You must be signed in to change notification settings - Fork 36
VPN-4401: Cache JWT skew #3878
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
VPN-4401: Cache JWT skew #3878
Conversation
pronebird
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @mmsinclair)
a discussion (no related file):
Please cargo fmt the source.
pronebird
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pronebird reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed (commit messages unreviewed), 2 unresolved discussions (waiting on @agentpietrucha and @mmsinclair)
nym-vpn-core/crates/nym-vpn-api-client/src/client.rs line 50 at r1 (raw file):
#[derive(Default, Debug)] struct SkewState {
Nit: you may really benefit from holding Option<SkewState> which would eliminate the need for members to be Optional as both skew and expires_at are set together.
pronebird
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pronebird reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @agentpietrucha and @mmsinclair)
neacsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neacsu reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @agentpietrucha, @mmsinclair, and @pronebird)
nym-vpn-core/crates/nym-vpn-api-client/src/client.rs line 57 at r3 (raw file):
#[derive(Clone, Copy, Debug, PartialEq, Eq)] enum SkewStatus { Expired(),
nit: No need for it to be function, it can be just Expired
nym-vpn-core/crates/nym-vpn-api-client/src/client.rs line 228 at r3 (raw file):
tracing::debug!("Valid VPN API time skew"); let local_time = OffsetDateTime::now_utc(); let estimated_remote_time = local_time - skew;
This subtraction is dependent on the fact that the skew is computed in a certain way inside local_time_ahead_skew from what I can tell. Although it seems to be correct at this moment, it's somewhat code duplicating and I think it should be refactored and implementation details be kept in one place (maybe inside VpnApiTime methods)
Ticket
JIRA-VPN-4401
Description
Cache skew with remote time with
TTL = 4 hoursChecklist:
Screenshots (optional, if UI related)
This change is