fix: build hashes and recovery-phrase entropy come from ethers (closes #758)
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:
1 parent
6d158bf1b1
commit
b87c03be11
5 files changed
+31
-20
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user