if (timeout > 600) {
throw new RangeError('Timeout must be at most 10 minutes')
}
- timeout = timeout * 1000
- _timer = new VaultTimer(() => lock(), timeout)
+ _timeout = timeout * 1000
+ _timer = new VaultTimer(() => lock(), _timeout)
}
return Promise.resolve()
} catch (err) {
if (mnemonic != null && !(mnemonic instanceof ArrayBuffer)) {
throw new TypeError('Invalid mnemonic')
}
- type = type
- seed = seed
- mnemonic = mnemonic
+ _type = type
+ _seed = seed
+ _mnemonic = mnemonic
_locked = false
_timer = new VaultTimer(lock, _timeout)
BROWSER: postMessage('unlocked')
if (_locked) {
throw new Error('Wallet is locked')
}
- if (seed == null) {
+ if (_seed == null) {
throw new Error('Wallet seed not found')
}
if (seed == null && mnemonicPhrase == null) {
if (seed != null) {
let diff = 0
const userSeed = new Uint8Array(seed)
- const thisSeed = new Uint8Array(seed)
+ const thisSeed = new Uint8Array(_seed)
for (let i = 0; i < userSeed.byteLength; i++) {
diff |= userSeed[i] ^ thisSeed[i]
}
}
return seed.then(seed => {
_seed = seed
- return WalletAesGcm.encrypt(type, key, _seed, _mnemonic)
+ return WalletAesGcm
+ .encrypt(type, key, _seed, _mnemonic)
.then(({ iv, encrypted }) => ({ iv, salt: keySalt, encrypted }))
})
} catch (err) {