feat(settings): add encrypted key download to settings - #257
Merged
Conversation
The settings page could import a key backup file, back up to the server, and restore from the server, but there was no way to download an encrypted copy of your keys to disk. privateKeyManager already implemented exportPrivateKeys(), generateExportFilename() and downloadExportedKeys() — nothing in the UI ever called the download path. This wires them to a "Download Keys to File" card that sits above the existing import card, with password + confirmation (min 6 chars) and a note that the password is unrecoverable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan91 finding(s) HIGH/CRITICAL: 5 | MEDIUM: 10 | LOW: 76
…and 41 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Problem
There was no way to download your encrypted keys from https://qrypt.chat/settings. The Private Keys section offered:
…but no export-to-disk. So a user could import a backup file they already had, yet never produce one in the first place.
Cause
The crypto layer was already complete.
src/lib/crypto/private-key-manager.jsimplementsexportPrivateKeys(password),generateExportFilename(),supportsFileDownload()anddownloadExportedKeys().exportPrivateKeys()was called in three places — all of which PUT the ciphertext to/api/auth/key-backup.downloadExportedKeys()had zero callers anywhere in the repo. This was a missing button, not a missing feature.Change
Adds a Download Keys to File card to
PrivateKeyManager.jsx, placed above the existing import card so export/import read as a pair:generateExportFilename()(qryptchat-pq-keys-<timestamp>.json)No changes to the crypto layer, and no new API surface — the file is generated and encrypted entirely client-side.
Verification
pnpm build— clean,/settingscompiles (8.16 kB)pnpm vitest run tests/— 30 files, 295 tests, all passingoxlinton the changed file — no findings🤖 Generated with Claude Code