@totemsdk/core 1.0.9 → 1.0.11
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/LICENSE +21 -0
- package/README.md +5 -5
- package/dist/Streamable.js +54 -31
- package/dist/adapters/index.js +18 -8
- package/dist/adapters/types.js +19 -8
- package/dist/binio.js +5 -1
- package/dist/bip39.js +24 -14
- package/dist/derive.js +11 -7
- package/dist/index.js +130 -22
- package/dist/javaStreamables.js +49 -30
- package/dist/lease/LeaseMonitor.js +7 -3
- package/dist/lease/LeaseStore.js +7 -3
- package/dist/lease/WatermarkStore.js +7 -3
- package/dist/lease/index.js +13 -4
- package/dist/lease-client.js +8 -3
- package/dist/minima32.js +22 -13
- package/dist/minimaWireSerializer.js +20 -14
- package/dist/mmr.js +35 -23
- package/dist/mx.js +10 -1
- package/dist/params.js +9 -5
- package/dist/script.js +12 -7
- package/dist/scripts/contract-helpers.js +37 -26
- package/dist/scripts/dapp-types.js +11 -6
- package/dist/scripts/index.js +38 -4
- package/dist/scripts/types.js +26 -12
- package/dist/scripts/witness-serializer.js +48 -30
- package/dist/transaction.js +55 -46
- package/dist/treekey.js +74 -58
- package/dist/tx/TransactionLifecycle.js +11 -5
- package/dist/tx/TransactionReceiptStore.js +7 -3
- package/dist/tx/TransactionService.js +14 -10
- package/dist/tx/index.js +11 -3
- package/dist/tx/types.js +2 -1
- package/dist/util.js +5 -1
- package/dist/utils.js +12 -5
- package/dist/verify.js +36 -25
- package/dist/version.js +5 -2
- package/dist/wots.d.ts +2 -2
- package/dist/wots.js +94 -64
- package/package.json +50 -6
- package/src/Streamable.d.ts +0 -268
- package/src/Streamable.js +0 -416
- package/src/Streamable.ts +0 -567
- package/src/__tests__/Streamable.parity.test.ts +0 -422
- package/src/__tests__/perAddressDerivation.parity.test.ts +0 -152
- package/src/__tests__/roottree-prepare.test.ts +0 -101
- package/src/__tests__/wots-parity.test.ts +0 -289
- package/src/adapters/index.d.ts +0 -190
- package/src/adapters/index.js +0 -117
- package/src/adapters/index.ts +0 -301
- package/src/adapters/types.ts +0 -235
- package/src/addr.oracle.test.ts +0 -25
- package/src/address.test.ts +0 -55
- package/src/binio.ts +0 -21
- package/src/bip39.d.ts +0 -91
- package/src/bip39.js +0 -427
- package/src/bip39.ts +0 -432
- package/src/derive.d.ts +0 -2
- package/src/derive.js +0 -13
- package/src/derive.ts +0 -11
- package/src/index.d.ts +0 -26
- package/src/index.js +0 -128
- package/src/index.test.ts +0 -5
- package/src/index.ts +0 -221
- package/src/javaStreamables.d.ts +0 -233
- package/src/javaStreamables.js +0 -332
- package/src/javaStreamables.ts +0 -403
- package/src/lease/LeaseMonitor.d.ts +0 -44
- package/src/lease/LeaseMonitor.js +0 -111
- package/src/lease/LeaseMonitor.ts +0 -157
- package/src/lease/LeaseStore.d.ts +0 -57
- package/src/lease/LeaseStore.js +0 -148
- package/src/lease/LeaseStore.ts +0 -203
- package/src/lease/WatermarkStore.d.ts +0 -61
- package/src/lease/WatermarkStore.js +0 -206
- package/src/lease/WatermarkStore.ts +0 -270
- package/src/lease/index.d.ts +0 -14
- package/src/lease/index.js +0 -22
- package/src/lease/index.ts +0 -41
- package/src/lease-client.d.ts +0 -31
- package/src/lease-client.js +0 -44
- package/src/lease-client.ts +0 -69
- package/src/minima32.d.ts +0 -10
- package/src/minima32.js +0 -113
- package/src/minima32.test.ts +0 -11
- package/src/minima32.ts +0 -127
- package/src/minimaWireSerializer.d.ts +0 -189
- package/src/minimaWireSerializer.js +0 -311
- package/src/minimaWireSerializer.test.ts +0 -466
- package/src/minimaWireSerializer.ts +0 -117
- package/src/mmr.d.ts +0 -157
- package/src/mmr.js +0 -340
- package/src/mmr.oracle.test.ts +0 -28
- package/src/mmr.ts +0 -429
- package/src/mx.test.ts +0 -25
- package/src/mx.ts +0 -1
- package/src/params.d.ts +0 -29
- package/src/params.d.ts.map +0 -1
- package/src/params.js +0 -20
- package/src/params.js.map +0 -1
- package/src/params.ts +0 -44
- package/src/script.d.ts +0 -7
- package/src/script.js +0 -27
- package/src/script.ts +0 -24
- package/src/scripts/contract-helpers.ts +0 -609
- package/src/scripts/dapp-types.ts +0 -240
- package/src/scripts/index.ts +0 -22
- package/src/scripts/types.d.ts +0 -81
- package/src/scripts/types.js +0 -145
- package/src/scripts/types.ts +0 -247
- package/src/scripts/witness-serializer.ts +0 -384
- package/src/transaction.ts +0 -430
- package/src/treekey.d.ts +0 -383
- package/src/treekey.js +0 -774
- package/src/treekey.parity.test.ts +0 -459
- package/src/treekey.ts +0 -975
- package/src/tx/TransactionLifecycle.d.ts +0 -55
- package/src/tx/TransactionLifecycle.js +0 -188
- package/src/tx/TransactionLifecycle.ts +0 -280
- package/src/tx/TransactionReceiptStore.d.ts +0 -36
- package/src/tx/TransactionReceiptStore.js +0 -89
- package/src/tx/TransactionReceiptStore.ts +0 -112
- package/src/tx/TransactionService.d.ts +0 -31
- package/src/tx/TransactionService.js +0 -140
- package/src/tx/TransactionService.ts +0 -252
- package/src/tx/index.d.ts +0 -13
- package/src/tx/index.js +0 -20
- package/src/tx/index.ts +0 -44
- package/src/tx/types.d.ts +0 -80
- package/src/tx/types.js +0 -6
- package/src/tx/types.ts +0 -130
- package/src/util.d.ts +0 -1
- package/src/util.js +0 -5
- package/src/util.ts +0 -1
- package/src/utils.d.ts +0 -8
- package/src/utils.js +0 -42
- package/src/utils.ts +0 -38
- package/src/verify.ts +0 -210
- package/src/version.ts +0 -13
- package/src/wots.d.ts +0 -224
- package/src/wots.d.ts.map +0 -1
- package/src/wots.js +0 -565
- package/src/wots.js.map +0 -1
- package/src/wots.ts +0 -651
- package/test-vectors.json +0 -45
package/src/bip39.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minima-Compatible BIP39 Seed Phrase Handling
|
|
3
|
-
*
|
|
4
|
-
* IMPORTANT: This is NOT standard BIP39!
|
|
5
|
-
* Minima uses the BIP39 English word list for human-friendly phrases,
|
|
6
|
-
* but does NOT use PBKDF2, passphrase salt, or checksum validation.
|
|
7
|
-
*
|
|
8
|
-
* Seed derivation is simply: SHA3-256(phrase_bytes)
|
|
9
|
-
*
|
|
10
|
-
* Matches BIP39.java behavior exactly:
|
|
11
|
-
* - cleanSeedPhrase(): Normalizes input with prefix matching
|
|
12
|
-
* - convertStringToSeed(): Hashes phrase bytes with SHA3-256
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Official BIP39 English word list (2048 words)
|
|
16
|
-
* From https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
|
|
17
|
-
*/
|
|
18
|
-
export declare const WORD_LIST: readonly string[];
|
|
19
|
-
/**
|
|
20
|
-
* Clean and normalize a seed phrase matching Minima's BIP39.cleanSeedPhrase() exactly
|
|
21
|
-
*
|
|
22
|
-
* From BIP39.java:
|
|
23
|
-
* - Split by whitespace
|
|
24
|
-
* - For each token: lowercase; length >= 3 required
|
|
25
|
-
* - If token length < 4: must match full word in wordlist
|
|
26
|
-
* - Else: accept FIRST word in wordlist that startsWith(token)
|
|
27
|
-
* - Join with single spaces, trim, then convert to UPPERCASE
|
|
28
|
-
*
|
|
29
|
-
* @param seedPhrase - Raw user input (may be abbreviated, mixed case)
|
|
30
|
-
* @returns Canonical uppercase phrase with full words from BIP39 list
|
|
31
|
-
* @throws Error if any word cannot be matched
|
|
32
|
-
*/
|
|
33
|
-
export declare function cleanSeedPhrase(seedPhrase: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Validate that a phrase contains valid BIP39 words
|
|
36
|
-
* Does NOT check checksum (Minima doesn't use checksums)
|
|
37
|
-
*
|
|
38
|
-
* @param phrase - Space-separated words (any case)
|
|
39
|
-
* @returns true if all words are valid BIP39 words
|
|
40
|
-
*/
|
|
41
|
-
export declare function validatePhrase(phrase: string): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Convert a seed phrase to a 32-byte seed matching Minima's BIP39.convertStringToSeed()
|
|
44
|
-
*
|
|
45
|
-
* IMPORTANT: This is NOT standard BIP39!
|
|
46
|
-
* Minima simply hashes the phrase bytes with SHA3-256.
|
|
47
|
-
* No PBKDF2, no passphrase salt, no "mnemonic" prefix.
|
|
48
|
-
*
|
|
49
|
-
* From BIP39.java convertStringToSeed():
|
|
50
|
-
* MiniString phrase = new MiniString(zPhrase);
|
|
51
|
-
* return new MiniData(Crypto.getInstance().hashData(phrase.getData()));
|
|
52
|
-
*
|
|
53
|
-
* @param phrase - Canonical phrase (should be cleaned first with cleanSeedPhrase)
|
|
54
|
-
* @returns 32-byte SHA3-256 seed
|
|
55
|
-
*/
|
|
56
|
-
export declare function convertStringToSeed(phrase: string): Uint8Array;
|
|
57
|
-
/**
|
|
58
|
-
* Convert word array to seed matching Minima's BIP39.convertWordListToSeed()
|
|
59
|
-
*
|
|
60
|
-
* From BIP39.java:
|
|
61
|
-
* String allwords = convertWordListToString(zWords);
|
|
62
|
-
* MiniString ministr = new MiniString(allwords);
|
|
63
|
-
* MiniData hash = new MiniData(Crypto.getInstance().hashData(ministr.getData()));
|
|
64
|
-
*
|
|
65
|
-
* @param words - Array of BIP39 words
|
|
66
|
-
* @returns 32-byte SHA3-256 seed
|
|
67
|
-
*/
|
|
68
|
-
export declare function convertWordListToSeed(words: string[]): Uint8Array;
|
|
69
|
-
/**
|
|
70
|
-
* Full pipeline: raw user input → 32-byte seed
|
|
71
|
-
*
|
|
72
|
-
* 1. cleanSeedPhrase() - normalize with prefix matching, output uppercase
|
|
73
|
-
* 2. convertStringToSeed() - SHA3-256 hash of phrase bytes
|
|
74
|
-
*
|
|
75
|
-
* @param rawPhrase - User's input (may be abbreviated, mixed case)
|
|
76
|
-
* @returns 32-byte seed for TreeKey
|
|
77
|
-
* @throws Error if phrase contains invalid words
|
|
78
|
-
*/
|
|
79
|
-
export declare function phraseToSeed(rawPhrase: string): Uint8Array;
|
|
80
|
-
/**
|
|
81
|
-
* Generate a new random 24-word seed phrase
|
|
82
|
-
* Uses crypto.getRandomValues for secure randomness
|
|
83
|
-
*
|
|
84
|
-
* @returns Array of 24 random BIP39 words (lowercase)
|
|
85
|
-
*/
|
|
86
|
-
export declare function generateWordList(): string[];
|
|
87
|
-
/**
|
|
88
|
-
* Generate a new random seed phrase as a string
|
|
89
|
-
* @returns 24-word phrase in UPPERCASE (canonical form)
|
|
90
|
-
*/
|
|
91
|
-
export declare function generateSeedPhrase(): string;
|
package/src/bip39.js
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Minima-Compatible BIP39 Seed Phrase Handling
|
|
4
|
-
*
|
|
5
|
-
* IMPORTANT: This is NOT standard BIP39!
|
|
6
|
-
* Minima uses the BIP39 English word list for human-friendly phrases,
|
|
7
|
-
* but does NOT use PBKDF2, passphrase salt, or checksum validation.
|
|
8
|
-
*
|
|
9
|
-
* Seed derivation is simply: SHA3-256(phrase_bytes)
|
|
10
|
-
*
|
|
11
|
-
* Matches BIP39.java behavior exactly:
|
|
12
|
-
* - cleanSeedPhrase(): Normalizes input with prefix matching
|
|
13
|
-
* - convertStringToSeed(): Hashes phrase bytes with SHA3-256
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.WORD_LIST = void 0;
|
|
17
|
-
exports.cleanSeedPhrase = cleanSeedPhrase;
|
|
18
|
-
exports.validatePhrase = validatePhrase;
|
|
19
|
-
exports.convertStringToSeed = convertStringToSeed;
|
|
20
|
-
exports.convertWordListToSeed = convertWordListToSeed;
|
|
21
|
-
exports.phraseToSeed = phraseToSeed;
|
|
22
|
-
exports.generateWordList = generateWordList;
|
|
23
|
-
exports.generateSeedPhrase = generateSeedPhrase;
|
|
24
|
-
const sha3_1 = require("@noble/hashes/sha3");
|
|
25
|
-
/**
|
|
26
|
-
* Official BIP39 English word list (2048 words)
|
|
27
|
-
* From https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
|
|
28
|
-
*/
|
|
29
|
-
exports.WORD_LIST = [
|
|
30
|
-
"abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract",
|
|
31
|
-
"absurd", "abuse", "access", "accident", "account", "accuse", "achieve", "acid",
|
|
32
|
-
"acoustic", "acquire", "across", "act", "action", "actor", "actress", "actual",
|
|
33
|
-
"adapt", "add", "addict", "address", "adjust", "admit", "adult", "advance",
|
|
34
|
-
"advice", "aerobic", "affair", "afford", "afraid", "again", "age", "agent",
|
|
35
|
-
"agree", "ahead", "aim", "air", "airport", "aisle", "alarm", "album",
|
|
36
|
-
"alcohol", "alert", "alien", "all", "alley", "allow", "almost", "alone",
|
|
37
|
-
"alpha", "already", "also", "alter", "always", "amateur", "amazing", "among",
|
|
38
|
-
"amount", "amused", "analyst", "anchor", "ancient", "anger", "angle", "angry",
|
|
39
|
-
"animal", "ankle", "announce", "annual", "another", "answer", "antenna", "antique",
|
|
40
|
-
"anxiety", "any", "apart", "apology", "appear", "apple", "approve", "april",
|
|
41
|
-
"arch", "arctic", "area", "arena", "argue", "arm", "armed", "armor",
|
|
42
|
-
"army", "around", "arrange", "arrest", "arrive", "arrow", "art", "artefact",
|
|
43
|
-
"artist", "artwork", "ask", "aspect", "assault", "asset", "assist", "assume",
|
|
44
|
-
"asthma", "athlete", "atom", "attack", "attend", "attitude", "attract", "auction",
|
|
45
|
-
"audit", "august", "aunt", "author", "auto", "autumn", "average", "avocado",
|
|
46
|
-
"avoid", "awake", "aware", "away", "awesome", "awful", "awkward", "axis",
|
|
47
|
-
"baby", "bachelor", "bacon", "badge", "bag", "balance", "balcony", "ball",
|
|
48
|
-
"bamboo", "banana", "banner", "bar", "barely", "bargain", "barrel", "base",
|
|
49
|
-
"basic", "basket", "battle", "beach", "bean", "beauty", "because", "become",
|
|
50
|
-
"beef", "before", "begin", "behave", "behind", "believe", "below", "belt",
|
|
51
|
-
"bench", "benefit", "best", "betray", "better", "between", "beyond", "bicycle",
|
|
52
|
-
"bid", "bike", "bind", "biology", "bird", "birth", "bitter", "black",
|
|
53
|
-
"blade", "blame", "blanket", "blast", "bleak", "bless", "blind", "blood",
|
|
54
|
-
"blossom", "blouse", "blue", "blur", "blush", "board", "boat", "body",
|
|
55
|
-
"boil", "bomb", "bone", "bonus", "book", "boost", "border", "boring",
|
|
56
|
-
"borrow", "boss", "bottom", "bounce", "box", "boy", "bracket", "brain",
|
|
57
|
-
"brand", "brass", "brave", "bread", "breeze", "brick", "bridge", "brief",
|
|
58
|
-
"bright", "bring", "brisk", "broccoli", "broken", "bronze", "broom", "brother",
|
|
59
|
-
"brown", "brush", "bubble", "buddy", "budget", "buffalo", "build", "bulb",
|
|
60
|
-
"bulk", "bullet", "bundle", "bunker", "burden", "burger", "burst", "bus",
|
|
61
|
-
"business", "busy", "butter", "buyer", "buzz", "cabbage", "cabin", "cable",
|
|
62
|
-
"cactus", "cage", "cake", "call", "calm", "camera", "camp", "can",
|
|
63
|
-
"canal", "cancel", "candy", "cannon", "canoe", "canvas", "canyon", "capable",
|
|
64
|
-
"capital", "captain", "car", "carbon", "card", "cargo", "carpet", "carry",
|
|
65
|
-
"cart", "case", "cash", "casino", "castle", "casual", "cat", "catalog",
|
|
66
|
-
"catch", "category", "cattle", "caught", "cause", "caution", "cave", "ceiling",
|
|
67
|
-
"celery", "cement", "census", "century", "cereal", "certain", "chair", "chalk",
|
|
68
|
-
"champion", "change", "chaos", "chapter", "charge", "chase", "chat", "cheap",
|
|
69
|
-
"check", "cheese", "chef", "cherry", "chest", "chicken", "chief", "child",
|
|
70
|
-
"chimney", "choice", "choose", "chronic", "chuckle", "chunk", "churn", "cigar",
|
|
71
|
-
"cinnamon", "circle", "citizen", "city", "civil", "claim", "clap", "clarify",
|
|
72
|
-
"claw", "clay", "clean", "clerk", "clever", "click", "client", "cliff",
|
|
73
|
-
"climb", "clinic", "clip", "clock", "clog", "close", "cloth", "cloud",
|
|
74
|
-
"clown", "club", "clump", "cluster", "clutch", "coach", "coast", "coconut",
|
|
75
|
-
"code", "coffee", "coil", "coin", "collect", "color", "column", "combine",
|
|
76
|
-
"come", "comfort", "comic", "common", "company", "concert", "conduct", "confirm",
|
|
77
|
-
"congress", "connect", "consider", "control", "convince", "cook", "cool", "copper",
|
|
78
|
-
"copy", "coral", "core", "corn", "correct", "cost", "cotton", "couch",
|
|
79
|
-
"country", "couple", "course", "cousin", "cover", "coyote", "crack", "cradle",
|
|
80
|
-
"craft", "cram", "crane", "crash", "crater", "crawl", "crazy", "cream",
|
|
81
|
-
"credit", "creek", "crew", "cricket", "crime", "crisp", "critic", "crop",
|
|
82
|
-
"cross", "crouch", "crowd", "crucial", "cruel", "cruise", "crumble", "crunch",
|
|
83
|
-
"crush", "cry", "crystal", "cube", "culture", "cup", "cupboard", "curious",
|
|
84
|
-
"current", "curtain", "curve", "cushion", "custom", "cute", "cycle", "dad",
|
|
85
|
-
"damage", "damp", "dance", "danger", "daring", "dash", "daughter", "dawn",
|
|
86
|
-
"day", "deal", "debate", "debris", "decade", "december", "decide", "decline",
|
|
87
|
-
"decorate", "decrease", "deer", "defense", "define", "defy", "degree", "delay",
|
|
88
|
-
"deliver", "demand", "demise", "denial", "dentist", "deny", "depart", "depend",
|
|
89
|
-
"deposit", "depth", "deputy", "derive", "describe", "desert", "design", "desk",
|
|
90
|
-
"despair", "destroy", "detail", "detect", "develop", "device", "devote", "diagram",
|
|
91
|
-
"dial", "diamond", "diary", "dice", "diesel", "diet", "differ", "digital",
|
|
92
|
-
"dignity", "dilemma", "dinner", "dinosaur", "direct", "dirt", "disagree", "discover",
|
|
93
|
-
"disease", "dish", "dismiss", "disorder", "display", "distance", "divert", "divide",
|
|
94
|
-
"divorce", "dizzy", "doctor", "document", "dog", "doll", "dolphin", "domain",
|
|
95
|
-
"donate", "donkey", "donor", "door", "dose", "double", "dove", "draft",
|
|
96
|
-
"dragon", "drama", "drastic", "draw", "dream", "dress", "drift", "drill",
|
|
97
|
-
"drink", "drip", "drive", "drop", "drum", "dry", "duck", "dumb",
|
|
98
|
-
"dune", "during", "dust", "dutch", "duty", "dwarf", "dynamic", "eager",
|
|
99
|
-
"eagle", "early", "earn", "earth", "easily", "east", "easy", "echo",
|
|
100
|
-
"ecology", "economy", "edge", "edit", "educate", "effort", "egg", "eight",
|
|
101
|
-
"either", "elbow", "elder", "electric", "elegant", "element", "elephant", "elevator",
|
|
102
|
-
"elite", "else", "embark", "embody", "embrace", "emerge", "emotion", "employ",
|
|
103
|
-
"empower", "empty", "enable", "enact", "end", "endless", "endorse", "enemy",
|
|
104
|
-
"energy", "enforce", "engage", "engine", "enhance", "enjoy", "enlist", "enough",
|
|
105
|
-
"enrich", "enroll", "ensure", "enter", "entire", "entry", "envelope", "episode",
|
|
106
|
-
"equal", "equip", "era", "erase", "erode", "erosion", "error", "erupt",
|
|
107
|
-
"escape", "essay", "essence", "estate", "eternal", "ethics", "evidence", "evil",
|
|
108
|
-
"evoke", "evolve", "exact", "example", "excess", "exchange", "excite", "exclude",
|
|
109
|
-
"excuse", "execute", "exercise", "exhaust", "exhibit", "exile", "exist", "exit",
|
|
110
|
-
"exotic", "expand", "expect", "expire", "explain", "expose", "express", "extend",
|
|
111
|
-
"extra", "eye", "eyebrow", "fabric", "face", "faculty", "fade", "faint",
|
|
112
|
-
"faith", "fall", "false", "fame", "family", "famous", "fan", "fancy",
|
|
113
|
-
"fantasy", "farm", "fashion", "fat", "fatal", "father", "fatigue", "fault",
|
|
114
|
-
"favorite", "feature", "february", "federal", "fee", "feed", "feel", "female",
|
|
115
|
-
"fence", "festival", "fetch", "fever", "few", "fiber", "fiction", "field",
|
|
116
|
-
"figure", "file", "film", "filter", "final", "find", "fine", "finger",
|
|
117
|
-
"finish", "fire", "firm", "first", "fiscal", "fish", "fit", "fitness",
|
|
118
|
-
"fix", "flag", "flame", "flash", "flat", "flavor", "flee", "flight",
|
|
119
|
-
"flip", "float", "flock", "floor", "flower", "fluid", "flush", "fly",
|
|
120
|
-
"foam", "focus", "fog", "foil", "fold", "follow", "food", "foot",
|
|
121
|
-
"force", "forest", "forget", "fork", "fortune", "forum", "forward", "fossil",
|
|
122
|
-
"foster", "found", "fox", "fragile", "frame", "frequent", "fresh", "friend",
|
|
123
|
-
"fringe", "frog", "front", "frost", "frown", "frozen", "fruit", "fuel",
|
|
124
|
-
"fun", "funny", "furnace", "fury", "future", "gadget", "gain", "galaxy",
|
|
125
|
-
"gallery", "game", "gap", "garage", "garbage", "garden", "garlic", "garment",
|
|
126
|
-
"gas", "gasp", "gate", "gather", "gauge", "gaze", "general", "genius",
|
|
127
|
-
"genre", "gentle", "genuine", "gesture", "ghost", "giant", "gift", "giggle",
|
|
128
|
-
"ginger", "giraffe", "girl", "give", "glad", "glance", "glare", "glass",
|
|
129
|
-
"glide", "glimpse", "globe", "gloom", "glory", "glove", "glow", "glue",
|
|
130
|
-
"goat", "goddess", "gold", "good", "goose", "gorilla", "gospel", "gossip",
|
|
131
|
-
"govern", "gown", "grab", "grace", "grain", "grant", "grape", "grass",
|
|
132
|
-
"gravity", "great", "green", "grid", "grief", "grit", "grocery", "group",
|
|
133
|
-
"grow", "grunt", "guard", "guess", "guide", "guilt", "guitar", "gun",
|
|
134
|
-
"gym", "habit", "hair", "half", "hammer", "hamster", "hand", "happy",
|
|
135
|
-
"harbor", "hard", "harsh", "harvest", "hat", "have", "hawk", "hazard",
|
|
136
|
-
"head", "health", "heart", "heavy", "hedgehog", "height", "hello", "helmet",
|
|
137
|
-
"help", "hen", "hero", "hidden", "high", "hill", "hint", "hip",
|
|
138
|
-
"hire", "history", "hobby", "hockey", "hold", "hole", "holiday", "hollow",
|
|
139
|
-
"home", "honey", "hood", "hope", "horn", "horror", "horse", "hospital",
|
|
140
|
-
"host", "hotel", "hour", "hover", "hub", "huge", "human", "humble",
|
|
141
|
-
"humor", "hundred", "hungry", "hunt", "hurdle", "hurry", "hurt", "husband",
|
|
142
|
-
"hybrid", "ice", "icon", "idea", "identify", "idle", "ignore", "ill",
|
|
143
|
-
"illegal", "illness", "image", "imitate", "immense", "immune", "impact", "impose",
|
|
144
|
-
"improve", "impulse", "inch", "include", "income", "increase", "index", "indicate",
|
|
145
|
-
"indoor", "industry", "infant", "inflict", "inform", "inhale", "inherit", "initial",
|
|
146
|
-
"inject", "injury", "inmate", "inner", "innocent", "input", "inquiry", "insane",
|
|
147
|
-
"insect", "inside", "inspire", "install", "intact", "interest", "into", "invest",
|
|
148
|
-
"invite", "involve", "iron", "island", "isolate", "issue", "item", "ivory",
|
|
149
|
-
"jacket", "jaguar", "jar", "jazz", "jealous", "jeans", "jelly", "jewel",
|
|
150
|
-
"job", "join", "joke", "journey", "joy", "judge", "juice", "jump",
|
|
151
|
-
"jungle", "junior", "junk", "just", "kangaroo", "keen", "keep", "ketchup",
|
|
152
|
-
"key", "kick", "kid", "kidney", "kind", "kingdom", "kiss", "kit",
|
|
153
|
-
"kitchen", "kite", "kitten", "kiwi", "knee", "knife", "knock", "know",
|
|
154
|
-
"lab", "label", "labor", "ladder", "lady", "lake", "lamp", "language",
|
|
155
|
-
"laptop", "large", "later", "latin", "laugh", "laundry", "lava", "law",
|
|
156
|
-
"lawn", "lawsuit", "layer", "lazy", "leader", "leaf", "learn", "leave",
|
|
157
|
-
"lecture", "left", "leg", "legal", "legend", "leisure", "lemon", "lend",
|
|
158
|
-
"length", "lens", "leopard", "lesson", "letter", "level", "liar", "liberty",
|
|
159
|
-
"library", "license", "life", "lift", "light", "like", "limb", "limit",
|
|
160
|
-
"link", "lion", "liquid", "list", "little", "live", "lizard", "load",
|
|
161
|
-
"loan", "lobster", "local", "lock", "logic", "lonely", "long", "loop",
|
|
162
|
-
"lottery", "loud", "lounge", "love", "loyal", "lucky", "luggage", "lumber",
|
|
163
|
-
"lunar", "lunch", "luxury", "lyrics", "machine", "mad", "magic", "magnet",
|
|
164
|
-
"maid", "mail", "main", "major", "make", "mammal", "man", "manage",
|
|
165
|
-
"mandate", "mango", "mansion", "manual", "maple", "marble", "march", "margin",
|
|
166
|
-
"marine", "market", "marriage", "mask", "mass", "master", "match", "material",
|
|
167
|
-
"math", "matrix", "matter", "maximum", "maze", "meadow", "mean", "measure",
|
|
168
|
-
"meat", "mechanic", "medal", "media", "melody", "melt", "member", "memory",
|
|
169
|
-
"mention", "menu", "mercy", "merge", "merit", "merry", "mesh", "message",
|
|
170
|
-
"metal", "method", "middle", "midnight", "milk", "million", "mimic", "mind",
|
|
171
|
-
"minimum", "minor", "minute", "miracle", "mirror", "misery", "miss", "mistake",
|
|
172
|
-
"mix", "mixed", "mixture", "mobile", "model", "modify", "mom", "moment",
|
|
173
|
-
"monitor", "monkey", "monster", "month", "moon", "moral", "more", "morning",
|
|
174
|
-
"mosquito", "mother", "motion", "motor", "mountain", "mouse", "move", "movie",
|
|
175
|
-
"much", "muffin", "mule", "multiply", "muscle", "museum", "mushroom", "music",
|
|
176
|
-
"must", "mutual", "myself", "mystery", "myth", "naive", "name", "napkin",
|
|
177
|
-
"narrow", "nasty", "nation", "nature", "near", "neck", "need", "negative",
|
|
178
|
-
"neglect", "neither", "nephew", "nerve", "nest", "net", "network", "neutral",
|
|
179
|
-
"never", "news", "next", "nice", "night", "noble", "noise", "nominee",
|
|
180
|
-
"noodle", "normal", "north", "nose", "notable", "note", "nothing", "notice",
|
|
181
|
-
"novel", "now", "nuclear", "number", "nurse", "nut", "oak", "obey",
|
|
182
|
-
"object", "oblige", "obscure", "observe", "obtain", "obvious", "occur", "ocean",
|
|
183
|
-
"october", "odor", "off", "offer", "office", "often", "oil", "okay",
|
|
184
|
-
"old", "olive", "olympic", "omit", "once", "one", "onion", "online",
|
|
185
|
-
"only", "open", "opera", "opinion", "oppose", "option", "orange", "orbit",
|
|
186
|
-
"orchard", "order", "ordinary", "organ", "orient", "original", "orphan", "ostrich",
|
|
187
|
-
"other", "outdoor", "outer", "output", "outside", "oval", "oven", "over",
|
|
188
|
-
"own", "owner", "oxygen", "oyster", "ozone", "pact", "paddle", "page",
|
|
189
|
-
"pair", "palace", "palm", "panda", "panel", "panic", "panther", "paper",
|
|
190
|
-
"parade", "parent", "park", "parrot", "party", "pass", "patch", "path",
|
|
191
|
-
"patient", "patrol", "pattern", "pause", "pave", "payment", "peace", "peanut",
|
|
192
|
-
"pear", "peasant", "pelican", "pen", "penalty", "pencil", "people", "pepper",
|
|
193
|
-
"perfect", "permit", "person", "pet", "phone", "photo", "phrase", "physical",
|
|
194
|
-
"piano", "picnic", "picture", "piece", "pig", "pigeon", "pill", "pilot",
|
|
195
|
-
"pink", "pioneer", "pipe", "pistol", "pitch", "pizza", "place", "planet",
|
|
196
|
-
"plastic", "plate", "play", "please", "pledge", "pluck", "plug", "plunge",
|
|
197
|
-
"poem", "poet", "point", "polar", "pole", "police", "pond", "pony",
|
|
198
|
-
"pool", "popular", "portion", "position", "possible", "post", "potato", "pottery",
|
|
199
|
-
"poverty", "powder", "power", "practice", "praise", "predict", "prefer", "prepare",
|
|
200
|
-
"present", "pretty", "prevent", "price", "pride", "primary", "print", "priority",
|
|
201
|
-
"prison", "private", "prize", "problem", "process", "produce", "profit", "program",
|
|
202
|
-
"project", "promote", "proof", "property", "prosper", "protect", "proud", "provide",
|
|
203
|
-
"public", "pudding", "pull", "pulp", "pulse", "pumpkin", "punch", "pupil",
|
|
204
|
-
"puppy", "purchase", "purity", "purpose", "purse", "push", "put", "puzzle",
|
|
205
|
-
"pyramid", "quality", "quantum", "quarter", "question", "quick", "quit", "quiz",
|
|
206
|
-
"quote", "rabbit", "raccoon", "race", "rack", "radar", "radio", "rail",
|
|
207
|
-
"rain", "raise", "rally", "ramp", "ranch", "random", "range", "rapid",
|
|
208
|
-
"rare", "rate", "rather", "raven", "raw", "razor", "ready", "real",
|
|
209
|
-
"reason", "rebel", "rebuild", "recall", "receive", "recipe", "record", "recycle",
|
|
210
|
-
"reduce", "reflect", "reform", "refuse", "region", "regret", "regular", "reject",
|
|
211
|
-
"relax", "release", "relief", "rely", "remain", "remember", "remind", "remove",
|
|
212
|
-
"render", "renew", "rent", "reopen", "repair", "repeat", "replace", "report",
|
|
213
|
-
"require", "rescue", "resemble", "resist", "resource", "response", "result", "retire",
|
|
214
|
-
"retreat", "return", "reunion", "reveal", "review", "reward", "rhythm", "rib",
|
|
215
|
-
"ribbon", "rice", "rich", "ride", "ridge", "rifle", "right", "rigid",
|
|
216
|
-
"ring", "riot", "ripple", "risk", "ritual", "rival", "river", "road",
|
|
217
|
-
"roast", "robot", "robust", "rocket", "romance", "roof", "rookie", "room",
|
|
218
|
-
"rose", "rotate", "rough", "round", "route", "royal", "rubber", "rude",
|
|
219
|
-
"rug", "rule", "run", "runway", "rural", "sad", "saddle", "sadness",
|
|
220
|
-
"safe", "sail", "salad", "salmon", "salon", "salt", "salute", "same",
|
|
221
|
-
"sample", "sand", "satisfy", "satoshi", "sauce", "sausage", "save", "say",
|
|
222
|
-
"scale", "scan", "scare", "scatter", "scene", "scheme", "school", "science",
|
|
223
|
-
"scissors", "scorpion", "scout", "scrap", "screen", "script", "scrub", "sea",
|
|
224
|
-
"search", "season", "seat", "second", "secret", "section", "security", "seed",
|
|
225
|
-
"seek", "segment", "select", "sell", "seminar", "senior", "sense", "sentence",
|
|
226
|
-
"series", "service", "session", "settle", "setup", "seven", "shadow", "shaft",
|
|
227
|
-
"shallow", "share", "shed", "shell", "sheriff", "shield", "shift", "shine",
|
|
228
|
-
"ship", "shiver", "shock", "shoe", "shoot", "shop", "short", "shoulder",
|
|
229
|
-
"shove", "shrimp", "shrug", "shuffle", "shy", "sibling", "sick", "side",
|
|
230
|
-
"siege", "sight", "sign", "silent", "silk", "silly", "silver", "similar",
|
|
231
|
-
"simple", "since", "sing", "siren", "sister", "situate", "six", "size",
|
|
232
|
-
"skate", "sketch", "ski", "skill", "skin", "skirt", "skull", "slab",
|
|
233
|
-
"slam", "sleep", "slender", "slice", "slide", "slight", "slim", "slogan",
|
|
234
|
-
"slot", "slow", "slush", "small", "smart", "smile", "smoke", "smooth",
|
|
235
|
-
"snack", "snake", "snap", "sniff", "snow", "soap", "soccer", "social",
|
|
236
|
-
"sock", "soda", "soft", "solar", "soldier", "solid", "solution", "solve",
|
|
237
|
-
"someone", "song", "soon", "sorry", "sort", "soul", "sound", "soup",
|
|
238
|
-
"source", "south", "space", "spare", "spatial", "spawn", "speak", "special",
|
|
239
|
-
"speed", "spell", "spend", "sphere", "spice", "spider", "spike", "spin",
|
|
240
|
-
"spirit", "split", "spoil", "sponsor", "spoon", "sport", "spot", "spray",
|
|
241
|
-
"spread", "spring", "spy", "square", "squeeze", "squirrel", "stable", "stadium",
|
|
242
|
-
"staff", "stage", "stairs", "stamp", "stand", "start", "state", "stay",
|
|
243
|
-
"steak", "steel", "stem", "step", "stereo", "stick", "still", "sting",
|
|
244
|
-
"stock", "stomach", "stone", "stool", "story", "stove", "strategy", "street",
|
|
245
|
-
"strike", "strong", "struggle", "student", "stuff", "stumble", "style", "subject",
|
|
246
|
-
"submit", "subway", "success", "such", "sudden", "suffer", "sugar", "suggest",
|
|
247
|
-
"suit", "summer", "sun", "sunny", "sunset", "super", "supply", "supreme",
|
|
248
|
-
"sure", "surface", "surge", "surprise", "surround", "survey", "suspect", "sustain",
|
|
249
|
-
"swallow", "swamp", "swap", "swarm", "swear", "sweet", "swift", "swim",
|
|
250
|
-
"swing", "switch", "sword", "symbol", "symptom", "syrup", "system", "table",
|
|
251
|
-
"tackle", "tag", "tail", "talent", "talk", "tank", "tape", "target",
|
|
252
|
-
"task", "taste", "tattoo", "taxi", "teach", "team", "tell", "ten",
|
|
253
|
-
"tenant", "tennis", "tent", "term", "test", "text", "thank", "that",
|
|
254
|
-
"theme", "then", "theory", "there", "they", "thing", "this", "thought",
|
|
255
|
-
"three", "thrive", "throw", "thumb", "thunder", "ticket", "tide", "tiger",
|
|
256
|
-
"tilt", "timber", "time", "tiny", "tip", "tired", "tissue", "title",
|
|
257
|
-
"toast", "tobacco", "today", "toddler", "toe", "together", "toilet", "token",
|
|
258
|
-
"tomato", "tomorrow", "tone", "tongue", "tonight", "tool", "tooth", "top",
|
|
259
|
-
"topic", "topple", "torch", "tornado", "tortoise", "toss", "total", "tourist",
|
|
260
|
-
"toward", "tower", "town", "toy", "track", "trade", "traffic", "tragic",
|
|
261
|
-
"train", "transfer", "trap", "trash", "travel", "tray", "treat", "tree",
|
|
262
|
-
"trend", "trial", "tribe", "trick", "trigger", "trim", "trip", "trophy",
|
|
263
|
-
"trouble", "truck", "true", "truly", "trumpet", "trust", "truth", "try",
|
|
264
|
-
"tube", "tuition", "tumble", "tuna", "tunnel", "turkey", "turn", "turtle",
|
|
265
|
-
"twelve", "twenty", "twice", "twin", "twist", "two", "type", "typical",
|
|
266
|
-
"ugly", "umbrella", "unable", "unaware", "uncle", "uncover", "under", "undo",
|
|
267
|
-
"unfair", "unfold", "unhappy", "uniform", "unique", "unit", "universe", "unknown",
|
|
268
|
-
"unlock", "until", "unusual", "unveil", "update", "upgrade", "uphold", "upon",
|
|
269
|
-
"upper", "upset", "urban", "urge", "usage", "use", "used", "useful",
|
|
270
|
-
"useless", "usual", "utility", "vacant", "vacuum", "vague", "valid", "valley",
|
|
271
|
-
"valve", "van", "vanish", "vapor", "various", "vast", "vault", "vehicle",
|
|
272
|
-
"velvet", "vendor", "venture", "venue", "verb", "verify", "version", "very",
|
|
273
|
-
"vessel", "veteran", "viable", "vibrant", "vicious", "victory", "video", "view",
|
|
274
|
-
"village", "vintage", "violin", "virtual", "virus", "visa", "visit", "visual",
|
|
275
|
-
"vital", "vivid", "vocal", "voice", "void", "volcano", "volume", "vote",
|
|
276
|
-
"voyage", "wage", "wagon", "wait", "walk", "wall", "walnut", "want",
|
|
277
|
-
"warfare", "warm", "warrior", "wash", "wasp", "waste", "water", "wave",
|
|
278
|
-
"way", "wealth", "weapon", "wear", "weasel", "weather", "web", "wedding",
|
|
279
|
-
"weekend", "weird", "welcome", "west", "wet", "whale", "what", "wheat",
|
|
280
|
-
"wheel", "when", "where", "whip", "whisper", "wide", "width", "wife",
|
|
281
|
-
"wild", "will", "win", "window", "wine", "wing", "wink", "winner",
|
|
282
|
-
"winter", "wire", "wisdom", "wise", "wish", "witness", "wolf", "woman",
|
|
283
|
-
"wonder", "wood", "wool", "word", "work", "world", "worry", "worth",
|
|
284
|
-
"wrap", "wreck", "wrestle", "wrist", "write", "wrong", "yard", "year",
|
|
285
|
-
"yellow", "you", "young", "youth", "zebra", "zero", "zone", "zoo"
|
|
286
|
-
];
|
|
287
|
-
/**
|
|
288
|
-
* Clean and normalize a seed phrase matching Minima's BIP39.cleanSeedPhrase() exactly
|
|
289
|
-
*
|
|
290
|
-
* From BIP39.java:
|
|
291
|
-
* - Split by whitespace
|
|
292
|
-
* - For each token: lowercase; length >= 3 required
|
|
293
|
-
* - If token length < 4: must match full word in wordlist
|
|
294
|
-
* - Else: accept FIRST word in wordlist that startsWith(token)
|
|
295
|
-
* - Join with single spaces, trim, then convert to UPPERCASE
|
|
296
|
-
*
|
|
297
|
-
* @param seedPhrase - Raw user input (may be abbreviated, mixed case)
|
|
298
|
-
* @returns Canonical uppercase phrase with full words from BIP39 list
|
|
299
|
-
* @throws Error if any word cannot be matched
|
|
300
|
-
*/
|
|
301
|
-
function cleanSeedPhrase(seedPhrase) {
|
|
302
|
-
const tokens = seedPhrase.trim().split(/\s+/);
|
|
303
|
-
const matchedWords = [];
|
|
304
|
-
for (const rawToken of tokens) {
|
|
305
|
-
const token = rawToken.toLowerCase();
|
|
306
|
-
if (token.length < 3) {
|
|
307
|
-
throw new Error(`Word too short: "${rawToken}" (minimum 3 characters)`);
|
|
308
|
-
}
|
|
309
|
-
let found = false;
|
|
310
|
-
if (token.length < 4) {
|
|
311
|
-
for (const word of exports.WORD_LIST) {
|
|
312
|
-
if (token === word) {
|
|
313
|
-
matchedWords.push(word);
|
|
314
|
-
found = true;
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
for (const word of exports.WORD_LIST) {
|
|
321
|
-
if (word.startsWith(token)) {
|
|
322
|
-
matchedWords.push(word);
|
|
323
|
-
found = true;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
if (!found) {
|
|
329
|
-
throw new Error(`Unknown BIP39 word: "${rawToken}"`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return matchedWords.join(' ').trim().toUpperCase();
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Validate that a phrase contains valid BIP39 words
|
|
336
|
-
* Does NOT check checksum (Minima doesn't use checksums)
|
|
337
|
-
*
|
|
338
|
-
* @param phrase - Space-separated words (any case)
|
|
339
|
-
* @returns true if all words are valid BIP39 words
|
|
340
|
-
*/
|
|
341
|
-
function validatePhrase(phrase) {
|
|
342
|
-
try {
|
|
343
|
-
cleanSeedPhrase(phrase);
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
catch {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Convert a seed phrase to a 32-byte seed matching Minima's BIP39.convertStringToSeed()
|
|
352
|
-
*
|
|
353
|
-
* IMPORTANT: This is NOT standard BIP39!
|
|
354
|
-
* Minima simply hashes the phrase bytes with SHA3-256.
|
|
355
|
-
* No PBKDF2, no passphrase salt, no "mnemonic" prefix.
|
|
356
|
-
*
|
|
357
|
-
* From BIP39.java convertStringToSeed():
|
|
358
|
-
* MiniString phrase = new MiniString(zPhrase);
|
|
359
|
-
* return new MiniData(Crypto.getInstance().hashData(phrase.getData()));
|
|
360
|
-
*
|
|
361
|
-
* @param phrase - Canonical phrase (should be cleaned first with cleanSeedPhrase)
|
|
362
|
-
* @returns 32-byte SHA3-256 seed
|
|
363
|
-
*/
|
|
364
|
-
function convertStringToSeed(phrase) {
|
|
365
|
-
const encoder = new TextEncoder();
|
|
366
|
-
const phraseBytes = encoder.encode(phrase);
|
|
367
|
-
return (0, sha3_1.sha3_256)(phraseBytes);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Convert word array to seed matching Minima's BIP39.convertWordListToSeed()
|
|
371
|
-
*
|
|
372
|
-
* From BIP39.java:
|
|
373
|
-
* String allwords = convertWordListToString(zWords);
|
|
374
|
-
* MiniString ministr = new MiniString(allwords);
|
|
375
|
-
* MiniData hash = new MiniData(Crypto.getInstance().hashData(ministr.getData()));
|
|
376
|
-
*
|
|
377
|
-
* @param words - Array of BIP39 words
|
|
378
|
-
* @returns 32-byte SHA3-256 seed
|
|
379
|
-
*/
|
|
380
|
-
function convertWordListToSeed(words) {
|
|
381
|
-
const phrase = words.join(' ').trim();
|
|
382
|
-
return convertStringToSeed(phrase);
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Full pipeline: raw user input → 32-byte seed
|
|
386
|
-
*
|
|
387
|
-
* 1. cleanSeedPhrase() - normalize with prefix matching, output uppercase
|
|
388
|
-
* 2. convertStringToSeed() - SHA3-256 hash of phrase bytes
|
|
389
|
-
*
|
|
390
|
-
* @param rawPhrase - User's input (may be abbreviated, mixed case)
|
|
391
|
-
* @returns 32-byte seed for TreeKey
|
|
392
|
-
* @throws Error if phrase contains invalid words
|
|
393
|
-
*/
|
|
394
|
-
function phraseToSeed(rawPhrase) {
|
|
395
|
-
const canonical = cleanSeedPhrase(rawPhrase);
|
|
396
|
-
return convertStringToSeed(canonical);
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Generate a new random 24-word seed phrase
|
|
400
|
-
* Uses crypto.getRandomValues for secure randomness
|
|
401
|
-
*
|
|
402
|
-
* @returns Array of 24 random BIP39 words (lowercase)
|
|
403
|
-
*/
|
|
404
|
-
function generateWordList() {
|
|
405
|
-
const words = [];
|
|
406
|
-
const randomValues = new Uint32Array(24);
|
|
407
|
-
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
408
|
-
crypto.getRandomValues(randomValues);
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
for (let i = 0; i < 24; i++) {
|
|
412
|
-
randomValues[i] = Math.floor(Math.random() * 0xFFFFFFFF);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
for (let i = 0; i < 24; i++) {
|
|
416
|
-
const index = randomValues[i] % exports.WORD_LIST.length;
|
|
417
|
-
words.push(exports.WORD_LIST[index]);
|
|
418
|
-
}
|
|
419
|
-
return words;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Generate a new random seed phrase as a string
|
|
423
|
-
* @returns 24-word phrase in UPPERCASE (canonical form)
|
|
424
|
-
*/
|
|
425
|
-
function generateSeedPhrase() {
|
|
426
|
-
return generateWordList().join(' ').toUpperCase();
|
|
427
|
-
}
|