]> git.codecow.com Git - libnemo.git/commitdiff
`libnemo_` wallet prefix is unnecessary now that they have their own IndexedDB store.
authorChris Duncan <chris@zoso.dev>
Fri, 25 Jul 2025 12:14:40 +0000 (05:14 -0700)
committerChris Duncan <chris@zoso.dev>
Fri, 25 Jul 2025 12:14:40 +0000 (05:14 -0700)
src/lib/wallets/bip44-wallet.ts
src/lib/wallets/blake2b-wallet.ts
src/lib/wallets/wallet.ts
test/test.create-wallet.mjs

index 02cf6a40d88671a39aa0cf89968fb2c88726117e..4141334b64a4dbae2f440076093a2b02b4f9b0aa 100644 (file)
@@ -201,7 +201,6 @@ 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 779dd562f00af73608a3ca5fdf85882c687c3ef7..3bfbe36a24ca9802da3dbe2b3bb1e38a66d03f81 100644 (file)
@@ -150,7 +150,6 @@ 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 6ce59086105eeca0e1a1fee6135903d89b1cb939..05bb02854cb93ada52dcf2bcc2d7fef81617d568 100644 (file)
@@ -27,7 +27,7 @@ export abstract class Wallet {
        #m?: Bip39Mnemonic\r
        #s?: Uint8Array<ArrayBuffer>\r
 \r
-       get id () { return `libnemo_${this.#id.hex}` }\r
+       get id () { return this.#id.hex }\r
        get isLocked () { return this.#locked }\r
        get isUnlocked () { return !this.#locked }\r
        get mnemonic () {\r
@@ -299,7 +299,7 @@ export abstract class Wallet {
                        if (id == null) {\r
                                throw new Error('ID is null')\r
                        }\r
-                       id = await Entropy.import(id.replace('libnemo_', ''))\r
+                       id = await Entropy.import(id)\r
                        if (id.hex !== this.#id.hex) {\r
                                throw new Error('ID does not match')\r
                        }\r
index 35ed16e8c750aa19c8ca2a8893fd320c46f9dc29..a138df236f868f1d2a4a9583158836fb8d444bd1 100644 (file)
@@ -40,7 +40,7 @@ await Promise.all([
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
                        assert.ok('id' in wallet)\r
-                       assert.ok(/^libnemo_[A-Fa-f0-9]{32,64}$/.test(wallet.id))\r
+                       assert.ok(/^[A-Fa-f0-9]{32,64}$/.test(wallet.id))\r
                        assert.ok('mnemonic' in wallet)\r
                        assert.ok(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic))\r
                        assert.ok('seed' in wallet)\r
@@ -54,7 +54,7 @@ await Promise.all([
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
                        assert.ok('id' in wallet)\r
-                       assert.ok(/^libnemo_[A-Fa-f0-9]{32,64}$/.test(wallet.id))\r
+                       assert.ok(/^[A-Fa-f0-9]{32,64}$/.test(wallet.id))\r
                        assert.ok('mnemonic' in wallet)\r
                        assert.ok(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic))\r
                        assert.ok('seed' in wallet)\r