@haex-space/vault-sdk 3.7.0 → 4.0.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.
Files changed (51) hide show
  1. package/README.md +51 -19
  2. package/dist/cli/index.js +437 -355
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/cli/index.mjs +428 -339
  5. package/dist/cli/index.mjs.map +1 -1
  6. package/dist/{client-DH4Km77u.d.ts → client-C6pEREPM.d.ts} +48 -3
  7. package/dist/{client-Dn4AbXbT.d.mts → client-GdCi-m2s.d.mts} +48 -3
  8. package/dist/haex_bundle_bg.wasm +0 -0
  9. package/dist/index.d.mts +11 -59
  10. package/dist/index.d.ts +11 -59
  11. package/dist/index.js +130 -105
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +149 -123
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/node.d.mts +53 -2
  16. package/dist/node.d.ts +53 -2
  17. package/dist/node.js +319 -2
  18. package/dist/node.js.map +1 -1
  19. package/dist/node.mjs +320 -5
  20. package/dist/node.mjs.map +1 -1
  21. package/dist/nuxt.js +7 -5
  22. package/dist/nuxt.js.map +1 -1
  23. package/dist/nuxt.mjs +3 -2
  24. package/dist/nuxt.mjs.map +1 -1
  25. package/dist/react.d.mts +2 -2
  26. package/dist/react.d.ts +2 -2
  27. package/dist/react.js +137 -7
  28. package/dist/react.js.map +1 -1
  29. package/dist/react.mjs +157 -27
  30. package/dist/react.mjs.map +1 -1
  31. package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
  32. package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
  33. package/dist/runtime/nuxt.plugin.client.js +45 -7
  34. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  35. package/dist/runtime/nuxt.plugin.client.mjs +45 -7
  36. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  37. package/dist/svelte.d.mts +2 -2
  38. package/dist/svelte.d.ts +2 -2
  39. package/dist/svelte.js +137 -7
  40. package/dist/svelte.js.map +1 -1
  41. package/dist/svelte.mjs +157 -27
  42. package/dist/svelte.mjs.map +1 -1
  43. package/dist/{types-DQZCRfC-.d.mts → types-Ba4G6ZpC.d.mts} +10 -2
  44. package/dist/{types-DQZCRfC-.d.ts → types-Ba4G6ZpC.d.ts} +10 -2
  45. package/dist/vue.d.mts +2 -2
  46. package/dist/vue.d.ts +2 -2
  47. package/dist/vue.js +137 -7
  48. package/dist/vue.js.map +1 -1
  49. package/dist/vue.mjs +157 -27
  50. package/dist/vue.mjs.map +1 -1
  51. package/package.json +8 -6
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import 'path';
2
+ import 'url';
1
3
  import { drizzle } from 'drizzle-orm/sqlite-proxy';
2
4
 
3
5
  var __defProp = Object.defineProperty;
@@ -9,6 +11,10 @@ var __export = (target, all) => {
9
11
  for (var name in all)
10
12
  __defProp(target, name, { get: all[name], enumerable: true });
11
13
  };
14
+ var init_esm_shims = __esm({
15
+ "node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.28_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
16
+ }
17
+ });
12
18
 
13
19
  // src/crypto/vaultKey.ts
