diff options
| author | Adam Soltys <[email protected]> | 2026-11-06 22:55:11 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-06 22:55:11 -0700 |
| commit | 1fe10057f301b09bbad0cfccdfecac9826733048 (patch) | |
| tree | 183ec6f7eabd5de3b4dd1af53e692f6be8264563 /tools/sensitive-feed-test.js | |
| parent | c44377f0f103c2f17805d9e0bf4d2688e962af5e (diff) | |
| download | coinosv3-1fe10057f301b09bbad0cfccdfecac9826733048.tar.gz coinosv3-1fe10057f301b09bbad0cfccdfecac9826733048.zip | |
Opening the wallet no longer stretches the same keys in JavaScript two and three times over. Profiled on Adam's Pixel 9 at 4x CPU (a mid-range phone), a cold launch — a fresh tab, so the wallet comes out of the device vault — spent ~850 ms of its 1.9 s to the balance stretching keys on the main thread: scrypt (N=2^15) to open the vault under its blank password (~520 ms), then PBKDF2-2048 of the same twelve words once per saved wallet to match it to its watch-only entry and twice more for the open one (the BIP84 account and, inside nostr-tools' nip06, the nostr identity). Now src/seed.js keeps each phrase's BIP-39 seed: the boot stretches the phrases it's about to open with WebCrypto's native PBKDF2 while the stores open (warmBootSeeds, alongside the IndexedDB wait it already had), and the wallet, zaps and the nostr key (NIP-06 m/44'/1237'/n'/0/0, derived from that seed — nostrKeyFromSeed) read it; a reader that comes first stretches it the old way and leaves it for the rest. A lock forgets them. The vault under the BLANK password — the default, which scrypt protects from no one, since anyone with the blob can compute scrypt('') — keeps its key beside the blob and new blank seals reuse that salt (fresh nonce each time); sealing under a real password drops it, and real passwords are stretched every time as before. Same cold launch at 4x: balance 2.2–2.9 s → ~1.5 s, scrypt and the JS PBKDF2 gone from the profile. tools/seed-cache-test.js: WebCrypto's seed = @scure/bip39's for plain, passphrased and NFKD input, warmed or cold; the NIP-06 key = nostr-tools'; a malformed phrase still refused; a blank vault opens without scrypt and reseals with the kept salt, a wrong guess fails and drops nothing, a real password keeps nothing
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6Ts5Tktega8VbLg31q
Diffstat (limited to 'tools/sensitive-feed-test.js')
0 files changed, 0 insertions, 0 deletions
