]> git.codecow.com Git - libnemo.git/commitdiff
Adjust naming for safe methods again.
authorChris Duncan <chris@zoso.dev>
Mon, 21 Jul 2025 05:16:56 +0000 (22:16 -0700)
committerChris Duncan <chris@zoso.dev>
Mon, 21 Jul 2025 05:16:56 +0000 (22:16 -0700)
src/lib/account.ts
src/lib/wallets/wallet.ts
src/lib/workers/safe.ts

index 811790ff69e3ab4e7bc48190f494ec24279dec68..28cae5642f3ebd40ea104ed7068e61c73b5dd9a7 100644 (file)
@@ -328,7 +328,7 @@ export class Account {
                }\r
                try {\r
                        const response = await SafeWorker.assign<ArrayBuffer>({\r
-                               method: 'fetchEncrypted',\r
+                               method: 'fetch',\r
                                name: this.publicKey,\r
                                store: 'Account',\r
                                password: password.buffer\r
@@ -358,7 +358,7 @@ export class Account {
 \r
                const accounts: Account[] = []\r
                const privateAccounts: NamedData = {\r
-                       method: 'storeEncrypted',\r
+                       method: 'store',\r
                        store: 'Account',\r
                        password: password.buffer\r
                }\r
index 38fed2c3f50f5600147b01ae7ed19f8f7eb06de7..176ce7c483e382da3dc48f11d56f96566e9fd472 100644 (file)
@@ -170,7 +170,7 @@ export abstract class Wallet {
                        })\r
                        const encoded = utf8.toBytes(serialized)\r
                        const success = await SafeWorker.assign({\r
-                               method: 'storeEncrypted',\r
+                               method: 'store',\r
                                store: 'Wallet',\r
                                [this.id]: encoded.buffer,\r
                                password: password.buffer\r
@@ -231,7 +231,7 @@ export abstract class Wallet {
                }\r
                try {\r
                        const response = await SafeWorker.assign<ArrayBuffer>({\r
-                               method: 'fetchEncrypted',\r
+                               method: 'fetch',\r
                                name: this.id,\r
                                store: 'Wallet',\r
                                password: password.buffer\r
index 1ebcc065dab483739bc3dd1cd3824cffb8166fcb..4df02969a22b61c923374400db681e74dab1c3bf 100644 (file)
@@ -41,11 +41,11 @@ export class Safe extends WorkerInterface {
                this.#storage = await this.#open(this.DB_NAME)
                try {
                        switch (method) {
-                               case 'storeEncrypted': {
-                                       return { result: await this.storeEncrypted(data, store, password) }
+                               case 'store': {
+                                       return { result: await this.store(data, store, password) }
                                }
-                               case 'fetchEncrypted': {
-                                       return await this.fetchEncrypted(name, store, password)
+                               case 'fetch': {
+                                       return await this.fetch(name, store, password)
                                }
                                case 'destroy': {
                                        return { result: await this.destroy(name, store) }
@@ -75,7 +75,7 @@ export class Safe extends WorkerInterface {
        /**
        * Encrypts data with a password byte array and stores it in the Safe.
        */
-       static async storeEncrypted (data: NamedData | unknown, store: string | unknown, password: ArrayBuffer | unknown): Promise<boolean> {
+       static async store (data: NamedData | unknown, store: string | unknown, password: ArrayBuffer | unknown): Promise<boolean> {
                this.#isDataValid(data)
                if (typeof store !== 'string' || store === '') {
                        throw new Error('Invalid database store name')
@@ -110,7 +110,7 @@ export class Safe extends WorkerInterface {
        /**
        * Retrieves data from the Safe and decrypts it with a password byte array.
        */
-       static async fetchEncrypted (name: string | string[] | unknown, store: string | unknown, password: ArrayBuffer | unknown): Promise<NamedData<ArrayBuffer>> {
+       static async fetch (name: string | string[] | unknown, store: string | unknown, password: ArrayBuffer | unknown): Promise<NamedData<ArrayBuffer>> {
                const names = Array.isArray(name) ? name : [name]
                if (names.some(v => typeof v !== 'string')) {
                        throw new Error('Invalid fields')