-
Notifications
You must be signed in to change notification settings - Fork 161
Add identity to local storage if missing after adding an access method #3505
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
Add identity to local storage if missing after adding an access method #3505
Conversation
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.
Pull Request Overview
This PR ensures that recovered identities are added to the local storage list after adding a new access method (passkey or OpenID), making them easily accessible for future use.
- Introduced a new
addLastUsedIdentityIfMissingmethod that adds identities conditionally without overwriting existing data - Updated access method registration flows to store identity information in local storage
- Refactored the
createPasskeymethod to accept identity name as a parameter instead of reading from store
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| last-used-identities.store.ts | Added addLastUsedIdentityIfMissing method to conditionally add identities to local storage |
| last-used-identities.store.test.ts | Added comprehensive unit tests for the new conditional add method |
| access/+page.svelte | Integrated identity storage after OpenID and passkey registration |
| addAccessMethodFlow.svelte.ts | Refactored createPasskey to accept name parameter and removed store dependency |
| AddAccessMethodWizard.svelte | Added identityName prop and passed it to createPasskey method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...nd/src/routes/(new-styling)/manage/(authenticated)/(access-and-recovery)/access/+page.svelte
Show resolved
Hide resolved
...nd/src/routes/(new-styling)/manage/(authenticated)/(access-and-recovery)/access/+page.svelte
Show resolved
Hide resolved
...nd/src/routes/(new-styling)/manage/(authenticated)/(access-and-recovery)/access/+page.svelte
Show resolved
Hide resolved
...nd/src/routes/(new-styling)/manage/(authenticated)/(access-and-recovery)/access/+page.svelte
Outdated
Show resolved
Hide resolved
sea-snake
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.
LGTM
Motivation
Identities recovered with the phrase should be easily accessible after recovery.
In this PR, the identity is added to the local storage to be used in the list of existing identities when a new access method is added.
Changes
addLastUsedIdentityIfMissingtolastUsedIdentitiesStore, which adds an identity only if it does not already exist, ensuring that existing data is not overwritten.+page.svelteto useaddLastUsedIdentityIfMissingwhen registering OpenID and passkey access methods, so identities are only added when missing, using accurate timestamps and identity information.nameprop toAddAccessMethodWizard.sveltecomponent.nametocreatePasskeymethod inAddAccessMethodFlowinstead of relying in thelastUsedIdentitiesStore.Tests
addLastUsedIdentityIfMissingto verify that it adds new identities and does not modify existing ones.