@haex-space/vault-sdk 2.3.15 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-DBF83o_W.js';
1
+ import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-CmPqOcLB.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  declare class StorageAPI {
@@ -376,23 +376,30 @@ declare class PermissionsAPI {
376
376
  checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
377
377
  }
378
378
 
379
+ /**
380
+ * HaexVault Client
381
+ *
382
+ * Main SDK client for extensions running in HaexVault.
383
+ * Supports both native WebView mode (Tauri) and iframe mode (mobile/web).
384
+ */
385
+
379
386
  declare class HaexVaultClient {
380
- private config;
381
- private pendingRequests;
382
- private eventListeners;
383
- private externalRequestHandlers;
384
- private messageHandler;
387
+ private readonly config;
385
388
  private initialized;
389
+ private isNativeWindow;
386
390
  private requestCounter;
387
391
  private _extensionInfo;
388
392
  private _context;
389
- private reactiveSubscribers;
390
- private isNativeWindow;
393
+ private _setupCompleted;
394
+ private readonly pendingRequests;
395
+ private readonly eventListeners;
396
+ private readonly externalRequestHandlers;
397
+ private readonly reactiveSubscribers;
398
+ private messageHandler;
391
399
  private readyPromise;
392
400
  private resolveReady;
393
401
  private setupPromise;
394
402
  private setupHook;
395
- private _setupCompleted;
396
403
  orm: SqliteRemoteDatabase<Record<string, unknown>> | null;
397
404
  readonly storage: StorageAPI;
398
405
  readonly database: DatabaseAPI;
@@ -400,40 +407,14 @@ declare class HaexVaultClient {
400
407
  readonly web: WebAPI;
401
408
  readonly permissions: PermissionsAPI;
402
409
  constructor(config?: HaexHubConfig);
403
- /**
404
- * Gibt ein Promise zurück, das aufgelöst wird, sobald der Client
405
- * initialisiert ist und Extension-Infos empfangen hat.
406
- */
407
410
  ready(): Promise<void>;
408
- /**
409
- * Gibt zurück, ob das Setup bereits abgeschlossen wurde.
410
- */
411
411
  get setupCompleted(): boolean;
412
- /**
413
- * Registriert eine Setup-Funktion, die nach der Initialisierung ausgeführt wird.
414
- * Diese Funktion sollte für Aufgaben wie Tabellenerstellung, Migrationen, etc. verwendet werden.
415
- * @param setupFn Die Setup-Funktion, die ausgeführt werden soll
416
- */
417
412
  onSetup(setupFn: () => Promise<void>): void;
418
- /**
419
- * Gibt ein Promise zurück, das aufgelöst wird, sobald der Client vollständig eingerichtet ist.
420
- * Dies umfasst die Initialisierung UND das Setup (z.B. Tabellenerstellung).
421
- * Falls kein Setup-Hook registriert wurde, entspricht dies ready().
422
- */
423
413
  setupComplete(): Promise<void>;
424
- private runSetupAsync;
425
- /**
426
- * Initialisiert die Drizzle-Datenbankinstanz.
427
- * Muss nach der Definition des Schemas aufgerufen werden.
428
- * @param schema Das Drizzle-Schemaobjekt (mit bereits geprefixten Tabellennamen).
429
- * @returns Die typsichere Drizzle-Datenbankinstanz.
430
- */
431
- initializeDatabase<T extends Record<string, unknown>>(schema: T): SqliteRemoteDatabase<T>;
414
+ destroy(): void;
432
415
  get extensionInfo(): ExtensionInfo | null;
433
416
  get context(): ApplicationContext | null;
434
417
  subscribe(callback: () => void): () => void;
435
- private notifySubscribers;
436
- getDependencies(): Promise<ExtensionInfo[]>;
437
418
  getTableName(tableName: string): string;
438
419
  getDependencyTableName(publicKey: string, extensionName: string, tableName: string): string;
439
420
  parseTableName(fullTableName: string): {
@@ -441,81 +422,30 @@ declare class HaexVaultClient {
441
422
  extensionName: string;
442
423
  tableName: string;
443
424
  } | null;
444
- /**
445
- * Execute a raw SQL query (SELECT)
446
- * Returns rows as an array of objects
447
- */
425
+ initializeDatabase<T extends Record<string, unknown>>(schema: T): SqliteRemoteDatabase<T>;
448
426
  query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
449
- /**
450
- * Alias for query() - more intuitive for SELECT statements
451
- */
452
427
  select<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
453
- /**
454
- * Execute a raw SQL statement (INSERT, UPDATE, DELETE, CREATE, etc.)
455
- * Returns rowsAffected and lastInsertId
456
- */
457
428
  execute(sql: string, params?: unknown[]): Promise<{
458
429
  rowsAffected: number;
459
430
  lastInsertId?: number;
460
431
  }>;
461
- /**
462
- * Registers and applies extension migrations with HaexVault
463
- *
464
- * HaexVault will:
465
- * 1. Validate all SQL statements (ensure only extension's own tables are accessed)
466
- * 2. Store migrations with applied_at = NULL
467
- * 3. Query pending migrations sorted by name
468
- * 4. Apply pending migrations and set up CRDT triggers
469
- * 5. Mark successful migrations with applied_at timestamp
470
- *
471
- * @param extensionVersion - The version of the extension
472
- * @param migrations - Array of migration objects with name and SQL content
473
- * @returns Promise with migration result (applied count, already applied count, applied migration names)
474
- */
475
432
  registerMigrationsAsync(extensionVersion: string, migrations: Migration[]): Promise<MigrationResult>;
433
+ getDependencies(): Promise<ExtensionInfo[]>;
476
434
  requestDatabasePermission(request: DatabasePermissionRequest): Promise<PermissionResponse>;
477
435
  checkDatabasePermission(resource: string, operation: "read" | "write"): Promise<boolean>;
478
436
  respondToSearch(requestId: string, results: SearchResult[]): Promise<void>;
479
- /**
480
- * Register a handler for external requests (from browser extensions, CLI, servers, etc.)
481
- *
482
- * @param action - The action/method name to handle (e.g., "get-logins", "get-totp")
483
- * @param handler - Function that processes the request and returns a response
484
- * @returns Unsubscribe function to remove the handler
485
- *
486
- * @example
487
- * ```typescript
488
- * client.onExternalRequest("get-logins", async (request) => {
489
- * const entries = await getMatchingEntries(request.payload.url);
490
- * return {
491
- * requestId: request.requestId,
492
- * success: true,
493
- * data: { entries }
494
- * };
495
- * });
496
- * ```
497
- */
498
437
  onExternalRequest(action: string, handler: ExternalRequestHandler): () => void;
499
- /**
500
- * Send a response to an external request back to haex-vault
501
- * This is called internally after a handler processes a request
502
- */
503
438
  respondToExternalRequest(response: ExternalResponse): Promise<void>;
504
- request<T = unknown, P = Record<string, unknown>>(method: string, params?: P): Promise<T>;
505
- private postMessage;
506
- private invoke;
507
439
  on(eventType: string, callback: EventCallback): void;
508
440
  off(eventType: string, callback: EventCallback): void;
509
- destroy(): void;
441
+ request<T = unknown, P = Record<string, unknown>>(method: string, params?: P): Promise<T>;
510
442
  private init;
511
- private handleMessage;
443
+ private initNative;
444
+ private initIframe;
512
445
  private handleEvent;
513
- private handleExternalRequest;
514
- private emitEvent;
515
- private generateRequestId;
516
- private validatePublicKey;
517
- private validateExtensionName;
518
- private validateTableName;
446
+ private handleExternalRequestInternal;
447
+ private runSetupAsync;
448
+ private notifySubscribersInternal;
519
449
  private log;
520
450
  }
521
451
 
@@ -1,4 +1,4 @@
1
- import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-DBF83o_W.mjs';
1
+ import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-CmPqOcLB.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  declare class StorageAPI {
@@ -376,23 +376,30 @@ declare class PermissionsAPI {
376
376
  checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
377
377
  }
378
378
 
379
+ /**
380
+ * HaexVault Client
381
+ *
382
+ * Main SDK client for extensions running in HaexVault.
383
+ * Supports both native WebView mode (Tauri) and iframe mode (mobile/web).
384
+ */
385
+
379
386
  declare class HaexVaultClient {
380
- private config;
381
- private pendingRequests;
382
- private eventListeners;
383
- private externalRequestHandlers;
384
- private messageHandler;
387
+ private readonly config;
385
388
  private initialized;
389
+ private isNativeWindow;
386
390
  private requestCounter;
387
391
  private _extensionInfo;
388
392
  private _context;
389
- private reactiveSubscribers;
390
- private isNativeWindow;
393
+ private _setupCompleted;
394
+ private readonly pendingRequests;
395
+ private readonly eventListeners;
396
+ private readonly externalRequestHandlers;
397
+ private readonly reactiveSubscribers;
398
+ private messageHandler;
391
399
  private readyPromise;
392
400
  private resolveReady;
393
401
  private setupPromise;
394
402
  private setupHook;
395
- private _setupCompleted;
396
403
  orm: SqliteRemoteDatabase<Record<string, unknown>> | null;
397
404
  readonly storage: StorageAPI;
398
405
  readonly database: DatabaseAPI;
@@ -400,40 +407,14 @@ declare class HaexVaultClient {
400
407
  readonly web: WebAPI;
401
408
  readonly permissions: PermissionsAPI;
402
409
  constructor(config?: HaexHubConfig);
403
- /**
404
- * Gibt ein Promise zurück, das aufgelöst wird, sobald der Client
405
- * initialisiert ist und Extension-Infos empfangen hat.
406
- */
407
410
  ready(): Promise<void>;
408
- /**
409
- * Gibt zurück, ob das Setup bereits abgeschlossen wurde.
410
- */
411
411
  get setupCompleted(): boolean;
412
- /**
413
- * Registriert eine Setup-Funktion, die nach der Initialisierung ausgeführt wird.
414
- * Diese Funktion sollte für Aufgaben wie Tabellenerstellung, Migrationen, etc. verwendet werden.
415
- * @param setupFn Die Setup-Funktion, die ausgeführt werden soll
416
- */
417
412
  onSetup(setupFn: () => Promise<void>): void;
418
- /**
419
- * Gibt ein Promise zurück, das aufgelöst wird, sobald der Client vollständig eingerichtet ist.
420
- * Dies umfasst die Initialisierung UND das Setup (z.B. Tabellenerstellung).
421
- * Falls kein Setup-Hook registriert wurde, entspricht dies ready().
422
- */
423
413
  setupComplete(): Promise<void>;
424
- private runSetupAsync;
425
- /**
426
- * Initialisiert die Drizzle-Datenbankinstanz.
427
- * Muss nach der Definition des Schemas aufgerufen werden.
428
- * @param schema Das Drizzle-Schemaobjekt (mit bereits geprefixten Tabellennamen).
429
- * @returns Die typsichere Drizzle-Datenbankinstanz.
430
- */
431
- initializeDatabase<T extends Record<string, unknown>>(schema: T): SqliteRemoteDatabase<T>;
414
+ destroy(): void;
432
415
  get extensionInfo(): ExtensionInfo | null;
433
416
  get context(): ApplicationContext | null;
434
417
  subscribe(callback: () => void): () => void;
435
- private notifySubscribers;
436
- getDependencies(): Promise<ExtensionInfo[]>;
437
418
  getTableName(tableName: string): string;
438
419
  getDependencyTableName(publicKey: string, extensionName: string, tableName: string): string;
439
420
  parseTableName(fullTableName: string): {
@@ -441,81 +422,30 @@ declare class HaexVaultClient {
441
422
  extensionName: string;
442
423
  tableName: string;
443
424
  } | null;
444
- /**
445
- * Execute a raw SQL query (SELECT)
446
- * Returns rows as an array of objects
447
- */
425
+ initializeDatabase<T extends Record<string, unknown>>(schema: T): SqliteRemoteDatabase<T>;
448
426
  query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
449
- /**
450
- * Alias for query() - more intuitive for SELECT statements
451
- */
452
427
  select<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
453
- /**
454
- * Execute a raw SQL statement (INSERT, UPDATE, DELETE, CREATE, etc.)
455
- * Returns rowsAffected and lastInsertId
456
- */
457
428
  execute(sql: string, params?: unknown[]): Promise<{
458
429
  rowsAffected: number;
459
430
  lastInsertId?: number;
460
431
  }>;
461
- /**
462
- * Registers and applies extension migrations with HaexVault
463
- *
464
- * HaexVault will:
465
- * 1. Validate all SQL statements (ensure only extension's own tables are accessed)
466
- * 2. Store migrations with applied_at = NULL
467
- * 3. Query pending migrations sorted by name
468
- * 4. Apply pending migrations and set up CRDT triggers
469
- * 5. Mark successful migrations with applied_at timestamp
470
- *
471
- * @param extensionVersion - The version of the extension
472
- * @param migrations - Array of migration objects with name and SQL content
473
- * @returns Promise with migration result (applied count, already applied count, applied migration names)
474
- */
475
432
  registerMigrationsAsync(extensionVersion: string, migrations: Migration[]): Promise<MigrationResult>;
433
+ getDependencies(): Promise<ExtensionInfo[]>;
476
434
  requestDatabasePermission(request: DatabasePermissionRequest): Promise<PermissionResponse>;
477
435
  checkDatabasePermission(resource: string, operation: "read" | "write"): Promise<boolean>;
478
436
  respondToSearch(requestId: string, results: SearchResult[]): Promise<void>;
479
- /**
480
- * Register a handler for external requests (from browser extensions, CLI, servers, etc.)
481
- *
482
- * @param action - The action/method name to handle (e.g., "get-logins", "get-totp")
483
- * @param handler - Function that processes the request and returns a response
484
- * @returns Unsubscribe function to remove the handler
485
- *
486
- * @example
487
- * ```typescript
488
- * client.onExternalRequest("get-logins", async (request) => {
489
- * const entries = await getMatchingEntries(request.payload.url);
490
- * return {
491
- * requestId: request.requestId,
492
- * success: true,
493
- * data: { entries }
494
- * };
495
- * });
496
- * ```
497
- */
498
437
  onExternalRequest(action: string, handler: ExternalRequestHandler): () => void;
499
- /**
500
- * Send a response to an external request back to haex-vault
501
- * This is called internally after a handler processes a request
502
- */
503
438
  respondToExternalRequest(response: ExternalResponse): Promise<void>;
504
- request<T = unknown, P = Record<string, unknown>>(method: string, params?: P): Promise<T>;
505
- private postMessage;
506
- private invoke;
507
439
  on(eventType: string, callback: EventCallback): void;
508
440
  off(eventType: string, callback: EventCallback): void;
509
- destroy(): void;
441
+ request<T = unknown, P = Record<string, unknown>>(method: string, params?: P): Promise<T>;
510
442
  private init;
511
- private handleMessage;
443
+ private initNative;
444
+ private initIframe;
512
445
  private handleEvent;
513
- private handleExternalRequest;
514
- private emitEvent;
515
- private generateRequestId;
516
- private validatePublicKey;
517
- private validateExtensionName;
518
- private validateTableName;
446
+ private handleExternalRequestInternal;
447
+ private runSetupAsync;
448
+ private notifySubscribersInternal;
519
449
  private log;
520
450
  }
521
451
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultClient } from './client-8eGxojZ1.mjs';
2
- export { A as AddBackendOptions, m as AddSyncRuleOptions, C as CreateSpaceOptions, D as DatabaseAPI, n as DownloadFileOptions, c as FileInfo, b as FileSpace, a as FileSyncAPI, d as FileSyncState, F as FilesystemAPI, L as ListFilesOptions, P as PermissionsAPI, g as S3BackendConfig, e as StorageBackendInfo, f as StorageBackendType, i as SyncDirection, k as SyncError, l as SyncProgress, h as SyncRule, j as SyncStatus, U as UploadFileOptions, W as WebAPI } from './client-8eGxojZ1.mjs';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-DBF83o_W.mjs';
4
- export { A as ApplicationContext, C as ContextChangedEvent, v as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, u as ErrorCode, g as EventCallback, a as ExtensionInfo, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, y as HAEXTENSION_EVENTS, x as HaexHubError, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, z as HaextensionEvent, P as PermissionResponse, t as PermissionStatus, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, w as getTableName } from './types-DBF83o_W.mjs';
1
+ import { H as HaexVaultClient } from './client-ClYpUDoI.mjs';
2
+ export { A as AddBackendOptions, m as AddSyncRuleOptions, C as CreateSpaceOptions, D as DatabaseAPI, n as DownloadFileOptions, c as FileInfo, b as FileSpace, a as FileSyncAPI, d as FileSyncState, F as FilesystemAPI, L as ListFilesOptions, P as PermissionsAPI, g as S3BackendConfig, e as StorageBackendInfo, f as StorageBackendType, i as SyncDirection, k as SyncError, l as SyncProgress, h as SyncRule, j as SyncStatus, U as UploadFileOptions, W as WebAPI } from './client-ClYpUDoI.mjs';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-CmPqOcLB.mjs';
4
+ export { A as ApplicationContext, C as ContextChangedEvent, v as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, u as ErrorCode, g as EventCallback, a as ExtensionInfo, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, y as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, x as HaexVaultSdkError, z as HaextensionEvent, P as PermissionResponse, t as PermissionStatus, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, w as getTableName } from './types-CmPqOcLB.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -159,6 +159,65 @@ declare const HAEXSPACE_MESSAGE_TYPES: {
159
159
  };
160
160
  type HaexspaceMessageType = (typeof HAEXSPACE_MESSAGE_TYPES)[keyof typeof HAEXSPACE_MESSAGE_TYPES];
161
161
 
162
+ /**
163
+ * Tauri Command Names
164
+ *
165
+ * Central definition of all Tauri invoke command names.
166
+ * These must match the #[tauri::command] function names in Rust.
167
+ */
168
+ declare const TAURI_COMMANDS: {
169
+ readonly database: {
170
+ readonly query: "webview_extension_db_query";
171
+ readonly execute: "webview_extension_db_execute";
172
+ readonly registerMigrations: "webview_extension_db_register_migrations";
173
+ };
174
+ readonly permissions: {
175
+ readonly checkWeb: "webview_extension_check_web_permission";
176
+ readonly checkDatabase: "webview_extension_check_database_permission";
177
+ readonly checkFilesystem: "webview_extension_check_filesystem_permission";
178
+ };
179
+ readonly web: {
180
+ readonly open: "webview_extension_web_open";
181
+ readonly fetch: "webview_extension_web_request";
182
+ };
183
+ readonly filesystem: {
184
+ readonly saveFile: "webview_extension_fs_save_file";
185
+ readonly openFile: "webview_extension_fs_open_file";
186
+ readonly showImage: "webview_extension_fs_show_image";
187
+ };
188
+ readonly external: {
189
+ readonly respond: "webview_extension_external_respond";
190
+ };
191
+ readonly extension: {
192
+ readonly getInfo: "webview_extension_get_info";
193
+ readonly getContext: "webview_extension_context_get";
194
+ };
195
+ readonly filesync: {
196
+ readonly listSpaces: "filesync_list_spaces";
197
+ readonly createSpace: "filesync_create_space";
198
+ readonly deleteSpace: "filesync_delete_space";
199
+ readonly listFiles: "filesync_list_files";
200
+ readonly getFile: "filesync_get_file";
201
+ readonly uploadFile: "filesync_upload_file";
202
+ readonly downloadFile: "filesync_download_file";
203
+ readonly deleteFile: "filesync_delete_file";
204
+ readonly listBackends: "filesync_list_backends";
205
+ readonly addBackend: "filesync_add_backend";
206
+ readonly removeBackend: "filesync_remove_backend";
207
+ readonly testBackend: "filesync_test_backend";
208
+ readonly listSyncRules: "filesync_list_sync_rules";
209
+ readonly addSyncRule: "filesync_add_sync_rule";
210
+ readonly removeSyncRule: "filesync_remove_sync_rule";
211
+ readonly getSyncStatus: "filesync_get_sync_status";
212
+ readonly triggerSync: "filesync_trigger_sync";
213
+ readonly pauseSync: "filesync_pause_sync";
214
+ readonly resumeSync: "filesync_resume_sync";
215
+ readonly resolveConflict: "filesync_resolve_conflict";
216
+ readonly selectFolder: "filesync_select_folder";
217
+ };
218
+ };
219
+ type TauriCommand = (typeof TAURI_COMMANDS.database)[keyof typeof TAURI_COMMANDS.database] | (typeof TAURI_COMMANDS.permissions)[keyof typeof TAURI_COMMANDS.permissions] | (typeof TAURI_COMMANDS.web)[keyof typeof TAURI_COMMANDS.web] | (typeof TAURI_COMMANDS.filesystem)[keyof typeof TAURI_COMMANDS.filesystem] | (typeof TAURI_COMMANDS.external)[keyof typeof TAURI_COMMANDS.external] | (typeof TAURI_COMMANDS.extension)[keyof typeof TAURI_COMMANDS.extension] | (typeof TAURI_COMMANDS.filesync)[keyof typeof TAURI_COMMANDS.filesync];
220
+
162
221
  interface VerifyResult {
163
222
  valid: boolean;
164
223
  error?: string;
@@ -267,6 +326,17 @@ declare function encryptCrdtData(data: object, vaultKey: Uint8Array): Promise<{
267
326
  encryptedData: string;
268
327
  nonce: string;
269
328
  }>;
329
+ /**
330
+ * Wraps (encrypts) a key with another key using AES-GCM
331
+ * Used for key hierarchies (e.g., master key -> space key -> file key)
332
+ * Returns: nonce (12 bytes) + ciphertext as Uint8Array
333
+ */
334
+ declare function wrapKey(keyToWrap: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array>;
335
+ /**
336
+ * Unwraps (decrypts) a key with another key using AES-GCM
337
+ * Expects: nonce (12 bytes) + ciphertext as Uint8Array
338
+ */
339
+ declare function unwrapKey(wrappedKey: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array>;
270
340
  /**
271
341
  * Decrypts CRDT log data with the vault key
272
342
  */
@@ -276,4 +346,4 @@ declare function base64ToArrayBuffer(base64: string): Uint8Array;
276
346
 
277
347
  declare function createHaexVaultClient(config?: HaexHubConfig): HaexVaultClient;
278
348
 
279
- export { ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_METHODS, HaexHubConfig, HaexVaultClient, type HaexspaceMessageType, type HaextensionMethod, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultClient, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, generateVaultKey, hexToBytes, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, sortObjectKeysRecursively, verifyExtensionSignature };
349
+ export { ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_METHODS, HaexHubConfig, HaexVaultClient, type HaexspaceMessageType, type HaextensionMethod, TAURI_COMMANDS, type TauriCommand, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultClient, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, generateVaultKey, hexToBytes, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, wrapKey };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultClient } from './client-ChH7wiuU.js';
2
- export { A as AddBackendOptions, m as AddSyncRuleOptions, C as CreateSpaceOptions, D as DatabaseAPI, n as DownloadFileOptions, c as FileInfo, b as FileSpace, a as FileSyncAPI, d as FileSyncState, F as FilesystemAPI, L as ListFilesOptions, P as PermissionsAPI, g as S3BackendConfig, e as StorageBackendInfo, f as StorageBackendType, i as SyncDirection, k as SyncError, l as SyncProgress, h as SyncRule, j as SyncStatus, U as UploadFileOptions, W as WebAPI } from './client-ChH7wiuU.js';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-DBF83o_W.js';
4
- export { A as ApplicationContext, C as ContextChangedEvent, v as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, u as ErrorCode, g as EventCallback, a as ExtensionInfo, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, y as HAEXTENSION_EVENTS, x as HaexHubError, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, z as HaextensionEvent, P as PermissionResponse, t as PermissionStatus, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, w as getTableName } from './types-DBF83o_W.js';
1
+ import { H as HaexVaultClient } from './client-BSdAg7D1.js';
2
+ export { A as AddBackendOptions, m as AddSyncRuleOptions, C as CreateSpaceOptions, D as DatabaseAPI, n as DownloadFileOptions, c as FileInfo, b as FileSpace, a as FileSyncAPI, d as FileSyncState, F as FilesystemAPI, L as ListFilesOptions, P as PermissionsAPI, g as S3BackendConfig, e as StorageBackendInfo, f as StorageBackendType, i as SyncDirection, k as SyncError, l as SyncProgress, h as SyncRule, j as SyncStatus, U as UploadFileOptions, W as WebAPI } from './client-BSdAg7D1.js';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-CmPqOcLB.js';
4
+ export { A as ApplicationContext, C as ContextChangedEvent, v as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, u as ErrorCode, g as EventCallback, a as ExtensionInfo, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, y as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, x as HaexVaultSdkError, z as HaextensionEvent, P as PermissionResponse, t as PermissionStatus, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, w as getTableName } from './types-CmPqOcLB.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -159,6 +159,65 @@ declare const HAEXSPACE_MESSAGE_TYPES: {
159
159
  };
160
160
  type HaexspaceMessageType = (typeof HAEXSPACE_MESSAGE_TYPES)[keyof typeof HAEXSPACE_MESSAGE_TYPES];
161
161
 
162
+ /**
163
+ * Tauri Command Names
164
+ *
165
+ * Central definition of all Tauri invoke command names.
166
+ * These must match the #[tauri::command] function names in Rust.
167
+ */
168
+ declare const TAURI_COMMANDS: {
169
+ readonly database: {
170
+ readonly query: "webview_extension_db_query";
171
+ readonly execute: "webview_extension_db_execute";
172
+ readonly registerMigrations: "webview_extension_db_register_migrations";
173
+ };
174
+ readonly permissions: {
175
+ readonly checkWeb: "webview_extension_check_web_permission";
176
+ readonly checkDatabase: "webview_extension_check_database_permission";
177
+ readonly checkFilesystem: "webview_extension_check_filesystem_permission";
178
+ };
179
+ readonly web: {
180
+ readonly open: "webview_extension_web_open";
181
+ readonly fetch: "webview_extension_web_request";
182
+ };
183
+ readonly filesystem: {
184
+ readonly saveFile: "webview_extension_fs_save_file";
185
+ readonly openFile: "webview_extension_fs_open_file";
186
+ readonly showImage: "webview_extension_fs_show_image";
187
+ };
188
+ readonly external: {
189
+ readonly respond: "webview_extension_external_respond";
190
+ };
191
+ readonly extension: {
192
+ readonly getInfo: "webview_extension_get_info";
193
+ readonly getContext: "webview_extension_context_get";
194
+ };
195
+ readonly filesync: {
196
+ readonly listSpaces: "filesync_list_spaces";
197
+ readonly createSpace: "filesync_create_space";
198
+ readonly deleteSpace: "filesync_delete_space";
199
+ readonly listFiles: "filesync_list_files";
200
+ readonly getFile: "filesync_get_file";
201
+ readonly uploadFile: "filesync_upload_file";
202
+ readonly downloadFile: "filesync_download_file";
203
+ readonly deleteFile: "filesync_delete_file";
204
+ readonly listBackends: "filesync_list_backends";
205
+ readonly addBackend: "filesync_add_backend";
206
+ readonly removeBackend: "filesync_remove_backend";
207
+ readonly testBackend: "filesync_test_backend";
208
+ readonly listSyncRules: "filesync_list_sync_rules";
209
+ readonly addSyncRule: "filesync_add_sync_rule";
210
+ readonly removeSyncRule: "filesync_remove_sync_rule";
211
+ readonly getSyncStatus: "filesync_get_sync_status";
212
+ readonly triggerSync: "filesync_trigger_sync";
213
+ readonly pauseSync: "filesync_pause_sync";
214
+ readonly resumeSync: "filesync_resume_sync";
215
+ readonly resolveConflict: "filesync_resolve_conflict";
216
+ readonly selectFolder: "filesync_select_folder";
217
+ };
218
+ };
219
+ type TauriCommand = (typeof TAURI_COMMANDS.database)[keyof typeof TAURI_COMMANDS.database] | (typeof TAURI_COMMANDS.permissions)[keyof typeof TAURI_COMMANDS.permissions] | (typeof TAURI_COMMANDS.web)[keyof typeof TAURI_COMMANDS.web] | (typeof TAURI_COMMANDS.filesystem)[keyof typeof TAURI_COMMANDS.filesystem] | (typeof TAURI_COMMANDS.external)[keyof typeof TAURI_COMMANDS.external] | (typeof TAURI_COMMANDS.extension)[keyof typeof TAURI_COMMANDS.extension] | (typeof TAURI_COMMANDS.filesync)[keyof typeof TAURI_COMMANDS.filesync];
220
+
162
221
  interface VerifyResult {
163
222
  valid: boolean;
164
223
  error?: string;
@@ -267,6 +326,17 @@ declare function encryptCrdtData(data: object, vaultKey: Uint8Array): Promise<{
267
326
  encryptedData: string;
268
327
  nonce: string;
269
328
  }>;
329
+ /**
330
+ * Wraps (encrypts) a key with another key using AES-GCM
331
+ * Used for key hierarchies (e.g., master key -> space key -> file key)
332
+ * Returns: nonce (12 bytes) + ciphertext as Uint8Array
333
+ */
334
+ declare function wrapKey(keyToWrap: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array>;
335
+ /**
336
+ * Unwraps (decrypts) a key with another key using AES-GCM
337
+ * Expects: nonce (12 bytes) + ciphertext as Uint8Array
338
+ */
339
+ declare function unwrapKey(wrappedKey: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array>;
270
340
  /**
271
341
  * Decrypts CRDT log data with the vault key
272
342
  */
@@ -276,4 +346,4 @@ declare function base64ToArrayBuffer(base64: string): Uint8Array;
276
346
 
277
347
  declare function createHaexVaultClient(config?: HaexHubConfig): HaexVaultClient;
278
348
 
279
- export { ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_METHODS, HaexHubConfig, HaexVaultClient, type HaexspaceMessageType, type HaextensionMethod, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultClient, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, generateVaultKey, hexToBytes, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, sortObjectKeysRecursively, verifyExtensionSignature };
349
+ export { ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_METHODS, HaexHubConfig, HaexVaultClient, type HaexspaceMessageType, type HaextensionMethod, TAURI_COMMANDS, type TauriCommand, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultClient, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, generateVaultKey, hexToBytes, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, wrapKey };