Skip to content

Conversation

@lmuntaner
Copy link
Collaborator

@lmuntaner lmuntaner commented Nov 19, 2025

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

  • Added a new method addLastUsedIdentityIfMissing to lastUsedIdentitiesStore, which adds an identity only if it does not already exist, ensuring that existing data is not overwritten.
  • Updated +page.svelte to use addLastUsedIdentityIfMissing when registering OpenID and passkey access methods, so identities are only added when missing, using accurate timestamps and identity information.
  • Add name prop to AddAccessMethodWizard.svelte component.
  • Add new argument name to createPasskey method in AddAccessMethodFlow instead of relying in the lastUsedIdentitiesStore.

Tests

  • Added unit tests for addLastUsedIdentityIfMissing to verify that it adds new identities and does not modify existing ones.
  • Tested locally. I checked that an identity was not in the list, I recovered it and then added a passkey and the identity then appeard in the list.

@lmuntaner lmuntaner requested a review from Copilot November 19, 2025 10:56
Copilot finished reviewing on behalf of lmuntaner November 19, 2025 10:58
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

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 addLastUsedIdentityIfMissing method that adds identities conditionally without overwriting existing data
  • Updated access method registration flows to store identity information in local storage
  • Refactored the createPasskey method 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.

@lmuntaner lmuntaner marked this pull request as ready for review November 19, 2025 11:05
@lmuntaner lmuntaner requested a review from sea-snake November 19, 2025 11:05
Copy link
Contributor

@sea-snake sea-snake left a comment

Choose a reason for hiding this comment

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

LGTM

@lmuntaner lmuntaner added this pull request to the merge queue Nov 21, 2025
Merged via the queue into main with commit 5f2bd3a Nov 21, 2025
75 checks passed
@lmuntaner lmuntaner deleted the lm-localstorage-add-access-method-new-identity branch November 21, 2025 08:57
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.

2 participants