-
Notifications
You must be signed in to change notification settings - Fork 164
Implement the flow using the recovery flow happy path #3453
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
Conversation
|
New UX: Copy pasting all the words Screen.Recording.2025-10-31.at.10.04.18.movInvalid mnemonic Screen.Recording.2025-10-31.at.10.05.46.movManually adding last word Screen.Recording.2025-10-31.at.10.05.58.mov |
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 implements a recovery phrase input UI and the underlying flow to recover an identity using a 24-word BIP-39 mnemonic phrase. The implementation includes SLIP-0010 key derivation, mnemonic validation, and authentication logic.
- Adds a recovery phrase input form with 24 word fields supporting keyboard navigation and paste functionality
- Implements SLIP-0010 Ed25519 key derivation from BIP-39 mnemonics with proper hardened path support
- Creates a recovery flow that validates the mnemonic, derives the identity, and authenticates against the canister
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/frontend/src/routes/(new-styling)/recovery-phrase/+page.svelte | Implements the recovery phrase UI with 24 input fields, keyboard navigation, paste handling, and auto-submit on completion |
| src/frontend/src/lib/utils/recoveryPhrase.ts | Provides SLIP-0010 key derivation utilities, BIP-39 mnemonic validation, and Ed25519 identity generation from mnemonics |
| src/frontend/src/lib/utils/recoveryPhrase.test.ts | Tests SLIP-0010 derivation against official test vectors and validates behavior with invalid mnemonics |
| src/frontend/src/lib/flows/recoverWithPhraseFlow.svelte.ts | Orchestrates the recovery flow including mnemonic validation, identity derivation, and authentication with the canister |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/frontend/src/routes/(new-styling)/recovery-phrase/+page.svelte
Outdated
Show resolved
Hide resolved
src/frontend/src/routes/(new-styling)/recovery-phrase/+page.svelte
Outdated
Show resolved
Hide resolved
| words: string[], | ||
| ): Promise< | ||
| | { success: true; info: IdentityInfo; identity: DelegationIdentity } | ||
| | { success: false; error: Error } |
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.
Why not just throw the error?
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
* Recovery flow happy path * Refactor to a function * Support pasting words * Use global agent options and submit on enter or word pasting * Revert and improve comments * Remove unnecessary comment and unused import * Remove unnecessary import * GH review changes * Change submit trigger * Refactor to throw instead of variant
Motivation
Enable users to recover access to their identities using the recovery phrase.
In this PR, I set up the flow until the recovery phrase enables an authenticated connection with the backed, effectively restoring access.
NOT IN THIS PR:
Changes
iiConnectionand legacy directory.recoverWithPhraseFlow.svelte.tsto encapsulate the recovery logic, including phrase validation, device lookup, and authentication.isValidMnemonicand enforced mnemonic validation infromMnemonic(previouslyfromMnemonicWithoutValidation), throwing an error for invalid mnemonics.Tests
Tested locally: