]> git.codecow.com Git - libnemo.git/commitdiff
Fully await lock request, and be paranoid about failure.
authorChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 00:48:05 +0000 (17:48 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 00:48:05 +0000 (17:48 -0700)
src/lib/wallet/index.ts

index 181174f3268244b9780e504f71b17086151c02f4..9579d4afa4dfc858829c40e33955d5e6667920f0 100644 (file)
@@ -316,8 +316,13 @@ export class Wallet {
        * this is currently the only way to ensure the connection is severed.\r
        * `setTimeout` is used to expire any lingering transient user activation.\r
        */\r
-       lock (): void {\r
-               _lock(this, this.#vault)\r
+       async lock (): Promise<void> {\r
+               try {\r
+                       await _lock(this, this.#vault)\r
+               } catch {\r
+                       console.log('Error locking wallet, terminating Vault worker for safety')\r
+                       this.#vault.terminate()\r
+               }\r
        }\r
 \r
        /**\r