]> git.codecow.com Git - libnemo.git/commitdiff
Lock accounts using wallet seed as password when locking wallet.
authorChris Duncan <chris@zoso.dev>
Wed, 16 Jul 2025 14:23:53 +0000 (07:23 -0700)
committerChris Duncan <chris@zoso.dev>
Wed, 16 Jul 2025 14:23:53 +0000 (07:23 -0700)
src/lib/wallets/wallet.ts

index bac12f730c1acdf74048967a5fd0dad861bbd871..a7530d72999a81f721005bc4e4d99ab1a76f0d9b 100644 (file)
@@ -152,6 +152,11 @@ export abstract class Wallet {
                        throw new Error('Failed to lock wallet')\r
                }\r
                try {\r
+                       const promises = []\r
+                       for (const account of this.#accounts) {\r
+                               promises.push(account.lock(this.seed))\r
+                       }\r
+                       await Promise.all(promises)\r
                        const headers = {\r
                                method: 'set',\r
                                name: this.id\r
@@ -168,11 +173,6 @@ export abstract class Wallet {
                        if (!success) {\r
                                throw null\r
                        }\r
-                       const promises = []\r
-                       for (const account of this.#accounts) {\r
-                               promises.push(account.lock(new Uint8Array(password)))\r
-                       }\r
-                       await Promise.all(promises)\r
                } catch (err) {\r
                        throw new Error('Failed to lock wallet')\r
                } finally {\r
@@ -250,7 +250,7 @@ export abstract class Wallet {
                        }\r
                        const promises = []\r
                        for (const account of this.#accounts) {\r
-                               promises.push(account.unlock(new Uint8Array(password)))\r
+                               promises.push(account.unlock(this.seed))\r
                        }\r
                        await Promise.all(promises)\r
                } catch (err) {\r