14
20
  async function deriveKeyFromPassword(password, salt) {
@@ -227,6 +233,7 @@ function base64ToArrayBuffer(base64) {
227
233
  var PBKDF2_ITERATIONS, KEY_LENGTH, ALGORITHM;
228
234
  var init_vaultKey = __esm({
229
235
  "src/crypto/vaultKey.ts"() {
236
+ init_esm_shims();
230
237
  PBKDF2_ITERATIONS = 6e5;
231
238
  KEY_LENGTH = 256;
232
239
  ALGORITHM = "AES-GCM";
@@ -310,13 +317,21 @@ async function decryptPrivateKeyAsync(encryptedPrivateKey, nonce, salt, password
310
317
  var SIGNING_ALGO, KEY_AGREEMENT_ALGO;
311
318
  var init_userKeypair = __esm({
312
319
  "src/crypto/userKeypair.ts"() {
320
+ init_esm_shims();
313
321
  init_vaultKey();
314
322
  SIGNING_ALGO = { name: "Ed25519" };
315
323
  KEY_AGREEMENT_ALGO = { name: "X25519" };
316
324
  }
317
325
  });
318
326
 
327
+ // src/index.ts
328
+ init_esm_shims();
329
+
330
+ // src/polyfills/index.ts
331
+ init_esm_shims();
332
+
319
333
  // src/polyfills/localStorage.ts
334
+ init_esm_shims();
320
335
  function installLocalStoragePolyfill() {
321
336
  if (typeof window === "undefined") {
322
337
  return;
@@ -411,6 +426,7 @@ function installSessionStoragePolyfill() {
411
426
  }
412
427
 
413
428
  // src/polyfills/cookies.ts
429
+ init_esm_shims();
414
430
  function installCookiePolyfill() {
415
431
  if (typeof window === "undefined" || typeof document === "undefined") {
416
432
  return;
@@ -471,6 +487,7 @@ function installCookiePolyfill() {
471
487
  }
472
488
 
473
489
  // src/polyfills/history.ts
490
+ init_esm_shims();
474
491
  function installHistoryPolyfill() {
475
492
  if (typeof window === "undefined" || typeof history === "undefined") {
476
493
  return;
@@ -534,7 +551,11 @@ function installHistoryPolyfill() {
534
551
  }
535
552
  }
536
553
 
554
+ // src/polyfills/debug.ts
555
+ init_esm_shims();
556
+
537
557
  // src/messages.ts
558
+ init_esm_shims();
538
559
  var HAEXSPACE_MESSAGE_TYPES = {
539
560
  /** Debug message for development/troubleshooting */
540
561
  DEBUG: "haexspace:debug",
@@ -579,6 +600,7 @@ function installDebugDiagnostics() {
579
600
  }
580
601
 
581
602
  // src/polyfills/baseTag.ts
603
+ init_esm_shims();
582
604
  function installBaseTag() {
583
605
  if (typeof window === "undefined" || typeof document === "undefined") {
584
606
  return;
@@ -620,6 +642,7 @@ function installBaseTag() {
620
642
  }
621
643
 
622
644
  // src/polyfills/consoleForwarding.ts
645
+ init_esm_shims();
623
646
  var originalConsole = {
624
647
  log: console.log,
625
648
  info: console.info,
@@ -700,7 +723,14 @@ if (typeof window !== "undefined") {
700
723
  installPolyfills();
701
724
  }
702
725
 
726
+ // src/client.ts
727
+ init_esm_shims();
728
+
729
+ // src/types.ts
730
+ init_esm_shims();
731
+
703
732
  // src/events.ts
733
+ init_esm_shims();
704
734
  var HAEXTENSION_EVENTS = {
705
735
  /** Context (theme, locale, platform) has changed */
706
736
  CONTEXT_CHANGED: "haextension:context:changed",
@@ -815,7 +845,17 @@ var HaexVaultSdkError = class extends Error {
815
845
  }
816
846
  };
817
847
 
848
+ // src/api/storage.ts
849
+ init_esm_shims();
850
+
851
+ // src/commands.ts
852
+ init_esm_shims();
853
+
854
+ // src/commands/index.ts
855
+ init_esm_shims();
856
+
818
857
  // src/commands/database.ts
858
+ init_esm_shims();
819
859
  var DATABASE_COMMANDS = {
820
860
  /** Execute a SELECT query */
821
861
  query: "extension_database_query",
@@ -828,6 +868,7 @@ var DATABASE_COMMANDS = {
828
868
  };
829
869
 
830
870
  // src/commands/permissions.ts
871
+ init_esm_shims();
831
872
  var PERMISSIONS_COMMANDS = {
832
873
  /** Check web/fetch permission */
833
874
  checkWeb: "extension_permissions_check_web",
@@ -838,6 +879,7 @@ var PERMISSIONS_COMMANDS = {
838
879
  };
839
880
 
840
881
  // src/commands/web.ts
882
+ init_esm_shims();
841
883
  var WEB_COMMANDS = {
842
884
  /** Open URL in external browser */
843
885
  open: "extension_web_open",
@@ -846,6 +888,7 @@ var WEB_COMMANDS = {
846
888
  };
847
889
 
848
890
  // src/commands/webStorage.ts
891
+ init_esm_shims();
849
892
  var WEB_STORAGE_COMMANDS = {
850
893
  /** Get item from storage */
851
894
  getItem: "extension_web_storage_get_item",
@@ -860,6 +903,7 @@ var WEB_STORAGE_COMMANDS = {
860
903
  };
861
904
 
862
905
  // src/commands/filesystem.ts
906
+ init_esm_shims();
863
907
  var FILESYSTEM_COMMANDS = {
864
908
  // Dialog commands
865
909
  /** Show save file dialog */
@@ -903,6 +947,7 @@ var FILESYSTEM_COMMANDS = {
903
947
  };
904
948
 
905
949
  // src/commands/externalBridge.ts
950
+ init_esm_shims();
906
951
  var EXTERNAL_BRIDGE_COMMANDS = {
907
952
  // Response handling (called by extensions)
908
953
  /** Respond to an external request */
@@ -942,6 +987,7 @@ var EXTERNAL_BRIDGE_COMMANDS = {
942
987
  };
943
988
 
944
989
  // src/commands/extension.ts
990
+ init_esm_shims();
945
991
  var EXTENSION_COMMANDS = {
946
992
  /** Get extension info (manifest, id, etc.) */
947
993
  getInfo: "extension_get_info",
@@ -956,10 +1002,15 @@ var EXTENSION_COMMANDS = {
956
1002
  /** Filter sync tables by extension permissions (returns filtered map) */
957
1003
  filterSyncTables: "extension_filter_sync_tables",
958
1004
  /** Emit sync tables to webviews (host-only, desktop only) */
959
- emitSyncTables: "extension_emit_sync_tables"
1005
+ emitSyncTables: "extension_emit_sync_tables",
1006
+ /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
1007
+ tabAttention: "extension_tab_attention",
1008
+ /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
1009
+ dialogConfirm: "extension_dialog_confirm"
960
1010
  };
961
1011
 
962
1012
  // src/commands/remoteStorage.ts
1013
+ init_esm_shims();
963
1014
  var REMOTE_STORAGE_COMMANDS = {
964
1015
  // Backend Management
965
1016
  /** List all storage backends */
@@ -984,6 +1035,7 @@ var REMOTE_STORAGE_COMMANDS = {
984
1035
  };
985
1036
 
986
1037
  // src/commands/localsend.ts
1038
+ init_esm_shims();
987
1039
  var LOCALSEND_COMMANDS = {
988
1040
  // Initialization
989
1041
  /** Initialize LocalSend (generate identity, etc.) */
@@ -1030,6 +1082,7 @@ var LOCALSEND_COMMANDS = {
1030
1082
  };
1031
1083
 
1032
1084
  // src/commands/spaces.ts
1085
+ init_esm_shims();
1033
1086
  var SPACE_COMMANDS = {
1034
1087
  /** Bulk assign rows to spaces */
1035
1088
  assign: "extension_space_assign",
@@ -1048,6 +1101,7 @@ var SPACE_COMMANDS = {
1048
1101
  };
1049
1102
 
1050
1103
  // src/commands/shell.ts
1104
+ init_esm_shims();
1051
1105
  var SHELL_COMMANDS = {
1052
1106
  /** List available shell environments (no permission required) */
1053
1107
  listAvailable: "extension_shell_list_available",
@@ -1062,6 +1116,7 @@ var SHELL_COMMANDS = {
1062
1116
  };
1063
1117
 
1064
1118
  // src/commands/passwords.ts
1119
+ init_esm_shims();
1065
1120
  var PASSWORD_COMMANDS = {
1066
1121
  /** List items (no secrets) within the extension's tag scope */
1067
1122
  list: "extension_password_list",
@@ -1076,6 +1131,7 @@ var PASSWORD_COMMANDS = {
1076
1131
  };
1077
1132
 
1078
1133
  // src/commands/mail.ts
1134
+ init_esm_shims();
1079
1135
  var MAIL_COMMANDS = {
1080
1136
  /** LIST mailboxes + optional STATUS counts */
1081
1137
  listMailboxes: "extension_mail_list_mailboxes",
@@ -1102,6 +1158,7 @@ var MAIL_COMMANDS = {
1102
1158
  };
1103
1159
 
1104
1160
  // src/commands/notifications.ts
1161
+ init_esm_shims();
1105
1162
  var NOTIFICATION_COMMANDS = {
1106
1163
  /** Show an OS notification. Returns the assigned notification id. */
1107
1164
  show: "extension_notifications_show",
@@ -1150,6 +1207,7 @@ var StorageAPI = class {
1150
1207
  };
1151
1208
 
1152
1209
  // src/api/database.ts
1210
+ init_esm_shims();
1153
1211
  function quoteIdent(identifier) {
1154
1212
  if (identifier.startsWith('"') && identifier.endsWith('"')) {
1155
1213
  return identifier;
@@ -1249,6 +1307,7 @@ var DatabaseAPI = class {
1249
1307
  };
1250
1308
 
1251
1309
  // src/api/filesystem.ts
1310
+ init_esm_shims();
1252
1311
  init_vaultKey();
1253
1312
  var KnownPath = /* @__PURE__ */ ((KnownPath2) => {
1254
1313
  KnownPath2["Home"] = "home";
@@ -1324,10 +1383,10 @@ var FilesystemAPI = class {
1324
1383
  * @param path Absolute path to the file
1325
1384
  * @returns File contents as Uint8Array
1326
1385
  */
1327
- async readFile(path) {
1386
+ async readFile(path2) {
1328
1387
  const base64 = await this.client.request(
1329
1388
  FILESYSTEM_COMMANDS.readFile,
1330
- { path }
1389
+ { path: path2 }
1331
1390
  );
1332
1391
  return base64ToArrayBuffer(base64);
1333
1392
  }
@@ -1336,11 +1395,11 @@ var FilesystemAPI = class {
1336
1395
  * @param path Absolute path to the file
1337
1396
  * @param data File contents as Uint8Array
1338
1397
  */
1339
- async writeFile(path, data) {
1398
+ async writeFile(path2, data) {
1340
1399
  const base64 = arrayBufferToBase64(data);
1341
1400
  await this.client.request(
1342
1401
  FILESYSTEM_COMMANDS.writeFile,
1343
- { path, data: base64 }
1402
+ { path: path2, data: base64 }
1344
1403
  );
1345
1404
  }
1346
1405
  /**
@@ -1348,20 +1407,20 @@ var FilesystemAPI = class {
1348
1407
  * @param path Absolute path to the directory
1349
1408
  * @returns Array of directory entries
1350
1409
  */
1351
- async readDir(path) {
1410
+ async readDir(path2) {
1352
1411
  return this.client.request(
1353
1412
  FILESYSTEM_COMMANDS.readDir,
1354
- { path }
1413
+ { path: path2 }
1355
1414
  );
1356
1415
  }
1357
1416
  /**
1358
1417
  * Create a directory (and parent directories if needed)
1359
1418
  * @param path Absolute path to create
1360
1419
  */
1361
- async mkdir(path) {
1420
+ async mkdir(path2) {
1362
1421
  await this.client.request(
1363
1422
  FILESYSTEM_COMMANDS.mkdir,
1364
- { path }
1423
+ { path: path2 }
1365
1424
  );
1366
1425
  }
1367
1426
  /**
@@ -1369,10 +1428,10 @@ var FilesystemAPI = class {
1369
1428
  * @param path Absolute path to remove
1370
1429
  * @param recursive If true, remove directories recursively
1371
1430
  */
1372
- async remove(path, recursive = false) {
1431
+ async remove(path2, recursive = false) {
1373
1432
  await this.client.request(
1374
1433
  FILESYSTEM_COMMANDS.remove,
1375
- { path, recursive }
1434
+ { path: path2, recursive }
1376
1435
  );
1377
1436
  }
1378
1437
  /**
@@ -1380,10 +1439,10 @@ var FilesystemAPI = class {
1380
1439
  * @param path Absolute path to check
1381
1440
  * @returns True if the path exists
1382
1441
  */
1383
- async exists(path) {
1442
+ async exists(path2) {
1384
1443
  return this.client.request(
1385
1444
  FILESYSTEM_COMMANDS.exists,
1386
- { path }
1445
+ { path: path2 }
1387
1446
  );
1388
1447
  }
1389
1448
  /**
@@ -1391,10 +1450,10 @@ var FilesystemAPI = class {
1391
1450
  * @param path Absolute path
1392
1451
  * @returns File metadata
1393
1452
  */
1394
- async stat(path) {
1453
+ async stat(path2) {
1395
1454
  return this.client.request(
1396
1455
  FILESYSTEM_COMMANDS.stat,
1397
- { path }
1456
+ { path: path2 }
1398
1457
  );
1399
1458
  }
1400
1459
  /**
@@ -1463,10 +1522,10 @@ var FilesystemAPI = class {
1463
1522
  * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
1464
1523
  * @param path Absolute path to the directory to watch
1465
1524
  */
1466
- async watch(ruleId, path) {
1525
+ async watch(ruleId, path2) {
1467
1526
  await this.client.request(
1468
1527
  FILESYSTEM_COMMANDS.watch,
1469
- { ruleId, path }
1528
+ { ruleId, path: path2 }
1470
1529
  );
1471
1530
  }
1472
1531
  /**
@@ -1493,6 +1552,7 @@ var FilesystemAPI = class {
1493
1552
  };
1494
1553
 
1495
1554
  // src/api/web.ts
1555
+ init_esm_shims();
1496
1556
  var WebAPI = class {
1497
1557
  constructor(client) {
1498
1558
  this.client = client;
@@ -1606,6 +1666,7 @@ var WebAPI = class {
1606
1666
  };
1607
1667
 
1608
1668
  // src/api/permissions.ts
1669
+ init_esm_shims();
1609
1670
  var PermissionsAPI = class {
1610
1671
  constructor(client) {
1611
1672
  this.client = client;
@@ -1647,11 +1708,11 @@ var PermissionsAPI = class {
1647
1708
  * @param operation The operation type ("read" or "write")
1648
1709
  * @returns Promise<boolean> indicating if permission is granted
1649
1710
  */
1650
- async checkFilesystemAsync(path, operation) {
1711
+ async checkFilesystemAsync(path2, operation) {
1651
1712
  const response = await this.client.request(
1652
1713
  PERMISSIONS_COMMANDS.checkFilesystem,
1653
1714
  {
1654
- path,
1715
+ path: path2,
1655
1716
  operation
1656
1717
  }
1657
1718
  );
@@ -1660,6 +1721,7 @@ var PermissionsAPI = class {
1660
1721
  };
1661
1722
 
1662
1723
  // src/api/remoteStorage.ts
1724
+ init_esm_shims();
1663
1725
  init_vaultKey();
1664
1726
  var RemoteStorageAPI = class {
1665
1727
  constructor(client) {
@@ -1770,6 +1832,7 @@ var BackendManagement = class {
1770
1832
  };
1771
1833
 
1772
1834
  // src/api/localsend.ts
1835
+ init_esm_shims();
1773
1836
  var LOCALSEND_EVENTS = {
1774
1837
  /** New device discovered */
1775
1838
  deviceDiscovered: "localsend:device-discovered",
@@ -1941,6 +2004,7 @@ var LocalSendAPI = class {
1941
2004
  };
1942
2005
 
1943
2006
  // src/api/spaces.ts
2007
+ init_esm_shims();
1944
2008
  var SpacesAPI = class {
1945
2009
  constructor(client) {
1946
2010
  this.client = client;
@@ -2013,6 +2077,7 @@ var SpacesAPI = class {
2013
2077
  };
2014
2078
 
2015
2079
  // src/api/shell.ts
2080
+ init_esm_shims();
2016
2081
  var ShellAPI = class {
2017
2082
  constructor(sdk) {
2018
2083
  this.sdk = sdk;
@@ -2084,6 +2149,7 @@ var ShellAPI = class {
2084
2149
  };
2085
2150
 
2086
2151
  // src/api/passwords.ts
2152
+ init_esm_shims();
2087
2153
  var PasswordsAPI = class {
2088
2154
  constructor(client) {
2089
2155
  this.client = client;
@@ -2129,6 +2195,7 @@ var PasswordsAPI = class {
2129
2195
  };
2130
2196
 
2131
2197
  // src/api/mail.ts
2198
+ init_esm_shims();
2132
2199
  var MailAPI = class {
2133
2200
  constructor(client) {
2134
2201
  this.client = client;
@@ -2268,6 +2335,7 @@ var MailAPI = class {
2268
2335
  };
2269
2336
 
2270
2337
  // src/api/notifications.ts
2338
+ init_esm_shims();
2271
2339
  var NotificationsAPI = class {
2272
2340
  constructor(client) {
2273
2341
  this.client = client;
@@ -2299,7 +2367,36 @@ var NotificationsAPI = class {
2299
2367
  }
2300
2368
  };
2301
2369
 
2370
+ // src/api/tab.ts
2371
+ init_esm_shims();
2372
+ var TabAPI = class {
2373
+ constructor(client) {
2374
+ this.client = client;
2375
+ }
2376
+ /**
2377
+ * Mark the tab as wanting the user's attention (`true`), e.g. for unread
2378
+ * content, or clear the mark (`false`).
2379
+ */
2380
+ async requestAttention(active) {
2381
+ await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
2382
+ }
2383
+ };
2384
+
2385
+ // src/api/dialog.ts
2386
+ init_esm_shims();
2387
+ var DialogAPI = class {
2388
+ constructor(client) {
2389
+ this.client = client;
2390
+ }
2391
+ /** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
2392
+ async confirm(options) {
2393
+ const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
2394
+ return answer === true;
2395
+ }
2396
+ };
2397
+
2302
2398
  // src/client/tableName.ts
2399
+ init_esm_shims();
2303
2400
  function validatePublicKey(publicKey) {
2304
2401
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
2305
2402
  throw new HaexVaultSdkError(
@@ -2385,6 +2482,7 @@ function parseTableName(fullTableName) {
2385
2482
  }
2386
2483
 
2387
2484
  // src/client/init.ts
2485
+ init_esm_shims();
2388
2486
  var PORT_HANDSHAKE_TIMEOUT_MS = 1e4;
2389
2487
  function getCurrentWebviewLabel() {
2390
2488
  const internals = window.__TAURI_INTERNALS__;
@@ -2476,8 +2574,8 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
2476
2574
  data: { tables: payload.tables }
2477
2575
  }));
2478
2576
  await forwardEvent(listen, log, onEvent, listenOptions, HAEXTENSION_EVENTS.FILE_CHANGED, (payload) => {
2479
- const { ruleId, changeType, path } = payload;
2480
- return { ruleId, changeType, path };
2577
+ const { ruleId, changeType, path: path2 } = payload;
2578
+ return { ruleId, changeType, path: path2 };
2481
2579
  });
2482
2580
  await forwardEvent(listen, log, onEvent, listenOptions, SHELL_EVENTS.OUTPUT, (payload) => {
2483
2581
  const { sessionId, data } = payload;
@@ -2533,6 +2631,10 @@ function waitForHostPortAsync(log) {
2533
2631
  const handler = (event) => {
2534
2632
  const type = event.data?.type;
2535
2633
  if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
2634
+ if (event.source !== window.parent) {
2635
+ log("PORT_INIT from a window other than the parent \u2014 ignoring");
2636
+ return;
2637
+ }
2536
2638
  const port = event.ports[0];
2537
2639
  if (!port) {
2538
2640
  log("PORT_INIT received but event.ports is empty \u2014 ignoring");
@@ -2566,10 +2668,11 @@ postMessage error: ${e}`);
2566
2668
  }
2567
2669
 
2568
2670
  // src/client/transport.ts
2671
+ init_esm_shims();
2569
2672
  function generateRequestId(counter) {
2570
2673
  return `req_${counter}`;
2571
2674
  }
2572
- function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
2675
+ function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
2573
2676
  if (!port) {
2574
2677
  return Promise.reject(
2575
2678
  new HaexVaultSdkError(
@@ -2584,14 +2687,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
2584
2687
  timestamp: Date.now()
2585
2688
  };
2586
2689
  return new Promise((resolve, reject) => {
2587
- const timeout = setTimeout(() => {
2690
+ const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
2588
2691
  pendingRequests.delete(requestId);
2589
2692
  reject(
2590
2693
  new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
2591
- timeout: config.timeout
2694
+ timeout: timeoutMs
2592
2695
  })
2593
2696
  );
2594
- }, config.timeout);
2697
+ }, timeoutMs);
2595
2698
  pendingRequests.set(requestId, { resolve, reject, timeout });
2596
2699
  if (config.debug) {
2597
2700
  console.log("[SDK Debug] ========== Sending Request ==========");
@@ -2617,6 +2720,7 @@ async function sendInvoke(method, params, config, _log) {
2617
2720
  }
2618
2721
 
2619
2722
  // src/client/events.ts
2723
+ init_esm_shims();
2620
2724
  function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
2621
2725
  return (event) => {
2622
2726
  if (config.debug) {
@@ -2716,6 +2820,9 @@ function removeEventListener(eventType, callback, eventListeners) {
2716
2820
  function notifySubscribers(subscribers) {
2717
2821
  subscribers.forEach((callback) => callback());
2718
2822
  }
2823
+
2824
+ // src/client/database.ts
2825
+ init_esm_shims();
2719
2826
  function createDrizzleInstance(schema, extensionInfo, request, log) {
2720
2827
  if (!extensionInfo) {
2721
2828
  throw new HaexVaultSdkError(
@@ -2784,6 +2891,7 @@ async function executeRaw(sql, params, request) {
2784
2891
  }
2785
2892
 
2786
2893
  // src/client/external.ts
2894
+ init_esm_shims();
2787
2895
  function registerExternalHandler(action, handler, handlers, log) {
2788
2896
  handlers.set(action, handler);
2789
2897
  log(`[ExternalRequest] Registered handler for action: ${action}`);
@@ -2825,12 +2933,14 @@ async function respondToExternalRequest(response, request) {
2825
2933
  }
2826
2934
 
2827
2935
  // src/commands/ai.ts
2936
+ init_esm_shims();
2828
2937
  var AI_COMMANDS = {
2829
2938
  /** Respond to an AI action request */
2830
2939
  actionRespond: "ai_action_respond"
2831
2940
  };
2832
2941
 
2833
2942
  // src/client/permissionRetry.ts
2943
+ init_esm_shims();
2834
2944
  var PERMISSION_DECISION_TIMEOUT_MS = 5 * 60 * 1e3;
2835
2945
  var MAX_PERMISSION_RETRIES = 3;
2836
2946
  function permissionKey(resourceType, action, target) {
@@ -2944,6 +3054,8 @@ var HaexVaultSdk = class {
2944
3054
  this.passwords = new PasswordsAPI(this);
2945
3055
  this.mail = new MailAPI(this);
2946
3056
  this.notifications = new NotificationsAPI(this);
3057
+ this.tab = new TabAPI(this);
3058
+ this.dialog = new DialogAPI(this);
2947
3059
  installConsoleForwarding(this.config.debug);
2948
3060
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2949
3061
  const data = event.data;
@@ -3099,7 +3211,7 @@ var HaexVaultSdk = class {
3099
3211
  // ==========================================================================
3100
3212
  // Communication
3101
3213
  // ==========================================================================
3102
- async request(method, params) {
3214
+ async request(method, params, options) {
3103
3215
  const resolvedParams = params ?? {};
3104
3216
  const send = () => {
3105
3217
  if (this.isNativeWindow && hasTauri()) {
@@ -3118,7 +3230,8 @@ var HaexVaultSdk = class {
3118
3230
  this.config,
3119
3231
  this._extensionInfo,
3120
3232
  this.pendingRequests,
3121
- this.hostPort
3233
+ this.hostPort,
3234
+ options?.timeout
3122
3235
  );
3123
3236
  };
3124
3237
  return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
@@ -3296,6 +3409,7 @@ var HaexVaultSdk = class {
3296
3409
  };
3297
3410
 
3298
3411
  // src/types/external.ts
3412
+ init_esm_shims();
3299
3413
  var ExternalConnectionState = /* @__PURE__ */ ((ExternalConnectionState2) => {
3300
3414
  ExternalConnectionState2["DISCONNECTED"] = "disconnected";
3301
3415
  ExternalConnectionState2["CONNECTING"] = "connecting";
@@ -3323,107 +3437,15 @@ function canExternalClientSendRequests(state) {
3323
3437
  return state === "paired" /* PAIRED */;
3324
3438
  }
3325
3439
 
3326
- // src/crypto/verify.ts
3327
- function sortObjectKeysRecursively(obj) {
3328
- if (typeof obj !== "object" || obj === null) {
3329
- return obj;
3330
- }
3331
- if (Array.isArray(obj)) {
3332
- return obj.map((item) => sortObjectKeysRecursively(item));
3333
- }
3334
- return Object.keys(obj).sort().reduce((result, key) => {
3335
- result[key] = sortObjectKeysRecursively(obj[key]);
3336
- return result;
3337
- }, {});
3338
- }
3339
- function hexToBytes(hex) {
3340
- const bytes = new Uint8Array(hex.length / 2);
3341
- for (let i = 0; i < hex.length; i += 2) {
3342
- bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
3343
- }
3344
- return bytes.buffer;
3345
- }
3346
- async function verifyExtensionSignature(files, manifest) {
3347
- try {
3348
- if (typeof crypto === "undefined" || !crypto.subtle) {
3349
- return { valid: false, error: "WebCrypto API not available" };
3350
- }
3351
- const { publicKey: publicKeyHex, signature: signatureHex } = manifest;
3352
- if (!publicKeyHex) {
3353
- return { valid: false, error: "Missing publicKey in manifest" };
3354
- }
3355
- if (!signatureHex) {
3356
- return { valid: false, error: "Missing signature in manifest" };
3357
- }
3358
- if (!/^[0-9a-fA-F]+$/.test(publicKeyHex)) {
3359
- return { valid: false, error: "Invalid publicKey format (must be hex)" };
3360
- }
3361
- if (!/^[0-9a-fA-F]+$/.test(signatureHex)) {
3362
- return { valid: false, error: "Invalid signature format (must be hex)" };
3363
- }
3364
- const publicKeyBuffer = hexToBytes(publicKeyHex);
3365
- let publicKey;
3366
- try {
3367
- publicKey = await crypto.subtle.importKey(
3368
- "raw",
3369
- publicKeyBuffer,
3370
- { name: "Ed25519", namedCurve: "Ed25519" },
3371
- false,
3372
- ["verify"]
3373
- );
3374
- } catch (err) {
3375
- return {
3376
- valid: false,
3377
- error: `Failed to import public key: ${err instanceof Error ? err.message : "Ed25519 may not be supported in this browser"}`
3378
- };
3379
- }
3380
- const manifestForHashing = sortObjectKeysRecursively({
3381
- ...manifest,
3382
- signature: ""
3383
- });
3384
- const manifestJson = JSON.stringify(manifestForHashing, null, 2);
3385
- const manifestBytes = new TextEncoder().encode(manifestJson);
3386
- const filesForHashing = files.map((file) => {
3387
- if (file.path === "haextension/manifest.json") {
3388
- return { path: file.path, content: manifestBytes };
3389
- }
3390
- return file;
3391
- });
3392
- filesForHashing.sort((a, b) => {
3393
- if (a.path < b.path) return -1;
3394
- if (a.path > b.path) return 1;
3395
- return 0;
3396
- });
3397
- const totalLength = filesForHashing.reduce((sum, f) => sum + f.content.length, 0);
3398
- const combined = new Uint8Array(totalLength);
3399
- let offset = 0;
3400
- for (const file of filesForHashing) {
3401
- combined.set(file.content, offset);
3402
- offset += file.content.length;
3403
- }
3404
- const hashBuffer = await crypto.subtle.digest("SHA-256", combined);
3405
- const signatureBuffer = hexToBytes(signatureHex);
3406
- const isValid = await crypto.subtle.verify(
3407
- "Ed25519",
3408
- publicKey,
3409
- signatureBuffer,
3410
- hashBuffer
3411
- );
3412
- return { valid: isValid };
3413
- } catch (err) {
3414
- console.error("Signature verification error:", err);
3415
- return {
3416
- valid: false,
3417
- error: err instanceof Error ? err.message : "Unknown verification error"
3418
- };
3419
- }
3420
- }
3440
+ // src/types/spaces.ts
3441
+ init_esm_shims();
3421
3442
 
3422
3443
  // src/index.ts
3423
3444
  init_vaultKey();
3424
3445
  init_userKeypair();
3425
3446
 
3426
3447
  // src/crypto/didKey.ts
3448
+ init_esm_shims();
3427
3449
  init_userKeypair();
3428
3450
  init_vaultKey();
3429
3451
  var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -3522,6 +3544,7 @@ async function generateIdentityAsync() {
3522
3544
  }
3523
3545
 
3524
3546
  // src/crypto/spaceKey.ts
3547
+ init_esm_shims();
3525
3548
  init_userKeypair();
3526
3549
  init_vaultKey();
3527
3550
  function generateSpaceKey() {
@@ -3612,6 +3635,7 @@ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
3612
3635
  }
3613
3636
 
3614
3637
  // src/crypto/claims.ts
3638
+ init_esm_shims();
3615
3639
  init_userKeypair();
3616
3640
  async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateKeyBase64) {
3617
3641
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
@@ -3648,6 +3672,7 @@ async function verifyClaimPresentationAsync(presentation) {
3648
3672
  }
3649
3673
 
3650
3674
  // src/crypto/recordSigning.ts
3675
+ init_esm_shims();
3651
3676
  init_userKeypair();
3652
3677
  init_vaultKey();
3653
3678
  function canonicalize(record) {
@@ -3712,6 +3737,7 @@ async function verifySpaceChallengeAsync(spaceId, timestamp, signatureBase64, pu
3712
3737
  }
3713
3738
 
3714
3739
  // src/crypto/passkey.ts
3740
+ init_esm_shims();
3715
3741
  init_vaultKey();
3716
3742
  function toArrayBuffer(data) {
3717
3743
  if (data instanceof ArrayBuffer) {
@@ -3882,6 +3908,6 @@ function createHaexVaultSdk(config = {}) {
3882
3908
  return new HaexVaultSdk(config);
3883
3909
  }
3884
3910
 
3885
- export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3911
+ export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, DialogAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, TabAPI, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3886
3912
  //# sourceMappingURL=index.mjs.map
3887
3913
  //# sourceMappingURL=index.mjs.map