*/
export class VaultWorker {
static locked: boolean = true
- static timeout: VaultTimer
+ static timeout: VaultTimer = new VaultTimer(() => { }, 0)
static type?: 'BIP-44' | 'BLAKE2b'
static seed?: ArrayBuffer
static mnemonic?: ArrayBuffer
try {
const entropy = crypto.getRandomValues(new Uint8Array(32))
return Bip39.fromEntropy(entropy)
- .then(bip39 => {
- return this._load(type, key, keySalt, bip39.phrase, mnemonicSalt)
- .then(record => {
- if (this.seed == null || this.mnemonic == null) {
- throw new Error('Failed to generate seed and mnemonic')
- }
- return { ...record, seed: this.seed.slice(), mnemonic: this.mnemonic.slice() }
- })
+ .then(bip39 => this._load(type, key, keySalt, bip39.phrase, mnemonicSalt))
+ .then(record => {
+ if (this.seed == null || this.mnemonic == null) {
+ throw new Error('Failed to generate seed and mnemonic')
+ }
+ return { ...record, seed: this.seed.slice(), mnemonic: this.mnemonic.slice() }
})
} catch (err) {
console.error(err)