]> git.codecow.com Git - libnemo.git/commitdiff
Fix issue with restoring from new wallet ID format with prefix.
authorChris Duncan <chris@zoso.dev>
Tue, 15 Jul 2025 20:58:36 +0000 (13:58 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 15 Jul 2025 20:58:36 +0000 (13:58 -0700)
src/lib/wallets/bip44-wallet.ts
src/lib/wallets/blake2b-wallet.ts
src/lib/wallets/ledger-wallet.ts
test/test.import-wallet.mjs

index 69a231623987f8c876370018a3e573425c63d623..f6fb518d87fe558da41fc8391a926975999dcd97 100644 (file)
@@ -201,6 +201,7 @@ export class Bip44Wallet extends Wallet {
                        throw new TypeError('Wallet ID is required to restore')\r
                }\r
                Bip44Wallet.#isInternal = true\r
+               id = id.replace('libnemo_', '')\r
                return new this(await Entropy.import(id), '')\r
        }\r
 \r
index 178d47435162b083eef7815987ec85812b1911d2..505e4182a31c6763a62344dba61178177396e2d3 100644 (file)
@@ -150,6 +150,7 @@ export class Blake2bWallet extends Wallet {
                        throw new TypeError('Wallet ID is required to restore')\r
                }\r
                Blake2bWallet.#isInternal = true\r
+               id = id.replace('libnemo_', '')\r
                return new this(await Entropy.import(id))\r
        }\r
 \r
index feb05459c6ec400d0bc09615a05f9b7c71fe4277..ec9cf03b607271272bd1d273ebba74ac9060ec44 100644 (file)
@@ -210,6 +210,7 @@ export class LedgerWallet extends Wallet {
                        throw new TypeError('Wallet ID is required to restore')\r
                }\r
                LedgerWallet.#isInternal = true\r
+               id = id.replace('libnemo_', '')\r
                const wallet = new this(await Entropy.import(id))\r
                await wallet.init()\r
                return wallet\r
index f0be098b269ea36bfd075342964a1545c3ca473d..df2423e227448b8fbaa2dcae8bbca728cf95f235 100644 (file)
@@ -236,6 +236,7 @@ await suite('Retrieve wallets from session storage using a wallet-generated ID',
 \r
        await test('Bip44Wallet', async () => {\r
                const id = (await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)).id\r
+               debugger\r
                const wallet = await Bip44Wallet.restore(id)\r
 \r
                assert.ok('mnemonic' in wallet)\r