Skip to content

feat: password-encrypted seed storage#132

Open
erdemyerebasmaz wants to merge 5 commits intomainfrom
feat/password-encrypted-seed-storage
Open

feat: password-encrypted seed storage#132
erdemyerebasmaz wants to merge 5 commits intomainfrom
feat/password-encrypted-seed-storage

Conversation

@erdemyerebasmaz
Copy link
Copy Markdown
Contributor

@erdemyerebasmaz erdemyerebasmaz commented Mar 17, 2026

Closes #111

This PR implements password-encrypted seed following the Glow-Web: Password-Encrypted Seed — Fallback Auth Spec.

Summary

  • Password-encrypted vault: Adds a PBKDF2 (600k iterations) + AES-GCM-256 vault service that encrypts the mnemonic at rest in IndexedDB, replacing plain localStorage storage.
    • See src/services/vault.ts.
  • Full auth flow: New SetPasswordPage, UnlockPage, and migration flow for existing users. Passkey remains the default when PRF is available; recovery phrase flow is accessible via toggle or 5-tap logo gateway.
  • UI polish: Shake animation on password errors, autofill dark-theme overrides, FormError fade transitions and PasswordForm external submit support.

Test plan

  • New user flow: passkey button shown by default (PRF available), "Use Recovery Phrase Instead" toggles to mnemonic flow
  • New user mnemonic flow: Get Started → set password → recovery phrase → wallet
  • Restore flow: Restore from Backup → enter valid mnemonic → set password → wallet
  • Unlock flow: returning user sees UnlockPage, enters password to decrypt vault
  • Migration flow: existing localStorage user sees "Secure Glow" page, sets password, vault created
  • No PRF device (e.g. Firefox): always shows mnemonic flow, no passkey option
  • Regression Test: 5-tap logo easter egg toggles between passkey and mnemonic views
  • Regression Test: In the same session, create or restore via passkey, then log out and switch to password-encrypted mode (and vice versa); verify no unexpected behavior occurs

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
breez-glow-web Ready Ready Preview, Comment Mar 19, 2026 11:01am
breez-sdk-spark-example Ready Ready Preview, Comment Mar 19, 2026 11:01am
savage-glow-web Ready Ready Preview, Comment Mar 19, 2026 11:01am

@erdemyerebasmaz erdemyerebasmaz marked this pull request as draft March 17, 2026 14:12
@erdemyerebasmaz erdemyerebasmaz force-pushed the feat/password-encrypted-seed-storage branch from 176c03a to 6dbf6bb Compare March 17, 2026 14:36
@erdemyerebasmaz erdemyerebasmaz marked this pull request as ready for review March 17, 2026 14:55
@erdemyerebasmaz erdemyerebasmaz force-pushed the feat/password-encrypted-seed-storage branch from 6dbf6bb to ce3ce10 Compare March 18, 2026 07:29
@erdemyerebasmaz erdemyerebasmaz force-pushed the feat/password-encrypted-seed-storage branch from ce3ce10 to 6b17a48 Compare March 18, 2026 09:07
@erdemyerebasmaz erdemyerebasmaz changed the title feat: password-encrypted seed storage with forgot-password flow feat: password-encrypted seed storage Mar 18, 2026
@erdemyerebasmaz erdemyerebasmaz linked an issue Mar 18, 2026 that may be closed by this pull request
@erdemyerebasmaz erdemyerebasmaz force-pushed the feat/password-encrypted-seed-storage branch from 6453738 to 6192952 Compare March 18, 2026 11:20
Password-encrypted seed vault using Web Crypto API:
- PBKDF2 (600k iterations, SHA-256) derives an AES-GCM-256 key
- AES-GCM encrypts the mnemonic; ciphertext stored in IndexedDB
- Wrong password detected via GCM authentication tag failure
- Durable writes via tx.oncomplete, stale connection recovery
New wallet creation now requires a password before seed generation:
- PasswordForm component with strength indicator and autofill support
- SetPasswordPage for create/confirm password entry
- GeneratePage updated with vault-aware seed confirmation
- FormError improved with layout-stable animated transitions
- Autofill dark-theme CSS overrides and shake animation
- Extract inline SVG icons (KeyIcon, LockIcon, ShieldCheckIcon, DownloadIcon)
Returning user flows now route through the vault:
- UnlockPage for password-based vault decryption
- Migration screen for legacy localStorage mnemonics
- Restore flow now sets password before connecting
- useBreezSdk startup detects vault/migration/no-wallet states
- Vault deleted on logout; saveMnemonic removed
Vault users must enter their password to decrypt and view the recovery
phrase. Passkey users still authenticate via passkey. Replaces the old
tap-to-reveal flow that read directly from localStorage.
* Add vault architecture, auth flow pages, and startup detection docs.
* Update README security note for both auth methods.
* Replace em dashes with standard punctuation throughout.
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.

Encrypted mnemonics

2 participants