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

SM-1023: Remove Instant from Client in SDK #397

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

coltonhurst
Copy link
Member

@coltonhurst coltonhurst commented Dec 4, 2023

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Refactor out the Instant type in Client and use unix timestamps. This is to support this PR: #388 where we need to serialize token expiry times.

It also brings benefits to other areas like WASM, where Instant doesn't exist.

Code changes

  • crates/bitwarden/src/auth/renew.rs: Update the renew_token function to use timestamps instead of the Instant type
  • crates/bitwarden/src/client/client.rs: Update Client to store the unix timestamp for token expiration

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)

@coltonhurst coltonhurst self-assigned this Dec 4, 2023
@bitwarden-bot
Copy link

Logo
Checkmarx One – Scan Summary & Detailsbd033fff-7cce-42b4-8da3-499fec872153

No New Or Fixed Issues Found

@Hinton
Copy link
Member

Hinton commented Dec 5, 2023

I think we could refactor the logic around expiration date to. The JWT token contains the expiration date, not sure why we map it back and forth.

@coltonhurst coltonhurst merged commit 6ffef56 into master Dec 5, 2023
44 checks passed
@coltonhurst coltonhurst deleted the sm/sm-1023 branch December 5, 2023 15:22
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

Successfully merging this pull request may close these issues.

3 participants