]> git.codecow.com Git - libnemo.git/commitdiff
Start adding initial pieces for Exodus support.
authorChris Duncan <chris@zoso.dev>
Sun, 23 Nov 2025 10:37:26 +0000 (02:37 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 23 Nov 2025 10:37:26 +0000 (02:37 -0800)
src/lib/vault/vault-worker.ts
src/lib/wallet/index.ts
src/lib/wallet/load.ts

index faa1ae9cbb2bab325c8a4eb2757a47c403c77f77..02776b113b1e59f7dc394a8eed203bdbc65abae4 100644 (file)
@@ -15,7 +15,7 @@ export class VaultWorker {
        #locked: boolean
        #timeout: number
        #timer: VaultTimer
-       #type?: 'BIP-44' | 'BLAKE2b'
+       #type?: 'BIP-44' | 'BLAKE2b' | 'Exodus'
        #seed?: ArrayBuffer
        #mnemonic?: ArrayBuffer
        #parentPort?: any
@@ -181,7 +181,7 @@ export class VaultWorker {
                        if (this.#seed == null) {
                                throw new Error('Wallet seed not found')
                        }
-                       if (this.#type !== 'BIP-44' && this.#type !== 'BLAKE2b') {
+                       if (this.#type !== 'BIP-44' && this.#type !== 'BLAKE2b' && this.#type !== 'Exodus') {
                                throw new Error('Invalid wallet type')
                        }
                        if (typeof index !== 'number') {
@@ -614,7 +614,7 @@ export class VaultWorker {
        // Algorithm used for wallet functions
        #parseType (action: string, data: { [key: string]: unknown }) {
                if (['create', 'load', 'unlock'].includes(action)) {
-                       if (data.type !== 'BIP-44' && data.type !== 'BLAKE2b' && data.type !== 'Ledger') {
+                       if (data.type !== 'BIP-44' && data.type !== 'BLAKE2b' && data.type !== 'Exodus' && data.type !== 'Ledger') {
                                throw new TypeError(`Type is required to ${action} wallet`)
                        }
                } else if (data.type !== undefined) {
index d9a0cbfe4f0bc6d4b5b76c003a24b9b46cca4af5..fce75baf2d0e109848ec33ca11d889e3a3268027 100644 (file)
@@ -23,7 +23,7 @@ import { _unopened } from './unopened'
 import { _update } from './update'\r
 import { _verify } from './verify'\r
 \r
-export type WalletType = 'BIP-44' | 'BLAKE2b' | 'Ledger'\r
+export type WalletType = 'BIP-44' | 'BLAKE2b' | 'Exodus' | 'Ledger'\r
 \r
 /**\r
 * Represents a wallet containing numerous Nano accounts derived from a single\r
@@ -88,7 +88,7 @@ export class Wallet {
        * @param {string} seed - Used to derive child accounts\r
        * @returns Wallet in a locked state\r
        */\r
-       static async load (type: 'BIP-44' | 'BLAKE2b', password: string, seed: string): Promise<Wallet>\r
+       static async load (type: 'BIP-44' | 'BLAKE2b' | 'Exodus', password: string, seed: string): Promise<Wallet>\r
        /**\r
        * Imports an existing HD wallet by using an entropy value generated using a\r
        * cryptographically strong pseudorandom number generator.\r
@@ -99,7 +99,7 @@ export class Wallet {
        * @param {string} [mnemonicSalt] - Used to alter the seed derived from the mnemonic phrase\r
        * @returns Wallet in a locked state\r
        */\r
-       static async load (type: 'BIP-44' | 'BLAKE2b', password: string, mnemonicPhrase: string, mnemonicSalt?: string): Promise<Wallet>\r
+       static async load (type: 'BIP-44' | 'BLAKE2b' | 'Exodus', password: string, mnemonicPhrase: string, mnemonicSalt?: string): Promise<Wallet>\r
        static async load (type: WalletType, password: string, secret: string, mnemonicSalt?: string): Promise<Wallet> {\r
                this.#isInternal = true\r
                const self = new this(type)\r
@@ -149,7 +149,7 @@ export class Wallet {
                if (!(this.constructor as typeof Wallet).isInternal) {\r
                        throw new Error(`Wallet cannot be instantiated directly. Use 'await Wallet.create()' instead.`)\r
                }\r
-               if (type !== 'BIP-44' && type !== 'BLAKE2b' && type !== 'Ledger') {\r
+               if (type !== 'BIP-44' && type !== 'BLAKE2b' && type !== 'Exodus' && type !== 'Ledger') {\r
                        throw new TypeError('Invalid wallet type', { cause: type })\r
                }\r
                this.#id = id ?? this.#id\r
index fc73b83f636343ea0f987ce4cac0c855b2e3097f..3c929770d3946cae2c2b7be10cdb4114a49616ce 100644 (file)
@@ -23,7 +23,7 @@ export async function _load (wallet: Wallet, vault: Vault, password: unknown, se
                                throw new Error('Failed to initialize Ledger wallet', { cause: 'Browser is unsupported' })
                        }
                } else {
-                       if (wallet.type !== 'BIP-44' && wallet.type !== 'BLAKE2b') {
+                       if (wallet.type !== 'BIP-44' && wallet.type !== 'BLAKE2b' && wallet.type !== 'Exodus') {
                                throw new TypeError('Invalid wallet type', { cause: wallet.type })
                        }
                        if (typeof password !== 'string') {