mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-24 07:28:07 +01:00
REF: new wallets now generate 12 words mnemonic seed instead of 24, same security, but easier to manage (closes #2122)
This commit is contained in:
parent
667cd8856e
commit
37091a3fbe
2 changed files with 2 additions and 1 deletions
|
@ -68,7 +68,7 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
||||||
}
|
}
|
||||||
|
|
||||||
async generate() {
|
async generate() {
|
||||||
const buf = await randomBytes(32);
|
const buf = await randomBytes(16);
|
||||||
this.secret = bip39.entropyToMnemonic(buf.toString('hex'));
|
this.secret = bip39.entropyToMnemonic(buf.toString('hex'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ describe('Bech32 Segwit HD (BIP84)', () => {
|
||||||
for (let c = 0; c < 1000; c++) {
|
for (let c = 0; c < 1000; c++) {
|
||||||
await hd.generate();
|
await hd.generate();
|
||||||
const secret = hd.getSecret();
|
const secret = hd.getSecret();
|
||||||
|
assert.strictEqual(secret.split(' ').length, 12);
|
||||||
if (hashmap[secret]) {
|
if (hashmap[secret]) {
|
||||||
throw new Error('Duplicate secret generated!');
|
throw new Error('Duplicate secret generated!');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue