* Creates a new HD wallet by using an entropy value generated using a\r
* cryptographically strong pseudorandom number generator.\r
*\r
- * @param {CryptoKey} key - Encrypts the wallet to lock and unlock it\r
+ * @param {Uint8Array} key - Encrypts the wallet to lock and unlock it\r
* @param {string} [salt=''] - Used when generating the final seed\r
* @returns {Bip44Wallet} A newly instantiated Bip44Wallet\r
*/\r
- static async create (key: CryptoKey, salt?: string): Promise<Bip44Wallet>\r
- static async create (passkey: string | CryptoKey, salt: string = ''): Promise<Bip44Wallet> {\r
+ static async create (key: Uint8Array, salt?: string): Promise<Bip44Wallet>\r
+ static async create (passkey: string | Uint8Array, salt: string = ''): Promise<Bip44Wallet> {\r
try {\r
const e = await Entropy.create()\r
return await Bip44Wallet.fromEntropy(passkey as string, e.hex, salt)\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 {CryptoKey} key - Used to lock and unlock the wallet\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: CryptoKey, entropy: string, salt?: string): Promise<Bip44Wallet>\r
- static async fromEntropy (passkey: string | CryptoKey, entropy: string, salt: string = ''): Promise<Bip44Wallet> {\r
+ static async fromEntropy (key: Uint8Array, entropy: string, salt?: string): Promise<Bip44Wallet>\r
+ static async fromEntropy (passkey: string | Uint8Array, entropy: string, salt: string = ''): Promise<Bip44Wallet> {\r
try {\r
const id = await Entropy.create(16)\r
const e = await Entropy.import(entropy)\r
const s = await m.toBip39Seed(salt)\r
Bip44Wallet.#isInternal = true\r
const wallet = new this(id, s, m)\r
- await wallet.lock(passkey as string)\r
+ await wallet.lock(passkey)\r
return wallet\r
} catch (err) {\r
throw new Error(`Error importing Bip44Wallet from entropy: ${err}`)\r
/**\r
* Creates a new HD wallet by using a pregenerated mnemonic phrase.\r
*\r
- * @param {CryptoKey} key - Used to lock and unlock the wallet\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: CryptoKey, mnemonic: string, salt?: string): Promise<Bip44Wallet>\r
- static async fromMnemonic (passkey: string | CryptoKey, mnemonic: string, salt: string = ''): Promise<Bip44Wallet> {\r
+ static async fromMnemonic (key: Uint8Array, mnemonic: string, salt?: string): Promise<Bip44Wallet>\r
+ static async fromMnemonic (passkey: string | Uint8Array, mnemonic: string, salt: string = ''): Promise<Bip44Wallet> {\r
try {\r
const id = await Entropy.create(16)\r
const m = await Bip39Mnemonic.fromPhrase(mnemonic)\r
const s = await m.toBip39Seed(salt)\r
Bip44Wallet.#isInternal = true\r
const wallet = new this(id, s, m)\r
- await wallet.lock(passkey as string)\r
+ await wallet.lock(passkey)\r
return wallet\r
} catch (err) {\r
throw new Error(`Error importing Bip44Wallet from mnemonic: ${err}`)\r
* be used to regenerate any higher level randomness which includes entropy,\r
* mnemonic phrase, and salt.\r
*\r
- * @param {CryptoKey} key - Used to lock and unlock the wallet\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: CryptoKey, seed: string): Promise<Bip44Wallet>\r
- static async fromSeed (passkey: string | CryptoKey, seed: string): Promise<Bip44Wallet> {\r
+ static async fromSeed (key: Uint8Array, seed: string): Promise<Bip44Wallet>\r
+ static async fromSeed (passkey: string | Uint8Array, 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
const id = await Entropy.create(16)\r
Bip44Wallet.#isInternal = true\r
const wallet = new this(id, seed)\r
- await wallet.lock(passkey as string)\r
+ await wallet.lock(passkey)\r
return wallet\r
}\r
\r
* Creates a new BLAKE2b wallet by using a seed generated using a\r
* cryptographically strong pseudorandom number generator.\r
*\r
- * @param {CryptoKey} key - Encrypts the wallet to lock and unlock it\r
+ * @param {Uint8Array} key - Encrypts the wallet to lock and unlock it\r
* @returns {Blake2bWallet} A newly instantiated Blake2bWallet\r
*/\r
- static async create (key: CryptoKey): Promise<Blake2bWallet>\r
- static async create (passkey: string | CryptoKey): Promise<Blake2bWallet> {\r
+ static async create (key: Uint8Array): Promise<Blake2bWallet>\r
+ static async create (passkey: string | Uint8Array): Promise<Blake2bWallet> {\r
try {\r
const seed = await Entropy.create()\r
return await Blake2bWallet.fromSeed(passkey as string, seed.hex)\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 {CryptoKey} key - Used to lock and unlock the wallet\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: CryptoKey, seed: string): Promise<Blake2bWallet>\r
- static async fromSeed (passkey: string | CryptoKey, seed: string): Promise<Blake2bWallet> {\r
+ static async fromSeed (key: Uint8Array, seed: string): Promise<Blake2bWallet>\r
+ static async fromSeed (passkey: string | Uint8Array, 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
const m = await Bip39Mnemonic.fromEntropy(seed)\r
Blake2bWallet.#isInternal = true\r
const wallet = new this(id, s, m)\r
- await wallet.lock(passkey as string)\r
+ await wallet.lock(passkey)\r
return wallet\r
}\r
\r
/**\r
* Creates a new BLAKE2b wallet by using a pregenerated mnemonic phrase.\r
*\r
- * @param {CryptoKey} key - Used to lock and unlock the wallet\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: CryptoKey, mnemonic: string): Promise<Blake2bWallet>\r
- static async fromMnemonic (passkey: string | CryptoKey, mnemonic: string): Promise<Blake2bWallet> {\r
+ static async fromMnemonic (key: Uint8Array, mnemonic: string): Promise<Blake2bWallet>\r
+ static async fromMnemonic (passkey: string | Uint8Array, mnemonic: string): Promise<Blake2bWallet> {\r
try {\r
const id = await Entropy.create(16)\r
const m = await Bip39Mnemonic.fromPhrase(mnemonic)\r
const s = await m.toBlake2bSeed()\r
Blake2bWallet.#isInternal = true\r
const wallet = new this(id, s, m)\r
- await wallet.lock(passkey as string)\r
+ await wallet.lock(passkey)\r
return wallet\r
} catch (err) {\r
throw new Error(`Error importing Blake2bWallet from mnemonic: ${err}`)\r