Add two-secret identity recovery kits - #6539
Draft
jmecom wants to merge 9 commits into
Draft
Conversation
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
Signed-off-by: Jordan Mecom <jm@squareup.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a versioned local 2SKD recovery kit for desktop identities. Recovery requires the encrypted
.buzzbackupfile, the user's password, and a separately stored random recovery code.The desktop now saves the encrypted backup and can also generate a one-page printable recovery sheet. The PDF uses Buzz's wordmark and visual language on a white, ink-conscious layout. It includes the recovery code as text and a QR code, the public
npub, and clear instructions to keep it separate from the encrypted backup.The backup derives its encryption key from an Argon2id password half and an HKDF-SHA256 recovery-secret half, then encrypts the nsec with authenticated metadata. Raw key handling stays in native Rust, intermediate secrets are zeroized, and untrusted backup parameters are bounded before derivation.
The PDF never contains the password, nsec, or encrypted backup payload. Native code validates its inputs and writes both exported artifacts as exclusively created, owner-only files, then rereads the persisted bytes before reporting success.
Settings provides recovery-kit creation, verification, encrypted-backup export, and printable-sheet export. Onboarding can restore the kit while preserving existing NIP-49 imports.
This first slice is local-only. It does not add remote backup storage or a server-side reset path.
Tested with the Rust recovery-sheet and key-backup suites, clippy with warnings denied, desktop lint/type/file-size checks, an E2E production build, focused Playwright recovery flows, and a rendered PDF inspected at print resolution.