* @param {string} [salt=''] - Used when generating the final seed\r
* @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
*/\r
- static async fromEntropy (password: string, entropy: string, salt?: string): Promise<Bip44Wallet>\r
- /**\r
- * Creates a new HD wallet by using a pregenerated entropy value. The user\r
- * must ensure that it is cryptographically strongly random.\r
- *\r
- * @param {Uint8Array} key - Used to lock and unlock the wallet\r
- * @param {string} entropy - Used when generating the initial mnemonic phrase\r
- * @param {string} [salt=''] - Used when generating the final seed\r
- * @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
- */\r
- static async fromEntropy (key: Uint8Array<ArrayBuffer>, entropy: string, salt?: string): Promise<Bip44Wallet>\r
- static async fromEntropy (passkey: Key, entropy: string, salt: string = ''): Promise<Bip44Wallet> {\r
- if (typeof passkey === 'string') passkey = utf8.toBytes(passkey)\r
+ static async fromEntropy (password: string, entropy: string, salt: string = ''): Promise<Bip44Wallet> {\r
let wallet: Bip44Wallet\r
try {\r
const id = await Entropy.create()\r
throw new Error('Error importing Bip44Wallet from entropy', { cause: err })\r
}\r
try {\r
- await wallet.lock(passkey)\r
+ await wallet.lock(password)\r
} catch (err) {\r
await wallet.destroy()\r
throw new Error('Error locking Bip44Wallet while importing from entropy', { cause: err })\r
* @param {string} [salt=''] - Used when generating the final seed\r
* @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
*/\r
- static async fromMnemonic (password: string, mnemonic: string, salt?: string): Promise<Bip44Wallet>\r
- /**\r
- * Creates a new HD wallet by using a pregenerated mnemonic phrase.\r
- *\r
- * @param {Uint8Array} key - Used to lock and unlock the wallet\r
- * @param {string} mnemonic - Used when generating the final seed\r
- * @param {string} [salt=''] - Used when generating the final seed\r
- * @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
- */\r
- static async fromMnemonic (key: Uint8Array<ArrayBuffer>, mnemonic: string, salt?: string): Promise<Bip44Wallet>\r
- static async fromMnemonic (passkey: Key, mnemonic: string, salt: string = ''): Promise<Bip44Wallet> {\r
- if (typeof passkey === 'string') passkey = utf8.toBytes(passkey)\r
+ static async fromMnemonic (password: string, mnemonic: string, salt: string = ''): Promise<Bip44Wallet> {\r
let wallet: Bip44Wallet\r
try {\r
const id = await Entropy.create()\r
throw new Error('Error importing Bip44Wallet from mnemonic', { cause: err })\r
}\r
try {\r
- await wallet.lock(passkey)\r
+ await wallet.lock(password)\r
} catch (err) {\r
await wallet.destroy()\r
throw new Error('Error locking Bip44Wallet while importing from mnemonic', { cause: err })\r
* @param {string} seed - Hexadecimal 128-character string used to derive private-public key pairs\r
* @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
*/\r
- static async fromSeed (password: string, seed: string): Promise<Bip44Wallet>\r
- /**\r
- * Creates a new HD wallet by using a pregenerated seed value. This seed cannot\r
- * be used to regenerate any higher level randomness which includes entropy,\r
- * mnemonic phrase, and salt.\r
- *\r
- * @param {Uint8Array} key - Used to lock and unlock the wallet\r
- * @param {string} seed - Hexadecimal 128-character string used to derive private-public key pairs\r
- * @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
- */\r
- static async fromSeed (key: Uint8Array<ArrayBuffer>, seed: string): Promise<Bip44Wallet>\r
- static async fromSeed (passkey: Key, seed: string): Promise<Bip44Wallet> {\r
- if (typeof passkey === 'string') passkey = utf8.toBytes(passkey)\r
+ static async fromSeed (password: string, seed: string): Promise<Bip44Wallet> {\r
if (seed.length !== SEED_LENGTH_BIP44) {\r
throw new Error(`Expected a ${SEED_LENGTH_BIP44}-character seed, but received ${seed.length}-character string.`)\r
}\r
Bip44Wallet.#isInternal = true\r
const wallet = new this(id, hex.toBytes(seed))\r
try {\r
- await wallet.lock(passkey)\r
+ await wallet.lock(password)\r
} catch (err) {\r
await wallet.destroy()\r
throw new Error('Error locking Bip44Wallet while importing from seed', { cause: err })\r
* @param {string} seed - Hexadecimal 64-character string used to derive private-public key pairs\r
* @returns {Blake2bWallet} A newly instantiated Blake2bWallet\r
*/\r
- static async fromSeed (password: string, seed: string): Promise<Blake2bWallet>\r
- /**\r
- * Creates a new BLAKE2b wallet by using a pregenerated seed. The user must\r
- * ensure that it is cryptographically strongly random.\r
- *\r
- * @param {Uint8Array} key - Used to lock and unlock the wallet\r
- * @param {string} seed - Hexadecimal 64-character string used to derive private-public key pairs\r
- * @returns {Blake2bWallet} A newly instantiated Blake2bWallet\r
- */\r
- static async fromSeed (key: Uint8Array<ArrayBuffer>, seed: string): Promise<Blake2bWallet>\r
- static async fromSeed (passkey: Key, seed: string): Promise<Blake2bWallet> {\r
- if (typeof passkey === 'string') passkey = utf8.toBytes(passkey)\r
+ static async fromSeed (password: string, seed: string): Promise<Blake2bWallet> {\r
if (seed.length !== SEED_LENGTH_BLAKE2B) {\r
throw new Error(`Expected a ${SEED_LENGTH_BLAKE2B}-character seed, but received ${seed.length}-character string.`)\r
}\r
Blake2bWallet.#isInternal = true\r
const wallet = new this(id, s, m)\r
try {\r
- await wallet.lock(passkey)\r
+ await wallet.lock(password)\r
} catch (err) {\r
await wallet.destroy()\r
throw new Error('Error locking Blake2bWallet while importing from seed', { cause: err })\r
* @param {string} mnemonic - Used when generating the final seed\r
* @returns {Blake2bWallet} A newly instantiated Blake2bWallet\r
*/\r
- static async fromMnemonic (password: string, mnemonic: string): Promise<Blake2bWallet>\r
- /**\r
- * Creates a new BLAKE2b wallet by using a pregenerated mnemonic phrase.\r
- *\r
- * @param {Uint8Array} key - Used to lock and unlock the wallet\r
- * @param {string} mnemonic - Used when generating the final seed\r
- * @returns {Blake2bWallet} A newly instantiated Blake2bWallet\r
- */\r
- static async fromMnemonic (key: Uint8Array<ArrayBuffer>, mnemonic: string): Promise<Blake2bWallet>\r
- static async fromMnemonic (passkey: Key, mnemonic: string): Promise<Blake2bWallet> {\r
- if (typeof passkey === 'string') passkey = utf8.toBytes(passkey)\r
+ static async fromMnemonic (password: string, mnemonic: string): Promise<Blake2bWallet> {\r
let wallet: Blake2bWallet\r
try {\r
const id = await Entropy.create()\r
throw new Error('Error importing Blake2bWallet from mnemonic', { cause: err })\r
}\r
try {\r
- await wallet.lock(passkey)\r
+ await wallet.lock(password)\r
} catch (err) {\r
await wallet.destroy()\r
throw new Error('Error locking Blake2bWallet while importing from mnemonic', { cause: err })\r