@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.
@@ -18472,15 +18472,13 @@ var wordlists = {
18472
18472
  // src/index.ts
18473
18473
  var isJapanese = (wordlist10) => wordlist10[0] === "\u3042\u3044\u3053\u304F\u3057\u3093";
18474
18474
  function nfkd(str) {
18475
- if (typeof str !== "string")
18476
- throw new TypeError(`Invalid mnemonic type: ${typeof str}`);
18475
+ if (typeof str !== "string") throw new TypeError(`Invalid mnemonic type: ${typeof str}`);
18477
18476
  return str.normalize("NFKD");
18478
18477
  }
18479
18478
  function normalize(str) {
18480
18479
  const norm = nfkd(str);
18481
18480
  const words = norm.split(" ");
18482
- if (![12, 15, 18, 21, 24].includes(words.length))
18483
- throw new Error("Invalid mnemonic");
18481
+ if (![12, 15, 18, 21, 24].includes(words.length)) throw new Error("Invalid mnemonic");
18484
18482
  return { nfkd: norm, words };
18485
18483
  }
18486
18484
  function assertEntropy(entropy) {
@@ -18488,8 +18486,7 @@ function assertEntropy(entropy) {
18488
18486
  }
18489
18487
  function generateMnemonic(wordlist10, strength = 128) {
18490
18488
  assert.number(strength);
18491
- if (strength % 32 !== 0 || strength > 256)
18492
- throw new TypeError("Invalid entropy");
18489
+ if (strength % 32 !== 0 || strength > 256) throw new TypeError("Invalid entropy");
18493
18490
  return entropyToMnemonic(randomBytes(strength / 8), wordlist10);
18494
18491
  }
18495
18492
  var calcChecksum = (entropy) => {
@@ -18500,8 +18497,7 @@ function getCoder(wordlist10) {
18500
18497
  if (!Array.isArray(wordlist10) || wordlist10.length !== 2048 || typeof wordlist10[0] !== "string")
18501
18498
  throw new Error("Worlist: expected array of 2048 strings");
18502
18499
  for (const i of wordlist10) {
18503
- if (typeof i !== "string")
18504
- throw new Error(`Wordlist: non-string element: ${i}`);
18500
+ if (typeof i !== "string") throw new Error(`Wordlist: non-string element: ${i}`);
18505
18501
  }
18506
18502
  return baseUtils.chain(baseUtils.checksum(1, calcChecksum), baseUtils.radix2(11, true), baseUtils.alphabet(wordlist10));
18507
18503
  }