@xyo-network/bip39 2.72.9 → 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.
Files changed (74) hide show
  1. package/dist/index.d.mts +77 -0
  2. package/dist/{types/index.d.ts → index.d.ts} +20 -8
  3. package/dist/index.js +18585 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +18544 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +28 -15
  8. package/tsup.config.ts +16 -0
  9. package/dist/cjs/index.js +0 -147
  10. package/dist/cjs/index.js.map +0 -1
  11. package/dist/cjs/wordlists/czech.js +0 -2053
  12. package/dist/cjs/wordlists/czech.js.map +0 -1
  13. package/dist/cjs/wordlists/english.js +0 -2053
  14. package/dist/cjs/wordlists/english.js.map +0 -1
  15. package/dist/cjs/wordlists/french.js +0 -2053
  16. package/dist/cjs/wordlists/french.js.map +0 -1
  17. package/dist/cjs/wordlists/index.js +0 -24
  18. package/dist/cjs/wordlists/index.js.map +0 -1
  19. package/dist/cjs/wordlists/italian.js +0 -2053
  20. package/dist/cjs/wordlists/italian.js.map +0 -1
  21. package/dist/cjs/wordlists/japanese.js +0 -2053
  22. package/dist/cjs/wordlists/japanese.js.map +0 -1
  23. package/dist/cjs/wordlists/korean.js +0 -2053
  24. package/dist/cjs/wordlists/korean.js.map +0 -1
  25. package/dist/cjs/wordlists/simplified-chinese.js +0 -2053
  26. package/dist/cjs/wordlists/simplified-chinese.js.map +0 -1
  27. package/dist/cjs/wordlists/spanish.js +0 -2053
  28. package/dist/cjs/wordlists/spanish.js.map +0 -1
  29. package/dist/cjs/wordlists/traditional-chinese.js +0 -2053
  30. package/dist/cjs/wordlists/traditional-chinese.js.map +0 -1
  31. package/dist/docs.json +0 -1057
  32. package/dist/esm/index.js +0 -137
  33. package/dist/esm/index.js.map +0 -1
  34. package/dist/esm/wordlists/czech.js +0 -2050
  35. package/dist/esm/wordlists/czech.js.map +0 -1
  36. package/dist/esm/wordlists/english.js +0 -2050
  37. package/dist/esm/wordlists/english.js.map +0 -1
  38. package/dist/esm/wordlists/french.js +0 -2050
  39. package/dist/esm/wordlists/french.js.map +0 -1
  40. package/dist/esm/wordlists/index.js +0 -21
  41. package/dist/esm/wordlists/index.js.map +0 -1
  42. package/dist/esm/wordlists/italian.js +0 -2050
  43. package/dist/esm/wordlists/italian.js.map +0 -1
  44. package/dist/esm/wordlists/japanese.js +0 -2050
  45. package/dist/esm/wordlists/japanese.js.map +0 -1
  46. package/dist/esm/wordlists/korean.js +0 -2050
  47. package/dist/esm/wordlists/korean.js.map +0 -1
  48. package/dist/esm/wordlists/simplified-chinese.js +0 -2050
  49. package/dist/esm/wordlists/simplified-chinese.js.map +0 -1
  50. package/dist/esm/wordlists/spanish.js +0 -2050
  51. package/dist/esm/wordlists/spanish.js.map +0 -1
  52. package/dist/esm/wordlists/traditional-chinese.js +0 -2050
  53. package/dist/esm/wordlists/traditional-chinese.js.map +0 -1
  54. package/dist/types/index.d.ts.map +0 -1
  55. package/dist/types/wordlists/czech.d.ts +0 -2
  56. package/dist/types/wordlists/czech.d.ts.map +0 -1
  57. package/dist/types/wordlists/english.d.ts +0 -2
  58. package/dist/types/wordlists/english.d.ts.map +0 -1
  59. package/dist/types/wordlists/french.d.ts +0 -2
  60. package/dist/types/wordlists/french.d.ts.map +0 -1
  61. package/dist/types/wordlists/index.d.ts +0 -12
  62. package/dist/types/wordlists/index.d.ts.map +0 -1
  63. package/dist/types/wordlists/italian.d.ts +0 -2
  64. package/dist/types/wordlists/italian.d.ts.map +0 -1
  65. package/dist/types/wordlists/japanese.d.ts +0 -2
  66. package/dist/types/wordlists/japanese.d.ts.map +0 -1
  67. package/dist/types/wordlists/korean.d.ts +0 -2
  68. package/dist/types/wordlists/korean.d.ts.map +0 -1
  69. package/dist/types/wordlists/simplified-chinese.d.ts +0 -2
  70. package/dist/types/wordlists/simplified-chinese.d.ts.map +0 -1
  71. package/dist/types/wordlists/spanish.d.ts +0 -2
  72. package/dist/types/wordlists/spanish.d.ts.map +0 -1
  73. package/dist/types/wordlists/traditional-chinese.d.ts +0 -2
  74. package/dist/types/wordlists/traditional-chinese.d.ts.map +0 -1
@@ -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
- export * from './wordlists';
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
- export declare function generateMnemonic(wordlist: string[], strength?: number): string;
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
- export declare function mnemonicToEntropy(mnemonic: string, wordlist: string[]): Uint8Array;
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
- export declare function entropyToMnemonic(entropy: Uint8Array, wordlist: string[]): string;
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
- export declare function validateMnemonic(mnemonic: string, wordlist: string[]): boolean;
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
- export declare function mnemonicToSeed(mnemonic: string, passphrase?: string): Promise<Uint8Array>;
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
- export declare function mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
65
- //# sourceMappingURL=index.d.ts.map
75
+ declare function mnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
76
+
77
+ export { entropyToMnemonic, generateMnemonic, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, validateMnemonic, wordlists };