Skip to content

fix: reduce token TTL to 14 days with 3-day refresh threshold#89

Open
matej21 wants to merge 1 commit intomainfrom
fix/token-ttl-14d
Open

fix: reduce token TTL to 14 days with 3-day refresh threshold#89
matej21 wants to merge 1 commit intomainfrom
fix/token-ttl-14d

Conversation

@matej21
Copy link
Copy Markdown
Member

@matej21 matej21 commented Mar 27, 2026

Summary

  • Token TTL: 30 days → 14 days (stolen tokens expire sooner)
  • Client refresh threshold: 14 days → 3 days (active clients refresh early, well before expiry)
  • Fixed stale doc comment in manager.rs (said "20 hours", now says "3 days")

Supersedes #80 — that PR proposed 24h TTL which would break the use case of paired desktops left unused for a week. 14 days is the sweet spot: short enough to limit exposure of stolen tokens, long enough to survive extended inactivity.

Web client (App.tsx) uses dynamic 75% of TTL scheduling — no changes needed there.

Files changed

  • src/remote/auth.rsTOKEN_TTL_SECS
  • crates/okena-core/src/client/types.rsTOKEN_REFRESH_AGE_SECS
  • crates/okena-remote-client/src/manager.rs — doc comment fix

Test plan

  • cargo test — 32 tests pass
  • Verify existing paired clients refresh correctly after upgrade

🤖 Generated with Claude Code

The previous 30-day TTL with 14-day refresh threshold left a narrow
window for refresh and kept stolen tokens valid for too long.
New values: 14-day TTL with 3-day refresh — active clients refresh
early and live indefinitely, inactive clients survive up to 2 weeks.

Supersedes #80 which proposed 24h TTL (too aggressive for paired
desktops that may be unused for a week).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant