if (data == null) {
throw new Error('Data to sign not found')
}
- return _ckd(index[0]).then(result => {
- const prv = new Uint8Array(result)
- const pub = nano25519_derive(prv)
- const sk = new Uint8Array([...prv, ...pub])
- prv.fill(0)
- pub.fill(0)
- const sig = nano25519_sign(new Uint8Array(data), sk)
- sk.fill(0)
- _timer = new VaultTimer(_autolock, _timeout)
- return { signature: sig.buffer }
- })
+ return _ckd(index[0])
+ .then(result => {
+ const prv = new Uint8Array(result)
+ const pub = nano25519_derive(prv)
+ const sk = new Uint8Array([...prv, ...pub])
+ prv.fill(0)
+ pub.fill(0)
+ const sig = nano25519_sign(new Uint8Array(data), sk)
+ sk.fill(0)
+ _timer = new VaultTimer(_autolock, _timeout)
+ return { signature: sig.buffer }
+ })
+ .catch(err => {
+ console.error(err)
+ _timer.resume()
+ throw new Error('Failed to sign message', { cause: err })
+ })
} catch (err) {
console.error(err)
_timer.resume()
_timer = new VaultTimer(_autolock, _timeout)
return { iv, salt, encrypted }
})
+ .catch(err => {
+ console.error(err)
+ _timer.resume()
+ throw new Error('Failed to update wallet password', { cause: err })
+ })
} catch (err) {
console.error(err)
_timer.resume()