@xyo-network/bip39 2.79.3 → 2.79.5
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
CHANGED
|
@@ -39,7 +39,7 @@ __export(src_exports, {
|
|
|
39
39
|
wordlists: () => wordlists
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(src_exports);
|
|
42
|
-
var import_assert = __toESM(require("@noble/hashes/_assert"));
|
|
42
|
+
var import_assert = __toESM(require("@noble/hashes/_assert"), 1);
|
|
43
43
|
var import_pbkdf2 = require("@noble/hashes/pbkdf2");
|
|
44
44
|
var import_sha256 = require("@noble/hashes/sha256");
|
|
45
45
|
var import_sha512 = require("@noble/hashes/sha512");
|
|
@@ -1,10 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
1
30
|
// src/index.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
entropyToMnemonic: () => entropyToMnemonic,
|
|
34
|
+
generateMnemonic: () => generateMnemonic,
|
|
35
|
+
mnemonicToEntropy: () => mnemonicToEntropy,
|
|
36
|
+
mnemonicToSeed: () => mnemonicToSeed,
|
|
37
|
+
mnemonicToSeedSync: () => mnemonicToSeedSync,
|
|
38
|
+
validateMnemonic: () => validateMnemonic,
|
|
39
|
+
wordlists: () => wordlists
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
var import_assert = __toESM(require("@noble/hashes/_assert"), 1);
|
|
43
|
+
var import_pbkdf2 = require("@noble/hashes/pbkdf2");
|
|
44
|
+
var import_sha256 = require("@noble/hashes/sha256");
|
|
45
|
+
var import_sha512 = require("@noble/hashes/sha512");
|
|
46
|
+
var import_utils = require("@noble/hashes/utils");
|
|
47
|
+
var import_base = require("@scure/base");
|
|
8
48
|
|
|
9
49
|
// src/wordlists/czech.ts
|
|
10
50
|
var wordlist = `abdikace
|
|
@@ -18484,17 +18524,17 @@ function normalize(str) {
|
|
|
18484
18524
|
return { nfkd: norm, words };
|
|
18485
18525
|
}
|
|
18486
18526
|
function assertEntropy(entropy) {
|
|
18487
|
-
|
|
18527
|
+
import_assert.default.bytes(entropy, 16, 20, 24, 28, 32);
|
|
18488
18528
|
}
|
|
18489
18529
|
function generateMnemonic(wordlist10, strength = 128) {
|
|
18490
|
-
|
|
18530
|
+
import_assert.default.number(strength);
|
|
18491
18531
|
if (strength % 32 !== 0 || strength > 256)
|
|
18492
18532
|
throw new TypeError("Invalid entropy");
|
|
18493
|
-
return entropyToMnemonic(randomBytes(strength / 8), wordlist10);
|
|
18533
|
+
return entropyToMnemonic((0, import_utils.randomBytes)(strength / 8), wordlist10);
|
|
18494
18534
|
}
|
|
18495
18535
|
var calcChecksum = (entropy) => {
|
|
18496
18536
|
const bitsLeft = 8 - entropy.length / 4;
|
|
18497
|
-
return new Uint8Array([sha256(entropy)[0] >> bitsLeft << bitsLeft]);
|
|
18537
|
+
return new Uint8Array([(0, import_sha256.sha256)(entropy)[0] >> bitsLeft << bitsLeft]);
|
|
18498
18538
|
};
|
|
18499
18539
|
function getCoder(wordlist10) {
|
|
18500
18540
|
if (!Array.isArray(wordlist10) || wordlist10.length !== 2048 || typeof wordlist10[0] !== "string")
|
|
@@ -18503,7 +18543,7 @@ function getCoder(wordlist10) {
|
|
|
18503
18543
|
if (typeof i !== "string")
|
|
18504
18544
|
throw new Error(`Wordlist: non-string element: ${i}`);
|
|
18505
18545
|
});
|
|
18506
|
-
return
|
|
18546
|
+
return import_base.utils.chain(import_base.utils.checksum(1, calcChecksum), import_base.utils.radix2(11, true), import_base.utils.alphabet(wordlist10));
|
|
18507
18547
|
}
|
|
18508
18548
|
function mnemonicToEntropy(mnemonic, wordlist10) {
|
|
18509
18549
|
const { words } = normalize(mnemonic);
|
|
@@ -18526,12 +18566,13 @@ function validateMnemonic(mnemonic, wordlist10) {
|
|
|
18526
18566
|
}
|
|
18527
18567
|
var salt = (passphrase) => nfkd(`mnemonic${passphrase}`);
|
|
18528
18568
|
function mnemonicToSeed(mnemonic, passphrase = "") {
|
|
18529
|
-
return pbkdf2Async(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18569
|
+
return (0, import_pbkdf2.pbkdf2Async)(import_sha512.sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18530
18570
|
}
|
|
18531
18571
|
function mnemonicToSeedSync(mnemonic, passphrase = "") {
|
|
18532
|
-
return pbkdf2(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18572
|
+
return (0, import_pbkdf2.pbkdf2)(import_sha512.sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18533
18573
|
}
|
|
18534
|
-
export
|
|
18574
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
18575
|
+
0 && (module.exports = {
|
|
18535
18576
|
entropyToMnemonic,
|
|
18536
18577
|
generateMnemonic,
|
|
18537
18578
|
mnemonicToEntropy,
|
|
@@ -18539,6 +18580,6 @@ export {
|
|
|
18539
18580
|
mnemonicToSeedSync,
|
|
18540
18581
|
validateMnemonic,
|
|
18541
18582
|
wordlists
|
|
18542
|
-
};
|
|
18583
|
+
});
|
|
18543
18584
|
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
|
|
18544
|
-
//# sourceMappingURL=index.
|
|
18585
|
+
//# sourceMappingURL=index.cjs.map
|