feat: add duplicate account import prevention #189

Merged
jose merged 10 commits from account-import-duplicate-prevention into master 2 days ago
jose commented 6 days ago
Owner
  • Add duplicate check in ImportAccountView before account import
  • Add duplicate check in ImportDerivedAccountView for derived accounts
  • Add safety check in saveNewIdentity function to prevent duplicate saves
  • Implement user-friendly warning messages for duplicate attempts
  • Add comprehensive error handling to catch duplicate errors from saveNewIdentity
  • Create Playwright tests to verify duplicate prevention functionality
  • Add documentation for duplicate prevention implementation

The system now prevents users from importing the same account multiple times
by checking for existing DIDs both before import (pre-check) and during
save (post-check). Users receive clear warning messages instead of
technical errors when attempting to import duplicate accounts.

Files modified:

  • src/views/ImportAccountView.vue: Add duplicate check and error handling
  • src/views/ImportDerivedAccountView.vue: Add duplicate check for derived accounts
  • src/libs/util.ts: Add duplicate prevention in saveNewIdentity
  • test-playwright/duplicate-import-test.spec.ts: Add comprehensive tests
  • doc/duplicate-account-import-implementation.md: Add implementation docs

Resolves: Prevent duplicate account imports in IdentitySwitcherView

- Add duplicate check in ImportAccountView before account import - Add duplicate check in ImportDerivedAccountView for derived accounts - Add safety check in saveNewIdentity function to prevent duplicate saves - Implement user-friendly warning messages for duplicate attempts - Add comprehensive error handling to catch duplicate errors from saveNewIdentity - Create Playwright tests to verify duplicate prevention functionality - Add documentation for duplicate prevention implementation The system now prevents users from importing the same account multiple times by checking for existing DIDs both before import (pre-check) and during save (post-check). Users receive clear warning messages instead of technical errors when attempting to import duplicate accounts. Files modified: - src/views/ImportAccountView.vue: Add duplicate check and error handling - src/views/ImportDerivedAccountView.vue: Add duplicate check for derived accounts - src/libs/util.ts: Add duplicate prevention in saveNewIdentity - test-playwright/duplicate-import-test.spec.ts: Add comprehensive tests - doc/duplicate-account-import-implementation.md: Add implementation docs Resolves: Prevent duplicate account imports in IdentitySwitcherView
jose added 2 commits 6 days ago
f51408e32a feat: add duplicate account import prevention
c4f2bb5e3a refactor: move duplicate account import warnings to notification constants
jose commented 6 days ago
Poster
Owner

@trentlarson @anomalist I wanted to hear your thoughts on the changes, specifically the redundancies with the duplication checks when deriving from an existing seed and when adding a new identity. Is it too much, or just right?

@trentlarson @anomalist I wanted to hear your thoughts on the changes, specifically the redundancies with the duplication checks when deriving from an existing seed and when adding a new identity. Is it too much, or just right?
jose added 1 commit 6 days ago
96e4d3c394 chore - reorder duplication test
jose added 1 commit 2 days ago
c9082fa57b refactor: remove single-use notification constant
jose added 1 commit 2 days ago
jose added 2 commits 2 days ago
d339f1a274 chore: remove generated doc
25e37cc415 refactor: consolidate duplicate account checking logic into unified utility
jose added 1 commit 2 days ago
1499211018 refactor: simplify duplicate account error detection
trentlarson added 1 commit 2 days ago
Owner

This all looks good. I just tweaked the error-message logic, so you can see that they are guaranteed to use the exact same message.

This all looks good. I just tweaked the error-message logic, so you can see that they are guaranteed to use the exact same message.
trentlarson added 1 commit 2 days ago
Owner

I just added another commit for a small change: I removed the "catch" from a couple places because all it did was log a message and then rethrow the error, while adding some logging. (This can get confusing, especially when the calling code knows how to handle the error, so I prefer just to let it propagate.)

I just added another commit for a small change: I removed the "catch" from a couple places because all it did was log a message and then rethrow the error, while adding some logging. (This can get confusing, especially when the calling code knows how to handle the error, so I prefer just to let it propagate.)
jose commented 2 days ago
Poster
Owner

Duly noted on those last changes.

Duly noted on those last changes.
jose merged commit 40c8189c51 into master 2 days ago
The pull request has been merged as 40c8189c51.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.