fix: build hashes and recovery-phrase entropy come from ethers (closes #758)
check / check (push) Successful in 7m42s
e2e / e2e-chrome (push) Successful in 15m17s
e2e / e2e-firefox (push) Successful in 2m44s

build.js and script/lib/package.js hash with sha256 from ethers, with the
0x prefix stripped so the build receipt and SHA256SUMS keep bare lowercase
hex. generateMnemonic() takes its 16 bytes of entropy from randomBytes in
ethers. The README Crypto policy no longer lists these as exceptions.

Model: opus-5-5
This commit was merged in pull request #767.
This commit is contained in:
clawbot committed 2026-11-11 00:42:18 +01:00
1 parent 6d158bf1b1
commit b87c03be11
5 files changed
+31 -20

No files matched your search

+2 -5
View File
@@ -1,7 +1,7 @@
// Wallet operations: mnemonic generation, HD derivation, signing.
// All crypto delegated to ethers.js.
const { Mnemonic, HDNodeWallet, Wallet } = require("ethers");
const { Mnemonic, HDNodeWallet, Wallet, randomBytes } = require("ethers");
const { DEBUG, DEBUG_MNEMONIC, BIP44_ETH_PATH } = require("./constants");
function generateMnemonic() {
@@ -10,10 +10,7 @@ function generateMnemonic() {
// settings toggle drives, which would let a user of a release build turn
// the hardcoded, publicly known test phrase back on for real wallets.
if (DEBUG) return DEBUG_MNEMONIC;
const m = Mnemonic.fromEntropy(
globalThis.crypto.getRandomValues(new Uint8Array(16)),
);
return m.phrase;
return Mnemonic.fromEntropy(randomBytes(16)).phrase;
}
// Every extended key (xprv or xpub) entering the app goes through this.