From f2e22cadf218793c13bd354a2077d9680ad5441f Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 25 Feb 2026 18:23:09 +0700 Subject: [PATCH] Encrypt secrets with libsodium, password required to send MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vault.js: Argon2id key derivation + XSalsa20-Poly1305 encryption via libsodium-wrappers-sumo. No raw crypto primitives. Wallet creation now requires a password. The mnemonic or private key is encrypted before storage — only the ciphertext blob (salt, nonce, ciphertext) is persisted. The plaintext secret is never stored. Sending requires the password to decrypt the secret, derive the signing key, and construct the transaction. Wrong password is caught and reported. --- README.md | 4 +-- src/popup/index.html | 51 ++++++++++++++++++++++++++++ src/popup/index.js | 80 +++++++++++++++++++++++++++++++++++++------- src/shared/vault.js | 62 ++++++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 14 deletions(-) create mode 100644 src/shared/vault.js diff --git a/README.md b/README.md index 9643791..5b605d2 100644 --- a/README.md +++ b/README.md @@ -476,9 +476,9 @@ Everything needed for a minimal working wallet that can send and receive ETH. ### Sending -- [ ] Encrypt recovery phrase / private key with password via libsodium +- [x] Encrypt recovery phrase / private key with password via libsodium (Argon2id + XSalsa20-Poly1305) -- [ ] Password prompt on Send (decrypt private key to construct transaction) +- [x] Password prompt on Send (decrypt private key to construct transaction) - [x] Transaction construction via ethers.js (to, value, gasLimit, gasPrice) - [ ] Gas estimation and fee display before confirming - [x] Broadcast transaction via `eth_sendRawTransaction` diff --git a/src/popup/index.html b/src/popup/index.html index aec750e..a9077a1 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -57,6 +57,26 @@ can access your funds. If you lose them, your wallet cannot be recovered. +
+ +

+ This password encrypts your recovery phrase on this + device. You will need it to send funds. +

+ +
+
+ + +
+
+ +

+ This password encrypts your private key on this device. + You will need it to send funds. +

+ +
+
+ + +
+
+ +

+ Required to authorize the transaction. +

+ +