seed-words 1.0.0 → 1.0.2
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/BUILD.md +7 -0
- package/README.md +5 -1
- package/dist/seedwords.d.ts +39 -0
- package/package.json +4 -3
- package/seedwords.js +2 -0
- package/tsconfig.json +21 -0
package/BUILD.md
ADDED
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<a name="module_seed-words"></a>
|
|
2
2
|
|
|
3
3
|
## seed-words
|
|
4
|
-
Seed Words is a list of English words to be used in mnemonic seed phrases. There are a total of 256 x 256 = 65536 words. They can be used to represent any arbitrary 2 byte array with a single
|
|
5
4
|
if (initResult === false) {
|
|
6
5
|
console.log("error initializing");
|
|
7
6
|
} else {
|
|
8
7
|
console.log("initialized");
|
|
9
8
|
}
|
|
9
|
+
Seed Words is a list of English words to be used in mnemonic seed phrases. There are a total of 256 x 256 = 65536 words. They can be used to represent any arbitrary 2 byte array with a single
|
|
10
10
|
|
|
11
|
+
**Example**
|
|
12
|
+
```js
|
|
13
|
+
Requires Node.js version v20.18.1 or higher
|
|
11
14
|
if (initResult === false) {
|
|
12
15
|
console.log("error initializing");
|
|
13
16
|
} else {
|
|
14
17
|
console.log("initialized");
|
|
15
18
|
}
|
|
19
|
+
```
|
|
16
20
|
|
|
17
21
|
* [seed-words](#module_seed-words)
|
|
18
22
|
* [~initialize()](#module_seed-words..initialize) ⇒ <code>Promise.<boolean></code>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The initialize function has to be called before attempting to invoke any other function. This function should be called only once.
|
|
3
|
+
*
|
|
4
|
+
* @async
|
|
5
|
+
* @function initialize
|
|
6
|
+
* @return {Promise<boolean>} Returns a promise of type boolean; true if the initialization succeeded, else false.
|
|
7
|
+
*/
|
|
8
|
+
export function initialize(): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* The getWordListFromSeedArray function returns the word list corresponding to a byte array.
|
|
11
|
+
*
|
|
12
|
+
* @function getWordListFromSeedArray
|
|
13
|
+
* @param {array} seedArray - An array of bytes. This array should have an even number of elements.
|
|
14
|
+
* @return {array} Returns the array of words (string) corresponding to the input seed array. Returns null on failure. This function can fail if the seedArray is invalid or initialize() hasn't been called.
|
|
15
|
+
*/
|
|
16
|
+
export function getWordListFromSeedArray(seedArray: any[]): any[];
|
|
17
|
+
/**
|
|
18
|
+
* The doesSeedWordExist function returns the word list corresponding to a byte array.
|
|
19
|
+
*
|
|
20
|
+
* @function doesSeedWordExist
|
|
21
|
+
* @param {string} word - A seed word to find whether it exists in the list or not.
|
|
22
|
+
* @return {boolean} Returns true if the seed word exists. Returns false if it doesn't exist. Returns null on failure. This function can fail if initialize() function was not called.
|
|
23
|
+
*/
|
|
24
|
+
export function doesSeedWordExist(word: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The getAllSeedWords function returns all the seed words in an array.
|
|
27
|
+
*
|
|
28
|
+
* @function getAllSeedWords
|
|
29
|
+
* @return {array} Returns an array with the list of all seed words.
|
|
30
|
+
*/
|
|
31
|
+
export function getAllSeedWords(): any[];
|
|
32
|
+
/**
|
|
33
|
+
* The getSeedArrayFromWordList function a byte array that corresponds to the seed word list.
|
|
34
|
+
*
|
|
35
|
+
* @function getSeedArrayFromWordList
|
|
36
|
+
* @param {array} wordList - An array of seed words.
|
|
37
|
+
* @return {array} Returns an array of bytes that correspond to the wordList. Returns null on failure. This function can fail if initialize() function was not called or the word doesn't exist.
|
|
38
|
+
*/
|
|
39
|
+
export function getSeedArrayFromWordList(wordList: any[]): any[];
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seed-words",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Seed Words JS SDK",
|
|
5
5
|
"main": "seedwords.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "npx -p typescript tsc seedwords.js --declaration --allowJs --emitDeclarationOnly --outDir dist && jsdoc2md seedwords.js >README.md"
|
|
8
9
|
},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"seeds",
|
|
18
19
|
"quantumcoin"
|
|
19
20
|
],
|
|
20
|
-
"author": "
|
|
21
|
+
"author": "QuantumCoin Community",
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"bugs": {
|
|
23
24
|
"url": "https://github.com/quantumcoinproject/seed-words/issues"
|