Add optional createdAt property to last used identities#3414
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an optional createdAtMillis property to the last used identities feature, enabling the identity switcher to display when each identity was created.
Key changes:
- New utility function to extract creation time from identity info
- Updated last used identity store to include optional creation timestamp
- Modified authentication flows to pass creation time when available
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/frontend/src/lib/utils/identityInfo.ts |
New utility function to convert identity creation time to milliseconds |
src/frontend/src/lib/utils/identityInfo.test.ts |
Test coverage for the new utility function |
src/frontend/src/lib/stores/last-used-identities.store.ts |
Added optional createdAtMillis property to store types |
src/frontend/src/lib/stores/last-used-identities.store.test.ts |
Updated tests to include the new property |
src/frontend/src/lib/flows/registerAccessMethodFlow.svelte.ts |
Extract and pass creation time from identity info |
src/frontend/src/lib/flows/migrationFlow.svelte.ts |
Set undefined for legacy identities without creation time |
src/frontend/src/lib/flows/authFlow.svelte.ts |
Pass creation time for existing identities or current time for new ones |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
0d9f34c to
43d0f98
Compare
added 2 commits
October 17, 2025 09:26
sea-snake
reviewed
Oct 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
We want to add when the identity was created in the identity switcher.
In this PR, I add a new property to the data stored in local storage that is then used in the identity switcher.
Changes
created_atfield to theAuthnMethodSessionInfotype in the backend interface and ensured it is populated from the anchor's creation time.AuthFlowandRegisterAccessMethodFlowclasses to extract, convert (using the newnanosToMillisutility), and passcreatedAtMilliswhen handling identity and authentication method information.created_atis not available, setcreatedAtMillistoundefined.LastUsedIdentitytype and thelastUsedIdentitiesStoreto include the optionalcreatedAtMillisfield and updated the store's API accordingly.nanosToMillisutility function for converting nanosecond timestamps to milliseconds.Tests
lastUsedIdentitiesStoreandlastUsedIdentityStoreto include checks for the newcreatedAtMillisproperty, ensuring correct behavior and coverage.