@xyo-network/bip39 2.72.8 → 2.73.0
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/index.d.mts +77 -0
- package/dist/{types/index.d.ts → index.d.ts} +20 -8
- package/dist/index.js +18585 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +18544 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +28 -15
- package/tsup.config.ts +16 -0
- package/dist/cjs/index.js +0 -147
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/wordlists/czech.js +0 -2053
- package/dist/cjs/wordlists/czech.js.map +0 -1
- package/dist/cjs/wordlists/english.js +0 -2053
- package/dist/cjs/wordlists/english.js.map +0 -1
- package/dist/cjs/wordlists/french.js +0 -2053
- package/dist/cjs/wordlists/french.js.map +0 -1
- package/dist/cjs/wordlists/index.js +0 -24
- package/dist/cjs/wordlists/index.js.map +0 -1
- package/dist/cjs/wordlists/italian.js +0 -2053
- package/dist/cjs/wordlists/italian.js.map +0 -1
- package/dist/cjs/wordlists/japanese.js +0 -2053
- package/dist/cjs/wordlists/japanese.js.map +0 -1
- package/dist/cjs/wordlists/korean.js +0 -2053
- package/dist/cjs/wordlists/korean.js.map +0 -1
- package/dist/cjs/wordlists/simplified-chinese.js +0 -2053
- package/dist/cjs/wordlists/simplified-chinese.js.map +0 -1
- package/dist/cjs/wordlists/spanish.js +0 -2053
- package/dist/cjs/wordlists/spanish.js.map +0 -1
- package/dist/cjs/wordlists/traditional-chinese.js +0 -2053
- package/dist/cjs/wordlists/traditional-chinese.js.map +0 -1
- package/dist/docs.json +0 -1057
- package/dist/esm/index.js +0 -137
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/wordlists/czech.js +0 -2050
- package/dist/esm/wordlists/czech.js.map +0 -1
- package/dist/esm/wordlists/english.js +0 -2050
- package/dist/esm/wordlists/english.js.map +0 -1
- package/dist/esm/wordlists/french.js +0 -2050
- package/dist/esm/wordlists/french.js.map +0 -1
- package/dist/esm/wordlists/index.js +0 -21
- package/dist/esm/wordlists/index.js.map +0 -1
- package/dist/esm/wordlists/italian.js +0 -2050
- package/dist/esm/wordlists/italian.js.map +0 -1
- package/dist/esm/wordlists/japanese.js +0 -2050
- package/dist/esm/wordlists/japanese.js.map +0 -1
- package/dist/esm/wordlists/korean.js +0 -2050
- package/dist/esm/wordlists/korean.js.map +0 -1
- package/dist/esm/wordlists/simplified-chinese.js +0 -2050
- package/dist/esm/wordlists/simplified-chinese.js.map +0 -1
- package/dist/esm/wordlists/spanish.js +0 -2050
- package/dist/esm/wordlists/spanish.js.map +0 -1
- package/dist/esm/wordlists/traditional-chinese.js +0 -2050
- package/dist/esm/wordlists/traditional-chinese.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/wordlists/czech.d.ts +0 -2
- package/dist/types/wordlists/czech.d.ts.map +0 -1
- package/dist/types/wordlists/english.d.ts +0 -2
- package/dist/types/wordlists/english.d.ts.map +0 -1
- package/dist/types/wordlists/french.d.ts +0 -2
- package/dist/types/wordlists/french.d.ts.map +0 -1
- package/dist/types/wordlists/index.d.ts +0 -12
- package/dist/types/wordlists/index.d.ts.map +0 -1
- package/dist/types/wordlists/italian.d.ts +0 -2
- package/dist/types/wordlists/italian.d.ts.map +0 -1
- package/dist/types/wordlists/japanese.d.ts +0 -2
- package/dist/types/wordlists/japanese.d.ts.map +0 -1
- package/dist/types/wordlists/korean.d.ts +0 -2
- package/dist/types/wordlists/korean.d.ts.map +0 -1
- package/dist/types/wordlists/simplified-chinese.d.ts +0 -2
- package/dist/types/wordlists/simplified-chinese.d.ts.map +0 -1
- package/dist/types/wordlists/spanish.d.ts +0 -2
- package/dist/types/wordlists/spanish.d.ts.map +0 -1
- package/dist/types/wordlists/traditional-chinese.d.ts +0 -2
- package/dist/types/wordlists/traditional-chinese.d.ts.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare const wordlists: {
|
|
2
|
+
czech: string[];
|
|
3
|
+
english: string[];
|
|
4
|
+
french: string[];
|
|
5
|
+
italian: string[];
|
|
6
|
+
japanese: string[];
|
|
7
|
+
korean: string[];
|
|
8
|
+
simplifiedChinese: string[];
|
|
9
|
+
spanish: string[];
|
|
10
|
+
traditionalChinese: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generate x random words. Uses Cryptographically-Secure Random Number Generator.
|
|
15
|
+
* @param wordlist imported wordlist for specific language
|
|
16
|
+
* @param strength mnemonic strength 128-256 bits
|
|
17
|
+
* @example
|
|
18
|
+
* generateMnemonic(wordlist, 128)
|
|
19
|
+
* // 'legal winner thank year wave sausage worth useful legal winner thank yellow'
|
|
20
|
+
*/
|
|
21
|
+
declare function generateMnemonic(wordlist: string[], strength?: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Reversible: Converts mnemonic string to raw entropy in form of byte array.
|
|
24
|
+
* @param mnemonic 12-24 words
|
|
25
|
+
* @param wordlist imported wordlist for specific language
|
|
26
|
+
* @example
|
|
27
|
+
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
|
28
|
+
* mnemonicToEntropy(mnem, wordlist)
|
|
29
|
+
* // Produces
|
|
30
|
+
* new Uint8Array([
|
|
31
|
+
* 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
|
|
32
|
+
* 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f
|
|
33
|
+
* ])
|
|
34
|
+
*/
|
|
35
|
+
declare function mnemonicToEntropy(mnemonic: string, wordlist: string[]): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* Reversible: Converts raw entropy in form of byte array to mnemonic string.
|
|
38
|
+
* @param entropy byte array
|
|
39
|
+
* @param wordlist imported wordlist for specific language
|
|
40
|
+
* @returns 12-24 words
|
|
41
|
+
* @example
|
|
42
|
+
* const ent = new Uint8Array([
|
|
43
|
+
* 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
|
|
44
|
+
* 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f
|
|
45
|
+
* ]);
|
|
46
|
+
* entropyToMnemonic(ent, wordlist);
|
|
47
|
+
* // 'legal winner thank year wave sausage worth useful legal winner thank yellow'
|
|
48
|
+
*/
|
|
49
|
+
declare function entropyToMnemonic(entropy: Uint8Array, wordlist: string[]): string;
|
|
50
|
+
/**
|
|
51
|
+
* Validates mnemonic for being 12-24 words contained in `wordlist`.
|
|
52
|
+
*/
|
|
53
|
+
declare function validateMnemonic(mnemonic: string, wordlist: string[]): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
|
56
|
+
* @param mnemonic 12-24 words
|
|
57
|
+
* @param passphrase string that will additionally protect the key
|
|
58
|
+
* @returns 64 bytes of key data
|
|
59
|
+
* @example
|
|
60
|
+
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
|
61
|
+
* await mnemonicToSeed(mnem, 'password');
|
|
62
|
+
* // new Uint8Array([...64 bytes])
|
|
63
|
+
*/
|
|
64
|
+
declare function mnemonicToSeed(mnemonic: string, passphrase?: string): Promise<Uint8Array>;
|
|
65
|
+
/**
|
|
66
|
+
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
|
67
|
+
* @param mnemonic 12-24 words
|
|
68
|
+
* @param passphrase string that will additionally protect the key
|
|
69
|
+
* @returns 64 bytes of key data
|
|
70
|
+
* @example
|
|
71
|
+
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
|
72
|
+
* mnemonicToSeedSync(mnem, 'password');
|
|
73
|
+
* // new Uint8Array([...64 bytes])
|
|
74
|
+
*/
|
|
75
|
+
declare function mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
|
|
76
|
+
|
|
77
|
+
export { entropyToMnemonic, generateMnemonic, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, validateMnemonic, wordlists };
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
declare const wordlists: {
|
|
2
|
+
czech: string[];
|
|
3
|
+
english: string[];
|
|
4
|
+
french: string[];
|
|
5
|
+
italian: string[];
|
|
6
|
+
japanese: string[];
|
|
7
|
+
korean: string[];
|
|
8
|
+
simplifiedChinese: string[];
|
|
9
|
+
spanish: string[];
|
|
10
|
+
traditionalChinese: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
2
13
|
/**
|
|
3
14
|
* Generate x random words. Uses Cryptographically-Secure Random Number Generator.
|
|
4
15
|
* @param wordlist imported wordlist for specific language
|
|
@@ -7,7 +18,7 @@ export * from './wordlists';
|
|
|
7
18
|
* generateMnemonic(wordlist, 128)
|
|
8
19
|
* // 'legal winner thank year wave sausage worth useful legal winner thank yellow'
|
|
9
20
|
*/
|
|
10
|
-
|
|
21
|
+
declare function generateMnemonic(wordlist: string[], strength?: number): string;
|
|
11
22
|
/**
|
|
12
23
|
* Reversible: Converts mnemonic string to raw entropy in form of byte array.
|
|
13
24
|
* @param mnemonic 12-24 words
|
|
@@ -21,7 +32,7 @@ export declare function generateMnemonic(wordlist: string[], strength?: number):
|
|
|
21
32
|
* 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f
|
|
22
33
|
* ])
|
|
23
34
|
*/
|
|
24
|
-
|
|
35
|
+
declare function mnemonicToEntropy(mnemonic: string, wordlist: string[]): Uint8Array;
|
|
25
36
|
/**
|
|
26
37
|
* Reversible: Converts raw entropy in form of byte array to mnemonic string.
|
|
27
38
|
* @param entropy byte array
|
|
@@ -35,11 +46,11 @@ export declare function mnemonicToEntropy(mnemonic: string, wordlist: string[]):
|
|
|
35
46
|
* entropyToMnemonic(ent, wordlist);
|
|
36
47
|
* // 'legal winner thank year wave sausage worth useful legal winner thank yellow'
|
|
37
48
|
*/
|
|
38
|
-
|
|
49
|
+
declare function entropyToMnemonic(entropy: Uint8Array, wordlist: string[]): string;
|
|
39
50
|
/**
|
|
40
51
|
* Validates mnemonic for being 12-24 words contained in `wordlist`.
|
|
41
52
|
*/
|
|
42
|
-
|
|
53
|
+
declare function validateMnemonic(mnemonic: string, wordlist: string[]): boolean;
|
|
43
54
|
/**
|
|
44
55
|
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
|
45
56
|
* @param mnemonic 12-24 words
|
|
@@ -50,7 +61,7 @@ export declare function validateMnemonic(mnemonic: string, wordlist: string[]):
|
|
|
50
61
|
* await mnemonicToSeed(mnem, 'password');
|
|
51
62
|
* // new Uint8Array([...64 bytes])
|
|
52
63
|
*/
|
|
53
|
-
|
|
64
|
+
declare function mnemonicToSeed(mnemonic: string, passphrase?: string): Promise<Uint8Array>;
|
|
54
65
|
/**
|
|
55
66
|
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
|
56
67
|
* @param mnemonic 12-24 words
|
|
@@ -61,5 +72,6 @@ export declare function mnemonicToSeed(mnemonic: string, passphrase?: string): P
|
|
|
61
72
|
* mnemonicToSeedSync(mnem, 'password');
|
|
62
73
|
* // new Uint8Array([...64 bytes])
|
|
63
74
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
declare function mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
|
|
76
|
+
|
|
77
|
+
export { entropyToMnemonic, generateMnemonic, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, validateMnemonic, wordlists };
|