@xyo-network/bip39 2.79.4 → 2.79.6
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/node/index.js
CHANGED
|
@@ -1,50 +1,10 @@
|
|
|
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
|
-
|
|
30
1
|
// src/index.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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"));
|
|
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");
|
|
2
|
+
import assert from "@noble/hashes/_assert";
|
|
3
|
+
import { pbkdf2, pbkdf2Async } from "@noble/hashes/pbkdf2";
|
|
4
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
5
|
+
import { sha512 } from "@noble/hashes/sha512";
|
|
6
|
+
import { randomBytes } from "@noble/hashes/utils";
|
|
7
|
+
import { utils as baseUtils } from "@scure/base";
|
|
48
8
|
|
|
49
9
|
// src/wordlists/czech.ts
|
|
50
10
|
var wordlist = `abdikace
|
|
@@ -18524,17 +18484,17 @@ function normalize(str) {
|
|
|
18524
18484
|
return { nfkd: norm, words };
|
|
18525
18485
|
}
|
|
18526
18486
|
function assertEntropy(entropy) {
|
|
18527
|
-
|
|
18487
|
+
assert.bytes(entropy, 16, 20, 24, 28, 32);
|
|
18528
18488
|
}
|
|
18529
18489
|
function generateMnemonic(wordlist10, strength = 128) {
|
|
18530
|
-
|
|
18490
|
+
assert.number(strength);
|
|
18531
18491
|
if (strength % 32 !== 0 || strength > 256)
|
|
18532
18492
|
throw new TypeError("Invalid entropy");
|
|
18533
|
-
return entropyToMnemonic(
|
|
18493
|
+
return entropyToMnemonic(randomBytes(strength / 8), wordlist10);
|
|
18534
18494
|
}
|
|
18535
18495
|
var calcChecksum = (entropy) => {
|
|
18536
18496
|
const bitsLeft = 8 - entropy.length / 4;
|
|
18537
|
-
return new Uint8Array([
|
|
18497
|
+
return new Uint8Array([sha256(entropy)[0] >> bitsLeft << bitsLeft]);
|
|
18538
18498
|
};
|
|
18539
18499
|
function getCoder(wordlist10) {
|
|
18540
18500
|
if (!Array.isArray(wordlist10) || wordlist10.length !== 2048 || typeof wordlist10[0] !== "string")
|
|
@@ -18543,7 +18503,7 @@ function getCoder(wordlist10) {
|
|
|
18543
18503
|
if (typeof i !== "string")
|
|
18544
18504
|
throw new Error(`Wordlist: non-string element: ${i}`);
|
|
18545
18505
|
});
|
|
18546
|
-
return
|
|
18506
|
+
return baseUtils.chain(baseUtils.checksum(1, calcChecksum), baseUtils.radix2(11, true), baseUtils.alphabet(wordlist10));
|
|
18547
18507
|
}
|
|
18548
18508
|
function mnemonicToEntropy(mnemonic, wordlist10) {
|
|
18549
18509
|
const { words } = normalize(mnemonic);
|
|
@@ -18566,13 +18526,12 @@ function validateMnemonic(mnemonic, wordlist10) {
|
|
|
18566
18526
|
}
|
|
18567
18527
|
var salt = (passphrase) => nfkd(`mnemonic${passphrase}`);
|
|
18568
18528
|
function mnemonicToSeed(mnemonic, passphrase = "") {
|
|
18569
|
-
return
|
|
18529
|
+
return pbkdf2Async(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18570
18530
|
}
|
|
18571
18531
|
function mnemonicToSeedSync(mnemonic, passphrase = "") {
|
|
18572
|
-
return
|
|
18532
|
+
return pbkdf2(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
|
|
18573
18533
|
}
|
|
18574
|
-
|
|
18575
|
-
0 && (module.exports = {
|
|
18534
|
+
export {
|
|
18576
18535
|
entropyToMnemonic,
|
|
18577
18536
|
generateMnemonic,
|
|
18578
18537
|
mnemonicToEntropy,
|
|
@@ -18580,6 +18539,6 @@ function mnemonicToSeedSync(mnemonic, passphrase = "") {
|
|
|
18580
18539
|
mnemonicToSeedSync,
|
|
18581
18540
|
validateMnemonic,
|
|
18582
18541
|
wordlists
|
|
18583
|
-
}
|
|
18542
|
+
};
|
|
18584
18543
|
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
|
|
18585
18544
|
//# sourceMappingURL=index.js.map
|