Skip to content

feat: add DateProvider to Lokksmith options#287

Merged
svenjacobs merged 4 commits intomainfrom
feat/date-provider
Feb 24, 2026
Merged

feat: add DateProvider to Lokksmith options#287
svenjacobs merged 4 commits intomainfrom
feat/date-provider

Conversation

@svenjacobs
Copy link
Owner

Adds a DateProvider to Lokksmith's Options which allows to provide a more reliable or network-synchronized time source like TrustedTime API on Android, if available.

@svenjacobs svenjacobs self-assigned this Feb 24, 2026
Copilot AI review requested due to automatic review settings February 24, 2026 15:01
@svenjacobs svenjacobs added the enhancement New feature or request label Feb 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configurable, potentially network-synchronized time source to Lokksmith via a new DateProvider, and wires it through token validation and expiration logic to avoid relying solely on device time.

Changes:

  • Introduces DateProvider / DateProviders.Default and adds dateProvider to Lokksmith.Options, plumbing it into ClientImpl.DefaultProvider.
  • Updates token expiry/temporal validation to use dateProvider().epochSeconds, and adjusts APIs to suspend where needed.
  • Updates common tests to provide kotlin.time.Instant-based time sources.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
lib/lokksmith-core/src/commonTest/kotlin/dev/lokksmith/client/request/token/AbstractTokenResponseValidatorTest.kt Updates helper to suspend to match validator API changes.
lib/lokksmith-core/src/commonTest/kotlin/dev/lokksmith/client/ClientTest.kt Migrates tests to inject dateProvider returning Instant.
lib/lokksmith-core/src/commonTest/kotlin/dev/lokksmith/LokksmithTest.kt Updates test container provider to supply dateProvider.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/client/request/token/TokenResponseValidator.kt Switches validation + expiry computations to use dateProvider and makes validate suspend.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/client/TokensExtensions.kt Refactors expiry helpers to accept currentSeconds rather than a provider callback.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/client/Client.kt Adds dateProvider to InternalClient.Provider, makes Client.isExpired suspend, and uses dateProvider in expiry checks.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/Lokksmith.kt Adds and documents Lokksmith.Options.dateProvider.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/DateProvider.kt Introduces public DateProvider and DateProviders.Default.
lib/lokksmith-core/src/commonMain/kotlin/dev/lokksmith/Container.kt Forwards options.dateProvider into the created client provider.
lib/lokksmith-core/api/lokksmith-core.klib.api ABI surface update reflecting new option and new suspend signatures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@svenjacobs svenjacobs merged commit c71bd97 into main Feb 24, 2026
7 checks passed
@svenjacobs svenjacobs deleted the feat/date-provider branch February 24, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants