@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.
- package/README.md +51 -19
- package/dist/cli/index.js +437 -355
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +428 -339
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-DH4Km77u.d.ts → client-C6pEREPM.d.ts} +48 -3
- package/dist/{client-Dn4AbXbT.d.mts → client-GdCi-m2s.d.mts} +48 -3
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +11 -59
- package/dist/index.d.ts +11 -59
- package/dist/index.js +130 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -123
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +53 -2
- package/dist/node.d.ts +53 -2
- package/dist/node.js +319 -2
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +320 -5
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +7 -5
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +3 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +137 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +157 -27
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +45 -7
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +45 -7
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +137 -7
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +157 -27
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-DQZCRfC-.d.mts → types-Ba4G6ZpC.d.mts} +10 -2
- package/dist/{types-DQZCRfC-.d.ts → types-Ba4G6ZpC.d.ts} +10 -2
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +137 -7
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +157 -27
- package/dist/vue.mjs.map +1 -1
- package/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -12,6 +12,12 @@ var __export = (target, all) => {
|
|
|
12
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
13
|
};
|
|
14
14
|
|
|
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/cjs_shims.js
|
|
16
|
+
var init_cjs_shims = __esm({
|
|
17
|
+
"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/cjs_shims.js"() {
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
15
21
|
// src/crypto/vaultKey.ts
|
|
16
22
|
async function deriveKeyFromPassword(password, salt) {
|
|
17
23
|
const encoder = new TextEncoder();
|
|
@@ -229,6 +235,7 @@ function base64ToArrayBuffer(base64) {
|
|
|
229
235
|
var PBKDF2_ITERATIONS, KEY_LENGTH, ALGORITHM;
|
|
230
236
|
var init_vaultKey = __esm({
|
|
231
237
|
"src/crypto/vaultKey.ts"() {
|
|
238
|
+
init_cjs_shims();
|
|
232
239
|
PBKDF2_ITERATIONS = 6e5;
|
|
233
240
|
KEY_LENGTH = 256;
|
|
234
241
|
ALGORITHM = "AES-GCM";
|
|
@@ -312,13 +319,21 @@ async function decryptPrivateKeyAsync(encryptedPrivateKey, nonce, salt, password
|
|
|
312
319
|
exports.SIGNING_ALGO = void 0; exports.KEY_AGREEMENT_ALGO = void 0;
|
|
313
320
|
var init_userKeypair = __esm({
|
|
314
321
|
"src/crypto/userKeypair.ts"() {
|
|
322
|
+
init_cjs_shims();
|
|
315
323
|
init_vaultKey();
|
|
316
324
|
exports.SIGNING_ALGO = { name: "Ed25519" };
|
|
317
325
|
exports.KEY_AGREEMENT_ALGO = { name: "X25519" };
|
|
318
326
|
}
|
|
319
327
|
});
|
|
320
328
|
|
|
329
|
+
// src/index.ts
|
|
330
|
+
init_cjs_shims();
|
|
331
|
+
|
|
332
|
+
// src/polyfills/index.ts
|
|
333
|
+
init_cjs_shims();
|
|
334
|
+
|
|
321
335
|
// src/polyfills/localStorage.ts
|
|
336
|
+
init_cjs_shims();
|
|
322
337
|
function installLocalStoragePolyfill() {
|
|
323
338
|
if (typeof window === "undefined") {
|
|
324
339
|
return;
|
|
@@ -413,6 +428,7 @@ function installSessionStoragePolyfill() {
|
|
|
413
428
|
}
|
|
414
429
|
|
|
415
430
|
// src/polyfills/cookies.ts
|
|
431
|
+
init_cjs_shims();
|
|
416
432
|
function installCookiePolyfill() {
|
|
417
433
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
418
434
|
return;
|
|
@@ -473,6 +489,7 @@ function installCookiePolyfill() {
|
|
|
473
489
|
}
|
|
474
490
|
|
|
475
491
|
// src/polyfills/history.ts
|
|
492
|
+
init_cjs_shims();
|
|
476
493
|
function installHistoryPolyfill() {
|
|
477
494
|
if (typeof window === "undefined" || typeof history === "undefined") {
|
|
478
495
|
return;
|
|
@@ -536,7 +553,11 @@ function installHistoryPolyfill() {
|
|
|
536
553
|
}
|
|
537
554
|
}
|
|
538
555
|
|
|
556
|
+
// src/polyfills/debug.ts
|
|
557
|
+
init_cjs_shims();
|
|
558
|
+
|
|
539
559
|
// src/messages.ts
|
|
560
|
+
init_cjs_shims();
|
|
540
561
|
var HAEXSPACE_MESSAGE_TYPES = {
|
|
541
562
|
/** Debug message for development/troubleshooting */
|
|
542
563
|
DEBUG: "haexspace:debug",
|
|
@@ -581,6 +602,7 @@ function installDebugDiagnostics() {
|
|
|
581
602
|
}
|
|
582
603
|
|
|
583
604
|
// src/polyfills/baseTag.ts
|
|
605
|
+
init_cjs_shims();
|
|
584
606
|
function installBaseTag() {
|
|
585
607
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
586
608
|
return;
|
|
@@ -622,6 +644,7 @@ function installBaseTag() {
|
|
|
622
644
|
}
|
|
623
645
|
|
|
624
646
|
// src/polyfills/consoleForwarding.ts
|
|
647
|
+
init_cjs_shims();
|
|
625
648
|
var originalConsole = {
|
|
626
649
|
log: console.log,
|
|
627
650
|
info: console.info,
|
|
@@ -702,7 +725,14 @@ if (typeof window !== "undefined") {
|
|
|
702
725
|
installPolyfills();
|
|
703
726
|
}
|
|
704
727
|
|
|
728
|
+
// src/client.ts
|
|
729
|
+
init_cjs_shims();
|
|
730
|
+
|
|
731
|
+
// src/types.ts
|
|
732
|
+
init_cjs_shims();
|
|
733
|
+
|
|
705
734
|
// src/events.ts
|
|
735
|
+
init_cjs_shims();
|
|
706
736
|
var HAEXTENSION_EVENTS = {
|
|
707
737
|
/** Context (theme, locale, platform) has changed */
|
|
708
738
|
CONTEXT_CHANGED: "haextension:context:changed",
|
|
@@ -817,7 +847,17 @@ var HaexVaultSdkError = class extends Error {
|
|
|
817
847
|
}
|
|
818
848
|
};
|
|
819
849
|
|
|
850
|
+
// src/api/storage.ts
|
|
851
|
+
init_cjs_shims();
|
|
852
|
+
|
|
853
|
+
// src/commands.ts
|
|
854
|
+
init_cjs_shims();
|
|
855
|
+
|
|
856
|
+
// src/commands/index.ts
|
|
857
|
+
init_cjs_shims();
|
|
858
|
+
|
|
820
859
|
// src/commands/database.ts
|
|
860
|
+
init_cjs_shims();
|
|
821
861
|
var DATABASE_COMMANDS = {
|
|
822
862
|
/** Execute a SELECT query */
|
|
823
863
|
query: "extension_database_query",
|
|
@@ -830,6 +870,7 @@ var DATABASE_COMMANDS = {
|
|
|
830
870
|
};
|
|
831
871
|
|
|
832
872
|
// src/commands/permissions.ts
|
|
873
|
+
init_cjs_shims();
|
|
833
874
|
var PERMISSIONS_COMMANDS = {
|
|
834
875
|
/** Check web/fetch permission */
|
|
835
876
|
checkWeb: "extension_permissions_check_web",
|
|
@@ -840,6 +881,7 @@ var PERMISSIONS_COMMANDS = {
|
|
|
840
881
|
};
|
|
841
882
|
|
|
842
883
|
// src/commands/web.ts
|
|
884
|
+
init_cjs_shims();
|
|
843
885
|
var WEB_COMMANDS = {
|
|
844
886
|
/** Open URL in external browser */
|
|
845
887
|
open: "extension_web_open",
|
|
@@ -848,6 +890,7 @@ var WEB_COMMANDS = {
|
|
|
848
890
|
};
|
|
849
891
|
|
|
850
892
|
// src/commands/webStorage.ts
|
|
893
|
+
init_cjs_shims();
|
|
851
894
|
var WEB_STORAGE_COMMANDS = {
|
|
852
895
|
/** Get item from storage */
|
|
853
896
|
getItem: "extension_web_storage_get_item",
|
|
@@ -862,6 +905,7 @@ var WEB_STORAGE_COMMANDS = {
|
|
|
862
905
|
};
|
|
863
906
|
|
|
864
907
|
// src/commands/filesystem.ts
|
|
908
|
+
init_cjs_shims();
|
|
865
909
|
var FILESYSTEM_COMMANDS = {
|
|
866
910
|
// Dialog commands
|
|
867
911
|
/** Show save file dialog */
|
|
@@ -905,6 +949,7 @@ var FILESYSTEM_COMMANDS = {
|
|
|
905
949
|
};
|
|
906
950
|
|
|
907
951
|
// src/commands/externalBridge.ts
|
|
952
|
+
init_cjs_shims();
|
|
908
953
|
var EXTERNAL_BRIDGE_COMMANDS = {
|
|
909
954
|
// Response handling (called by extensions)
|
|
910
955
|
/** Respond to an external request */
|
|
@@ -944,6 +989,7 @@ var EXTERNAL_BRIDGE_COMMANDS = {
|
|
|
944
989
|
};
|
|
945
990
|
|
|
946
991
|
// src/commands/extension.ts
|
|
992
|
+
init_cjs_shims();
|
|
947
993
|
var EXTENSION_COMMANDS = {
|
|
948
994
|
/** Get extension info (manifest, id, etc.) */
|
|
949
995
|
getInfo: "extension_get_info",
|
|
@@ -958,10 +1004,15 @@ var EXTENSION_COMMANDS = {
|
|
|
958
1004
|
/** Filter sync tables by extension permissions (returns filtered map) */
|
|
959
1005
|
filterSyncTables: "extension_filter_sync_tables",
|
|
960
1006
|
/** Emit sync tables to webviews (host-only, desktop only) */
|
|
961
|
-
emitSyncTables: "extension_emit_sync_tables"
|
|
1007
|
+
emitSyncTables: "extension_emit_sync_tables",
|
|
1008
|
+
/** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
|
|
1009
|
+
tabAttention: "extension_tab_attention",
|
|
1010
|
+
/** Ask the user to confirm, in a dialog the host draws over this extension's tab */
|
|
1011
|
+
dialogConfirm: "extension_dialog_confirm"
|
|
962
1012
|
};
|
|
963
1013
|
|
|
964
1014
|
// src/commands/remoteStorage.ts
|
|
1015
|
+
init_cjs_shims();
|
|
965
1016
|
var REMOTE_STORAGE_COMMANDS = {
|
|
966
1017
|
// Backend Management
|
|
967
1018
|
/** List all storage backends */
|
|
@@ -986,6 +1037,7 @@ var REMOTE_STORAGE_COMMANDS = {
|
|
|
986
1037
|
};
|
|
987
1038
|
|
|
988
1039
|
// src/commands/localsend.ts
|
|
1040
|
+
init_cjs_shims();
|
|
989
1041
|
var LOCALSEND_COMMANDS = {
|
|
990
1042
|
// Initialization
|
|
991
1043
|
/** Initialize LocalSend (generate identity, etc.) */
|
|
@@ -1032,6 +1084,7 @@ var LOCALSEND_COMMANDS = {
|
|
|
1032
1084
|
};
|
|
1033
1085
|
|
|
1034
1086
|
// src/commands/spaces.ts
|
|
1087
|
+
init_cjs_shims();
|
|
1035
1088
|
var SPACE_COMMANDS = {
|
|
1036
1089
|
/** Bulk assign rows to spaces */
|
|
1037
1090
|
assign: "extension_space_assign",
|
|
@@ -1050,6 +1103,7 @@ var SPACE_COMMANDS = {
|
|
|
1050
1103
|
};
|
|
1051
1104
|
|
|
1052
1105
|
// src/commands/shell.ts
|
|
1106
|
+
init_cjs_shims();
|
|
1053
1107
|
var SHELL_COMMANDS = {
|
|
1054
1108
|
/** List available shell environments (no permission required) */
|
|
1055
1109
|
listAvailable: "extension_shell_list_available",
|
|
@@ -1064,6 +1118,7 @@ var SHELL_COMMANDS = {
|
|
|
1064
1118
|
};
|
|
1065
1119
|
|
|
1066
1120
|
// src/commands/passwords.ts
|
|
1121
|
+
init_cjs_shims();
|
|
1067
1122
|
var PASSWORD_COMMANDS = {
|
|
1068
1123
|
/** List items (no secrets) within the extension's tag scope */
|
|
1069
1124
|
list: "extension_password_list",
|
|
@@ -1078,6 +1133,7 @@ var PASSWORD_COMMANDS = {
|
|
|
1078
1133
|
};
|
|
1079
1134
|
|
|
1080
1135
|
// src/commands/mail.ts
|
|
1136
|
+
init_cjs_shims();
|
|
1081
1137
|
var MAIL_COMMANDS = {
|
|
1082
1138
|
/** LIST mailboxes + optional STATUS counts */
|
|
1083
1139
|
listMailboxes: "extension_mail_list_mailboxes",
|
|
@@ -1104,6 +1160,7 @@ var MAIL_COMMANDS = {
|
|
|
1104
1160
|
};
|
|
1105
1161
|
|
|
1106
1162
|
// src/commands/notifications.ts
|
|
1163
|
+
init_cjs_shims();
|
|
1107
1164
|
var NOTIFICATION_COMMANDS = {
|
|
1108
1165
|
/** Show an OS notification. Returns the assigned notification id. */
|
|
1109
1166
|
show: "extension_notifications_show",
|
|
@@ -1152,6 +1209,7 @@ var StorageAPI = class {
|
|
|
1152
1209
|
};
|
|
1153
1210
|
|
|
1154
1211
|
// src/api/database.ts
|
|
1212
|
+
init_cjs_shims();
|
|
1155
1213
|
function quoteIdent(identifier) {
|
|
1156
1214
|
if (identifier.startsWith('"') && identifier.endsWith('"')) {
|
|
1157
1215
|
return identifier;
|
|
@@ -1251,6 +1309,7 @@ var DatabaseAPI = class {
|
|
|
1251
1309
|
};
|
|
1252
1310
|
|
|
1253
1311
|
// src/api/filesystem.ts
|
|
1312
|
+
init_cjs_shims();
|
|
1254
1313
|
init_vaultKey();
|
|
1255
1314
|
var KnownPath = /* @__PURE__ */ ((KnownPath2) => {
|
|
1256
1315
|
KnownPath2["Home"] = "home";
|
|
@@ -1495,6 +1554,7 @@ var FilesystemAPI = class {
|
|
|
1495
1554
|
};
|
|
1496
1555
|
|
|
1497
1556
|
// src/api/web.ts
|
|
1557
|
+
init_cjs_shims();
|
|
1498
1558
|
var WebAPI = class {
|
|
1499
1559
|
constructor(client) {
|
|
1500
1560
|
this.client = client;
|
|
@@ -1608,6 +1668,7 @@ var WebAPI = class {
|
|
|
1608
1668
|
};
|
|
1609
1669
|
|
|
1610
1670
|
// src/api/permissions.ts
|
|
1671
|
+
init_cjs_shims();
|
|
1611
1672
|
var PermissionsAPI = class {
|
|
1612
1673
|
constructor(client) {
|
|
1613
1674
|
this.client = client;
|
|
@@ -1662,6 +1723,7 @@ var PermissionsAPI = class {
|
|
|
1662
1723
|
};
|
|
1663
1724
|
|
|
1664
1725
|
// src/api/remoteStorage.ts
|
|
1726
|
+
init_cjs_shims();
|
|
1665
1727
|
init_vaultKey();
|
|
1666
1728
|
var RemoteStorageAPI = class {
|
|
1667
1729
|
constructor(client) {
|
|
@@ -1772,6 +1834,7 @@ var BackendManagement = class {
|
|
|
1772
1834
|
};
|
|
1773
1835
|
|
|
1774
1836
|
// src/api/localsend.ts
|
|
1837
|
+
init_cjs_shims();
|
|
1775
1838
|
var LOCALSEND_EVENTS = {
|
|
1776
1839
|
/** New device discovered */
|
|
1777
1840
|
deviceDiscovered: "localsend:device-discovered",
|
|
@@ -1943,6 +2006,7 @@ var LocalSendAPI = class {
|
|
|
1943
2006
|
};
|
|
1944
2007
|
|
|
1945
2008
|
// src/api/spaces.ts
|
|
2009
|
+
init_cjs_shims();
|
|
1946
2010
|
var SpacesAPI = class {
|
|
1947
2011
|
constructor(client) {
|
|
1948
2012
|
this.client = client;
|
|
@@ -2015,6 +2079,7 @@ var SpacesAPI = class {
|
|
|
2015
2079
|
};
|
|
2016
2080
|
|
|
2017
2081
|
// src/api/shell.ts
|
|
2082
|
+
init_cjs_shims();
|
|
2018
2083
|
var ShellAPI = class {
|
|
2019
2084
|
constructor(sdk) {
|
|
2020
2085
|
this.sdk = sdk;
|
|
@@ -2086,6 +2151,7 @@ var ShellAPI = class {
|
|
|
2086
2151
|
};
|
|
2087
2152
|
|
|
2088
2153
|
// src/api/passwords.ts
|
|
2154
|
+
init_cjs_shims();
|
|
2089
2155
|
var PasswordsAPI = class {
|
|
2090
2156
|
constructor(client) {
|
|
2091
2157
|
this.client = client;
|
|
@@ -2131,6 +2197,7 @@ var PasswordsAPI = class {
|
|
|
2131
2197
|
};
|
|
2132
2198
|
|
|
2133
2199
|
// src/api/mail.ts
|
|
2200
|
+
init_cjs_shims();
|
|
2134
2201
|
var MailAPI = class {
|
|
2135
2202
|
constructor(client) {
|
|
2136
2203
|
this.client = client;
|
|
@@ -2270,6 +2337,7 @@ var MailAPI = class {
|
|
|
2270
2337
|
};
|
|
2271
2338
|
|
|
2272
2339
|
// src/api/notifications.ts
|
|
2340
|
+
init_cjs_shims();
|
|
2273
2341
|
var NotificationsAPI = class {
|
|
2274
2342
|
constructor(client) {
|
|
2275
2343
|
this.client = client;
|
|
@@ -2301,7 +2369,36 @@ var NotificationsAPI = class {
|
|
|
2301
2369
|
}
|
|
2302
2370
|
};
|
|
2303
2371
|
|
|
2372
|
+
// src/api/tab.ts
|
|
2373
|
+
init_cjs_shims();
|
|
2374
|
+
var TabAPI = class {
|
|
2375
|
+
constructor(client) {
|
|
2376
|
+
this.client = client;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Mark the tab as wanting the user's attention (`true`), e.g. for unread
|
|
2380
|
+
* content, or clear the mark (`false`).
|
|
2381
|
+
*/
|
|
2382
|
+
async requestAttention(active) {
|
|
2383
|
+
await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2387
|
+
// src/api/dialog.ts
|
|
2388
|
+
init_cjs_shims();
|
|
2389
|
+
var DialogAPI = class {
|
|
2390
|
+
constructor(client) {
|
|
2391
|
+
this.client = client;
|
|
2392
|
+
}
|
|
2393
|
+
/** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
|
|
2394
|
+
async confirm(options) {
|
|
2395
|
+
const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
|
|
2396
|
+
return answer === true;
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
|
|
2304
2400
|
// src/client/tableName.ts
|
|
2401
|
+
init_cjs_shims();
|
|
2305
2402
|
function validatePublicKey(publicKey) {
|
|
2306
2403
|
if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
|
|
2307
2404
|
throw new HaexVaultSdkError(
|
|
@@ -2387,6 +2484,7 @@ function parseTableName(fullTableName) {
|
|
|
2387
2484
|
}
|
|
2388
2485
|
|
|
2389
2486
|
// src/client/init.ts
|
|
2487
|
+
init_cjs_shims();
|
|
2390
2488
|
var PORT_HANDSHAKE_TIMEOUT_MS = 1e4;
|
|
2391
2489
|
function getCurrentWebviewLabel() {
|
|
2392
2490
|
const internals = window.__TAURI_INTERNALS__;
|
|
@@ -2535,6 +2633,10 @@ function waitForHostPortAsync(log) {
|
|
|
2535
2633
|
const handler = (event) => {
|
|
2536
2634
|
const type = event.data?.type;
|
|
2537
2635
|
if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
|
|
2636
|
+
if (event.source !== window.parent) {
|
|
2637
|
+
log("PORT_INIT from a window other than the parent \u2014 ignoring");
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2538
2640
|
const port = event.ports[0];
|
|
2539
2641
|
if (!port) {
|
|
2540
2642
|
log("PORT_INIT received but event.ports is empty \u2014 ignoring");
|
|
@@ -2568,10 +2670,11 @@ postMessage error: ${e}`);
|
|
|
2568
2670
|
}
|
|
2569
2671
|
|
|
2570
2672
|
// src/client/transport.ts
|
|
2673
|
+
init_cjs_shims();
|
|
2571
2674
|
function generateRequestId(counter) {
|
|
2572
2675
|
return `req_${counter}`;
|
|
2573
2676
|
}
|
|
2574
|
-
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
|
|
2677
|
+
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
|
|
2575
2678
|
if (!port) {
|
|
2576
2679
|
return Promise.reject(
|
|
2577
2680
|
new HaexVaultSdkError(
|
|
@@ -2586,14 +2689,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
|
|
|
2586
2689
|
timestamp: Date.now()
|
|
2587
2690
|
};
|
|
2588
2691
|
return new Promise((resolve, reject) => {
|
|
2589
|
-
const timeout = setTimeout(() => {
|
|
2692
|
+
const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
|
|
2590
2693
|
pendingRequests.delete(requestId);
|
|
2591
2694
|
reject(
|
|
2592
2695
|
new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
|
|
2593
|
-
timeout:
|
|
2696
|
+
timeout: timeoutMs
|
|
2594
2697
|
})
|
|
2595
2698
|
);
|
|
2596
|
-
},
|
|
2699
|
+
}, timeoutMs);
|
|
2597
2700
|
pendingRequests.set(requestId, { resolve, reject, timeout });
|
|
2598
2701
|
if (config.debug) {
|
|
2599
2702
|
console.log("[SDK Debug] ========== Sending Request ==========");
|
|
@@ -2619,6 +2722,7 @@ async function sendInvoke(method, params, config, _log) {
|
|
|
2619
2722
|
}
|
|
2620
2723
|
|
|
2621
2724
|
// src/client/events.ts
|
|
2725
|
+
init_cjs_shims();
|
|
2622
2726
|
function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
|
|
2623
2727
|
return (event) => {
|
|
2624
2728
|
if (config.debug) {
|
|
@@ -2718,6 +2822,9 @@ function removeEventListener(eventType, callback, eventListeners) {
|
|
|
2718
2822
|
function notifySubscribers(subscribers) {
|
|
2719
2823
|
subscribers.forEach((callback) => callback());
|
|
2720
2824
|
}
|
|
2825
|
+
|
|
2826
|
+
// src/client/database.ts
|
|
2827
|
+
init_cjs_shims();
|
|
2721
2828
|
function createDrizzleInstance(schema, extensionInfo, request, log) {
|
|
2722
2829
|
if (!extensionInfo) {
|
|
2723
2830
|
throw new HaexVaultSdkError(
|
|
@@ -2786,6 +2893,7 @@ async function executeRaw(sql, params, request) {
|
|
|
2786
2893
|
}
|
|
2787
2894
|
|
|
2788
2895
|
// src/client/external.ts
|
|
2896
|
+
init_cjs_shims();
|
|
2789
2897
|
function registerExternalHandler(action, handler, handlers, log) {
|
|
2790
2898
|
handlers.set(action, handler);
|
|
2791
2899
|
log(`[ExternalRequest] Registered handler for action: ${action}`);
|
|
@@ -2827,12 +2935,14 @@ async function respondToExternalRequest(response, request) {
|
|
|
2827
2935
|
}
|
|
2828
2936
|
|
|
2829
2937
|
// src/commands/ai.ts
|
|
2938
|
+
init_cjs_shims();
|
|
2830
2939
|
var AI_COMMANDS = {
|
|
2831
2940
|
/** Respond to an AI action request */
|
|
2832
2941
|
actionRespond: "ai_action_respond"
|
|
2833
2942
|
};
|
|
2834
2943
|
|
|
2835
2944
|
// src/client/permissionRetry.ts
|
|
2945
|
+
init_cjs_shims();
|
|
2836
2946
|
var PERMISSION_DECISION_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
2837
2947
|
var MAX_PERMISSION_RETRIES = 3;
|
|
2838
2948
|
function permissionKey(resourceType, action, target) {
|
|
@@ -2946,6 +3056,8 @@ var HaexVaultSdk = class {
|
|
|
2946
3056
|
this.passwords = new PasswordsAPI(this);
|
|
2947
3057
|
this.mail = new MailAPI(this);
|
|
2948
3058
|
this.notifications = new NotificationsAPI(this);
|
|
3059
|
+
this.tab = new TabAPI(this);
|
|
3060
|
+
this.dialog = new DialogAPI(this);
|
|
2949
3061
|
installConsoleForwarding(this.config.debug);
|
|
2950
3062
|
this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
|
|
2951
3063
|
const data = event.data;
|
|
@@ -3101,7 +3213,7 @@ var HaexVaultSdk = class {
|
|
|
3101
3213
|
// ==========================================================================
|
|
3102
3214
|
// Communication
|
|
3103
3215
|
// ==========================================================================
|
|
3104
|
-
async request(method, params) {
|
|
3216
|
+
async request(method, params, options) {
|
|
3105
3217
|
const resolvedParams = params ?? {};
|
|
3106
3218
|
const send = () => {
|
|
3107
3219
|
if (this.isNativeWindow && hasTauri()) {
|
|
@@ -3120,7 +3232,8 @@ var HaexVaultSdk = class {
|
|
|
3120
3232
|
this.config,
|
|
3121
3233
|
this._extensionInfo,
|
|
3122
3234
|
this.pendingRequests,
|
|
3123
|
-
this.hostPort
|
|
3235
|
+
this.hostPort,
|
|
3236
|
+
options?.timeout
|
|
3124
3237
|
);
|
|
3125
3238
|
};
|
|
3126
3239
|
return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
|
|
@@ -3298,6 +3411,7 @@ var HaexVaultSdk = class {
|
|
|
3298
3411
|
};
|
|
3299
3412
|
|
|
3300
3413
|
// src/types/external.ts
|
|
3414
|
+
init_cjs_shims();
|
|
3301
3415
|
var ExternalConnectionState = /* @__PURE__ */ ((ExternalConnectionState2) => {
|
|
3302
3416
|
ExternalConnectionState2["DISCONNECTED"] = "disconnected";
|
|
3303
3417
|
ExternalConnectionState2["CONNECTING"] = "connecting";
|
|
@@ -3325,107 +3439,15 @@ function canExternalClientSendRequests(state) {
|
|
|
3325
3439
|
return state === "paired" /* PAIRED */;
|
|
3326
3440
|
}
|
|
3327
3441
|
|
|
3328
|
-
// src/
|
|
3329
|
-
|
|
3330
|
-
if (typeof obj !== "object" || obj === null) {
|
|
3331
|
-
return obj;
|
|
3332
|
-
}
|
|
3333
|
-
if (Array.isArray(obj)) {
|
|
3334
|
-
return obj.map((item) => sortObjectKeysRecursively(item));
|
|
3335
|
-
}
|
|
3336
|
-
return Object.keys(obj).sort().reduce((result, key) => {
|
|
3337
|
-
result[key] = sortObjectKeysRecursively(obj[key]);
|
|
3338
|
-
return result;
|
|
3339
|
-
}, {});
|
|
3340
|
-
}
|
|
3341
|
-
function hexToBytes(hex) {
|
|
3342
|
-
const bytes = new Uint8Array(hex.length / 2);
|
|
3343
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
3344
|
-
bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
|
|
3345
|
-
}
|
|
3346
|
-
return bytes.buffer;
|
|
3347
|
-
}
|
|
3348
|
-
async function verifyExtensionSignature(files, manifest) {
|
|
3349
|
-
try {
|
|
3350
|
-
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
3351
|
-
return { valid: false, error: "WebCrypto API not available" };
|
|
3352
|
-
}
|
|
3353
|
-
const { publicKey: publicKeyHex, signature: signatureHex } = manifest;
|
|
3354
|
-
if (!publicKeyHex) {
|
|
3355
|
-
return { valid: false, error: "Missing publicKey in manifest" };
|
|
3356
|
-
}
|
|
3357
|
-
if (!signatureHex) {
|
|
3358
|
-
return { valid: false, error: "Missing signature in manifest" };
|
|
3359
|
-
}
|
|
3360
|
-
if (!/^[0-9a-fA-F]+$/.test(publicKeyHex)) {
|
|
3361
|
-
return { valid: false, error: "Invalid publicKey format (must be hex)" };
|
|
3362
|
-
}
|
|
3363
|
-
if (!/^[0-9a-fA-F]+$/.test(signatureHex)) {
|
|
3364
|
-
return { valid: false, error: "Invalid signature format (must be hex)" };
|
|
3365
|
-
}
|
|
3366
|
-
const publicKeyBuffer = hexToBytes(publicKeyHex);
|
|
3367
|
-
let publicKey;
|
|
3368
|
-
try {
|
|
3369
|
-
publicKey = await crypto.subtle.importKey(
|
|
3370
|
-
"raw",
|
|
3371
|
-
publicKeyBuffer,
|
|
3372
|
-
{ name: "Ed25519", namedCurve: "Ed25519" },
|
|
3373
|
-
false,
|
|
3374
|
-
["verify"]
|
|
3375
|
-
);
|
|
3376
|
-
} catch (err) {
|
|
3377
|
-
return {
|
|
3378
|
-
valid: false,
|
|
3379
|
-
error: `Failed to import public key: ${err instanceof Error ? err.message : "Ed25519 may not be supported in this browser"}`
|
|
3380
|
-
};
|
|
3381
|
-
}
|
|
3382
|
-
const manifestForHashing = sortObjectKeysRecursively({
|
|
3383
|
-
...manifest,
|
|
3384
|
-
signature: ""
|
|
3385
|
-
});
|
|
3386
|
-
const manifestJson = JSON.stringify(manifestForHashing, null, 2);
|
|
3387
|
-
const manifestBytes = new TextEncoder().encode(manifestJson);
|
|
3388
|
-
const filesForHashing = files.map((file) => {
|
|
3389
|
-
if (file.path === "haextension/manifest.json") {
|
|
3390
|
-
return { path: file.path, content: manifestBytes };
|
|
3391
|
-
}
|
|
3392
|
-
return file;
|
|
3393
|
-
});
|
|
3394
|
-
filesForHashing.sort((a, b) => {
|
|
3395
|
-
if (a.path < b.path) return -1;
|
|
3396
|
-
if (a.path > b.path) return 1;
|
|
3397
|
-
return 0;
|
|
3398
|
-
});
|
|
3399
|
-
const totalLength = filesForHashing.reduce((sum, f) => sum + f.content.length, 0);
|
|
3400
|
-
const combined = new Uint8Array(totalLength);
|
|
3401
|
-
let offset = 0;
|
|
3402
|
-
for (const file of filesForHashing) {
|
|
3403
|
-
combined.set(file.content, offset);
|
|
3404
|
-
offset += file.content.length;
|
|
3405
|
-
}
|
|
3406
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", combined);
|
|
3407
|
-
const signatureBuffer = hexToBytes(signatureHex);
|
|
3408
|
-
const isValid = await crypto.subtle.verify(
|
|
3409
|
-
"Ed25519",
|
|
3410
|
-
publicKey,
|
|
3411
|
-
signatureBuffer,
|
|
3412
|
-
hashBuffer
|
|
3413
|
-
);
|
|
3414
|
-
return { valid: isValid };
|
|
3415
|
-
} catch (err) {
|
|
3416
|
-
console.error("Signature verification error:", err);
|
|
3417
|
-
return {
|
|
3418
|
-
valid: false,
|
|
3419
|
-
error: err instanceof Error ? err.message : "Unknown verification error"
|
|
3420
|
-
};
|
|
3421
|
-
}
|
|
3422
|
-
}
|
|
3442
|
+
// src/types/spaces.ts
|
|
3443
|
+
init_cjs_shims();
|
|
3423
3444
|
|
|
3424
3445
|
// src/index.ts
|
|
3425
3446
|
init_vaultKey();
|
|
3426
3447
|
init_userKeypair();
|
|
3427
3448
|
|
|
3428
3449
|
// src/crypto/didKey.ts
|
|
3450
|
+
init_cjs_shims();
|
|
3429
3451
|
init_userKeypair();
|
|
3430
3452
|
init_vaultKey();
|
|
3431
3453
|
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -3524,6 +3546,7 @@ async function generateIdentityAsync() {
|
|
|
3524
3546
|
}
|
|
3525
3547
|
|
|
3526
3548
|
// src/crypto/spaceKey.ts
|
|
3549
|
+
init_cjs_shims();
|
|
3527
3550
|
init_userKeypair();
|
|
3528
3551
|
init_vaultKey();
|
|
3529
3552
|
function generateSpaceKey() {
|
|
@@ -3614,6 +3637,7 @@ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
|
|
|
3614
3637
|
}
|
|
3615
3638
|
|
|
3616
3639
|
// src/crypto/claims.ts
|
|
3640
|
+
init_cjs_shims();
|
|
3617
3641
|
init_userKeypair();
|
|
3618
3642
|
async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateKeyBase64) {
|
|
3619
3643
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -3650,6 +3674,7 @@ async function verifyClaimPresentationAsync(presentation) {
|
|
|
3650
3674
|
}
|
|
3651
3675
|
|
|
3652
3676
|
// src/crypto/recordSigning.ts
|
|
3677
|
+
init_cjs_shims();
|
|
3653
3678
|
init_userKeypair();
|
|
3654
3679
|
init_vaultKey();
|
|
3655
3680
|
function canonicalize(record) {
|
|
@@ -3714,6 +3739,7 @@ async function verifySpaceChallengeAsync(spaceId, timestamp, signatureBase64, pu
|
|
|
3714
3739
|
}
|
|
3715
3740
|
|
|
3716
3741
|
// src/crypto/passkey.ts
|
|
3742
|
+
init_cjs_shims();
|
|
3717
3743
|
init_vaultKey();
|
|
3718
3744
|
function toArrayBuffer(data) {
|
|
3719
3745
|
if (data instanceof ArrayBuffer) {
|
|
@@ -3887,6 +3913,7 @@ function createHaexVaultSdk(config = {}) {
|
|
|
3887
3913
|
exports.COSE_ALGORITHM = COSE_ALGORITHM;
|
|
3888
3914
|
exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
3889
3915
|
exports.DatabaseAPI = DatabaseAPI;
|
|
3916
|
+
exports.DialogAPI = DialogAPI;
|
|
3890
3917
|
exports.EXTERNAL_EVENTS = EXTERNAL_EVENTS;
|
|
3891
3918
|
exports.ErrorCode = ErrorCode;
|
|
3892
3919
|
exports.ExternalConnectionErrorCode = ExternalConnectionErrorCode;
|
|
@@ -3917,6 +3944,7 @@ exports.ShellAPI = ShellAPI;
|
|
|
3917
3944
|
exports.SpacesAPI = SpacesAPI;
|
|
3918
3945
|
exports.TABLE_SEPARATOR = TABLE_SEPARATOR;
|
|
3919
3946
|
exports.TAURI_COMMANDS = TAURI_COMMANDS;
|
|
3947
|
+
exports.TabAPI = TabAPI;
|
|
3920
3948
|
exports.WebAPI = WebAPI;
|
|
3921
3949
|
exports.arrayBufferToBase64 = arrayBufferToBase64;
|
|
3922
3950
|
exports.base58btcDecode = base58btcDecode;
|
|
@@ -3951,7 +3979,6 @@ exports.generateSpaceKey = generateSpaceKey;
|
|
|
3951
3979
|
exports.generateUserKeypairAsync = generateUserKeypairAsync;
|
|
3952
3980
|
exports.generateVaultKey = generateVaultKey;
|
|
3953
3981
|
exports.getTableName = getTableName;
|
|
3954
|
-
exports.hexToBytes = hexToBytes;
|
|
3955
3982
|
exports.importPrivateKeyAsync = importPrivateKeyAsync;
|
|
3956
3983
|
exports.importPrivateKeyForKeyAgreementAsync = importPrivateKeyForKeyAgreementAsync;
|
|
3957
3984
|
exports.importPublicKeyAsync = importPublicKeyAsync;
|
|
@@ -3973,10 +4000,8 @@ exports.signClaimPresentationAsync = signClaimPresentationAsync;
|
|
|
3973
4000
|
exports.signRecordAsync = signRecordAsync;
|
|
3974
4001
|
exports.signSpaceChallengeAsync = signSpaceChallengeAsync;
|
|
3975
4002
|
exports.signWithPasskeyAsync = signWithPasskeyAsync;
|
|
3976
|
-
exports.sortObjectKeysRecursively = sortObjectKeysRecursively;
|
|
3977
4003
|
exports.unwrapKey = unwrapKey;
|
|
3978
4004
|
exports.verifyClaimPresentationAsync = verifyClaimPresentationAsync;
|
|
3979
|
-
exports.verifyExtensionSignature = verifyExtensionSignature;
|
|
3980
4005
|
exports.verifyRecordSignatureAsync = verifyRecordSignatureAsync;
|
|
3981
4006
|
exports.verifySpaceChallengeAsync = verifySpaceChallengeAsync;
|
|
3982
4007
|
exports.verifyWithPasskeyAsync = verifyWithPasskeyAsync;
|