From: Chris Duncan Date: Sat, 8 Aug 2026 09:19:03 +0000 (-0700) Subject: Resume vault autolock timer when catching async errors. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=11a9350f379d48035bfa833a1bc8a09bd0b85ab8;p=libnemo.git Resume vault autolock timer when catching async errors. --- diff --git a/src/lib/vault/vault-worker.ts b/src/lib/vault/vault-worker.ts index 8f166a2..53162f1 100644 --- a/src/lib/vault/vault-worker.ts +++ b/src/lib/vault/vault-worker.ts @@ -267,17 +267,23 @@ function sign (index?: Uint32Array, data?: ArrayBuffer): Promise { - 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() @@ -357,6 +363,11 @@ function update (key?: CryptoKey, salt?: ArrayBuffer): Promise { + console.error(err) + _timer.resume() + throw new Error('Failed to update wallet password', { cause: err }) + }) } catch (err) { console.error(err) _timer.resume()