@xyo-network/bip39 2.104.0 → 2.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +4 -8
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +4 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/index.cjs +4 -8
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +4 -8
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/index.cjs +4 -8
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +4 -8
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -3
package/dist/browser/index.cjs
CHANGED
|
@@ -18512,15 +18512,13 @@ var wordlists = {
|
|
|
18512
18512
|
// src/index.ts
|
|
18513
18513
|
var isJapanese = (wordlist10) => wordlist10[0] === "\u3042\u3044\u3053\u304F\u3057\u3093";
|
|
18514
18514
|
function nfkd(str) {
|
|
18515
|
-
if (typeof str !== "string")
|
|
18516
|
-
throw new TypeError(`Invalid mnemonic type: ${typeof str}`);
|
|
18515
|
+
if (typeof str !== "string") throw new TypeError(`Invalid mnemonic type: ${typeof str}`);
|
|
18517
18516
|
return str.normalize("NFKD");
|
|
18518
18517
|
}
|
|
18519
18518
|
function normalize(str) {
|
|
18520
18519
|
const norm = nfkd(str);
|
|
18521
18520
|
const words = norm.split(" ");
|
|
18522
|
-
if (![12, 15, 18, 21, 24].includes(words.length))
|
|
18523
|
-
throw new Error("Invalid mnemonic");
|
|
18521
|
+
if (![12, 15, 18, 21, 24].includes(words.length)) throw new Error("Invalid mnemonic");
|
|
18524
18522
|
return { nfkd: norm, words };
|
|
18525
18523
|
}
|
|
18526
18524
|
function assertEntropy(entropy) {
|
|
@@ -18528,8 +18526,7 @@ function assertEntropy(entropy) {
|
|
|
18528
18526
|
}
|
|
18529
18527
|
function generateMnemonic(wordlist10, strength = 128) {
|
|
18530
18528
|
import_assert.default.number(strength);
|
|
18531
|
-
if (strength % 32 !== 0 || strength > 256)
|
|
18532
|
-
throw new TypeError("Invalid entropy");
|
|
18529
|
+
if (strength % 32 !== 0 || strength > 256) throw new TypeError("Invalid entropy");
|
|
18533
18530
|
return entropyToMnemonic((0, import_utils.randomBytes)(strength / 8), wordlist10);
|
|
18534
18531
|
}
|
|
18535
18532
|
var calcChecksum = (entropy) => {
|
|
@@ -18540,8 +18537,7 @@ function getCoder(wordlist10) {
|
|
|
18540
18537
|
if (!Array.isArray(wordlist10) || wordlist10.length !== 2048 || typeof wordlist10[0] !== "string")
|
|
18541
18538
|
throw new Error("Worlist: expected array of 2048 strings");
|
|
18542
18539
|
for (const i of wordlist10) {
|
|
18543
|
-
if (typeof i !== "string")
|
|
18544
|
-
throw new Error(`Wordlist: non-string element: ${i}`);
|
|
18540
|
+
if (typeof i !== "string") throw new Error(`Wordlist: non-string element: ${i}`);
|
|
18545
18541
|
}
|
|
18546
18542
|
return import_base.utils.chain(import_base.utils.checksum(1, calcChecksum), import_base.utils.radix2(11, true), import_base.utils.alphabet(wordlist10));
|
|
18547
18543
|
}
|