@haex-space/vault-sdk 3.6.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-DnCZ3KyI.d.mts → client-C6pEREPM.d.ts} +63 -3
- package/dist/{client-uuhuCPDu.d.ts → client-GdCi-m2s.d.mts} +63 -3
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +14 -59
- package/dist/index.d.ts +14 -59
- package/dist/index.js +139 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -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 +146 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +166 -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 +54 -7
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +54 -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 +146 -7
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +166 -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 +146 -7
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +166 -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",
|
|
@@ -1039,6 +1092,8 @@ var SPACE_COMMANDS = {
|
|
|
1039
1092
|
unassign: "extension_space_unassign",
|
|
1040
1093
|
/** Get space assignments for a table */
|
|
1041
1094
|
getAssignments: "extension_space_get_assignments",
|
|
1095
|
+
/** Get members of a shared space */
|
|
1096
|
+
getMembers: "extension_space_get_members",
|
|
1042
1097
|
/** List all spaces the user is a member of (with decrypted names) */
|
|
1043
1098
|
list: "extension_space_list",
|
|
1044
1099
|
/** Create a new shared space */
|
|
@@ -1048,6 +1103,7 @@ var SPACE_COMMANDS = {
|
|
|
1048
1103
|
};
|
|
1049
1104
|
|
|
1050
1105
|
// src/commands/shell.ts
|
|
1106
|
+
init_cjs_shims();
|
|
1051
1107
|
var SHELL_COMMANDS = {
|
|
1052
1108
|
/** List available shell environments (no permission required) */
|
|
1053
1109
|
listAvailable: "extension_shell_list_available",
|
|
@@ -1062,6 +1118,7 @@ var SHELL_COMMANDS = {
|
|
|
1062
1118
|
};
|
|
1063
1119
|
|
|
1064
1120
|
// src/commands/passwords.ts
|
|
1121
|
+
init_cjs_shims();
|
|
1065
1122
|
var PASSWORD_COMMANDS = {
|
|
1066
1123
|
/** List items (no secrets) within the extension's tag scope */
|
|
1067
1124
|
list: "extension_password_list",
|
|
@@ -1076,6 +1133,7 @@ var PASSWORD_COMMANDS = {
|
|
|
1076
1133
|
};
|
|
1077
1134
|
|
|
1078
1135
|
// src/commands/mail.ts
|
|
1136
|
+
init_cjs_shims();
|
|
1079
1137
|
var MAIL_COMMANDS = {
|
|
1080
1138
|
/** LIST mailboxes + optional STATUS counts */
|
|
1081
1139
|
listMailboxes: "extension_mail_list_mailboxes",
|
|
@@ -1102,6 +1160,7 @@ var MAIL_COMMANDS = {
|
|
|
1102
1160
|
};
|
|
1103
1161
|
|
|
1104
1162
|
// src/commands/notifications.ts
|
|
1163
|
+
init_cjs_shims();
|
|
1105
1164
|
var NOTIFICATION_COMMANDS = {
|
|
1106
1165
|
/** Show an OS notification. Returns the assigned notification id. */
|
|
1107
1166
|
show: "extension_notifications_show",
|
|
@@ -1150,6 +1209,7 @@ var StorageAPI = class {
|
|
|
1150
1209
|
};
|
|
1151
1210
|
|
|
1152
1211
|
// src/api/database.ts
|
|
1212
|
+
init_cjs_shims();
|
|
1153
1213
|
function quoteIdent(identifier) {
|
|
1154
1214
|
if (identifier.startsWith('"') && identifier.endsWith('"')) {
|
|
1155
1215
|
return identifier;
|
|
@@ -1249,6 +1309,7 @@ var DatabaseAPI = class {
|
|
|
1249
1309
|
};
|
|
1250
1310
|
|
|
1251
1311
|
// src/api/filesystem.ts
|
|
1312
|
+
init_cjs_shims();
|
|
1252
1313
|
init_vaultKey();
|
|
1253
1314
|
var KnownPath = /* @__PURE__ */ ((KnownPath2) => {
|
|
1254
1315
|
KnownPath2["Home"] = "home";
|
|
@@ -1493,6 +1554,7 @@ var FilesystemAPI = class {
|
|
|
1493
1554
|
};
|
|
1494
1555
|
|
|
1495
1556
|
// src/api/web.ts
|
|
1557
|
+
init_cjs_shims();
|
|
1496
1558
|
var WebAPI = class {
|
|
1497
1559
|
constructor(client) {
|
|
1498
1560
|
this.client = client;
|
|
@@ -1606,6 +1668,7 @@ var WebAPI = class {
|
|
|
1606
1668
|
};
|
|
1607
1669
|
|
|
1608
1670
|
// src/api/permissions.ts
|
|
1671
|
+
init_cjs_shims();
|
|
1609
1672
|
var PermissionsAPI = class {
|
|
1610
1673
|
constructor(client) {
|
|
1611
1674
|
this.client = client;
|
|
@@ -1660,6 +1723,7 @@ var PermissionsAPI = class {
|
|
|
1660
1723
|
};
|
|
1661
1724
|
|
|
1662
1725
|
// src/api/remoteStorage.ts
|
|
1726
|
+
init_cjs_shims();
|
|
1663
1727
|
init_vaultKey();
|
|
1664
1728
|
var RemoteStorageAPI = class {
|
|
1665
1729
|
constructor(client) {
|
|
@@ -1770,6 +1834,7 @@ var BackendManagement = class {
|
|
|
1770
1834
|
};
|
|
1771
1835
|
|
|
1772
1836
|
// src/api/localsend.ts
|
|
1837
|
+
init_cjs_shims();
|
|
1773
1838
|
var LOCALSEND_EVENTS = {
|
|
1774
1839
|
/** New device discovered */
|
|
1775
1840
|
deviceDiscovered: "localsend:device-discovered",
|
|
@@ -1941,6 +2006,7 @@ var LocalSendAPI = class {
|
|
|
1941
2006
|
};
|
|
1942
2007
|
|
|
1943
2008
|
// src/api/spaces.ts
|
|
2009
|
+
init_cjs_shims();
|
|
1944
2010
|
var SpacesAPI = class {
|
|
1945
2011
|
constructor(client) {
|
|
1946
2012
|
this.client = client;
|
|
@@ -2003,9 +2069,17 @@ var SpacesAPI = class {
|
|
|
2003
2069
|
async listSpacesAsync() {
|
|
2004
2070
|
return this.client.request(SPACE_COMMANDS.list);
|
|
2005
2071
|
}
|
|
2072
|
+
/**
|
|
2073
|
+
* List members of a shared space (DID + label), flagging the current user.
|
|
2074
|
+
* Used to resolve assignment authors to names and to detect own vs shared-in content.
|
|
2075
|
+
*/
|
|
2076
|
+
async getMembersAsync(spaceId) {
|
|
2077
|
+
return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
|
|
2078
|
+
}
|
|
2006
2079
|
};
|
|
2007
2080
|
|
|
2008
2081
|
// src/api/shell.ts
|
|
2082
|
+
init_cjs_shims();
|
|
2009
2083
|
var ShellAPI = class {
|
|
2010
2084
|
constructor(sdk) {
|
|
2011
2085
|
this.sdk = sdk;
|
|
@@ -2077,6 +2151,7 @@ var ShellAPI = class {
|
|
|
2077
2151
|
};
|
|
2078
2152
|
|
|
2079
2153
|
// src/api/passwords.ts
|
|
2154
|
+
init_cjs_shims();
|
|
2080
2155
|
var PasswordsAPI = class {
|
|
2081
2156
|
constructor(client) {
|
|
2082
2157
|
this.client = client;
|
|
@@ -2122,6 +2197,7 @@ var PasswordsAPI = class {
|
|
|
2122
2197
|
};
|
|
2123
2198
|
|
|
2124
2199
|
// src/api/mail.ts
|
|
2200
|
+
init_cjs_shims();
|
|
2125
2201
|
var MailAPI = class {
|
|
2126
2202
|
constructor(client) {
|
|
2127
2203
|
this.client = client;
|
|
@@ -2261,6 +2337,7 @@ var MailAPI = class {
|
|
|
2261
2337
|
};
|
|
2262
2338
|
|
|
2263
2339
|
// src/api/notifications.ts
|
|
2340
|
+
init_cjs_shims();
|
|
2264
2341
|
var NotificationsAPI = class {
|
|
2265
2342
|
constructor(client) {
|
|
2266
2343
|
this.client = client;
|
|
@@ -2292,7 +2369,36 @@ var NotificationsAPI = class {
|
|
|
2292
2369
|
}
|
|
2293
2370
|
};
|
|
2294
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
|
+
|
|
2295
2400
|
// src/client/tableName.ts
|
|
2401
|
+
init_cjs_shims();
|
|
2296
2402
|
function validatePublicKey(publicKey) {
|
|
2297
2403
|
if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
|
|
2298
2404
|
throw new HaexVaultSdkError(
|
|
@@ -2378,6 +2484,7 @@ function parseTableName(fullTableName) {
|
|
|
2378
2484
|
}
|
|
2379
2485
|
|
|
2380
2486
|
// src/client/init.ts
|
|
2487
|
+
init_cjs_shims();
|
|
2381
2488
|
var PORT_HANDSHAKE_TIMEOUT_MS = 1e4;
|
|
2382
2489
|
function getCurrentWebviewLabel() {
|
|
2383
2490
|
const internals = window.__TAURI_INTERNALS__;
|
|
@@ -2526,6 +2633,10 @@ function waitForHostPortAsync(log) {
|
|
|
2526
2633
|
const handler = (event) => {
|
|
2527
2634
|
const type = event.data?.type;
|
|
2528
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
|
+
}
|
|
2529
2640
|
const port = event.ports[0];
|
|
2530
2641
|
if (!port) {
|
|
2531
2642
|
log("PORT_INIT received but event.ports is empty \u2014 ignoring");
|
|
@@ -2559,10 +2670,11 @@ postMessage error: ${e}`);
|
|
|
2559
2670
|
}
|
|
2560
2671
|
|
|
2561
2672
|
// src/client/transport.ts
|
|
2673
|
+
init_cjs_shims();
|
|
2562
2674
|
function generateRequestId(counter) {
|
|
2563
2675
|
return `req_${counter}`;
|
|
2564
2676
|
}
|
|
2565
|
-
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
|
|
2677
|
+
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
|
|
2566
2678
|
if (!port) {
|
|
2567
2679
|
return Promise.reject(
|
|
2568
2680
|
new HaexVaultSdkError(
|
|
@@ -2577,14 +2689,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
|
|
|
2577
2689
|
timestamp: Date.now()
|
|
2578
2690
|
};
|
|
2579
2691
|
return new Promise((resolve, reject) => {
|
|
2580
|
-
const timeout = setTimeout(() => {
|
|
2692
|
+
const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
|
|
2581
2693
|
pendingRequests.delete(requestId);
|
|
2582
2694
|
reject(
|
|
2583
2695
|
new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
|
|
2584
|
-
timeout:
|
|
2696
|
+
timeout: timeoutMs
|
|
2585
2697
|
})
|
|
2586
2698
|
);
|
|
2587
|
-
},
|
|
2699
|
+
}, timeoutMs);
|
|
2588
2700
|
pendingRequests.set(requestId, { resolve, reject, timeout });
|
|
2589
2701
|
if (config.debug) {
|
|
2590
2702
|
console.log("[SDK Debug] ========== Sending Request ==========");
|
|
@@ -2610,6 +2722,7 @@ async function sendInvoke(method, params, config, _log) {
|
|
|
2610
2722
|
}
|
|
2611
2723
|
|
|
2612
2724
|
// src/client/events.ts
|
|
2725
|
+
init_cjs_shims();
|
|
2613
2726
|
function createMessageHandler(config, pendingRequests, extensionInfo, onEvent) {
|
|
2614
2727
|
return (event) => {
|
|
2615
2728
|
if (config.debug) {
|
|
@@ -2709,6 +2822,9 @@ function removeEventListener(eventType, callback, eventListeners) {
|
|
|
2709
2822
|
function notifySubscribers(subscribers) {
|
|
2710
2823
|
subscribers.forEach((callback) => callback());
|
|
2711
2824
|
}
|
|
2825
|
+
|
|
2826
|
+
// src/client/database.ts
|
|
2827
|
+
init_cjs_shims();
|
|
2712
2828
|
function createDrizzleInstance(schema, extensionInfo, request, log) {
|
|
2713
2829
|
if (!extensionInfo) {
|
|
2714
2830
|
throw new HaexVaultSdkError(
|
|
@@ -2777,6 +2893,7 @@ async function executeRaw(sql, params, request) {
|
|
|
2777
2893
|
}
|
|
2778
2894
|
|
|
2779
2895
|
// src/client/external.ts
|
|
2896
|
+
init_cjs_shims();
|
|
2780
2897
|
function registerExternalHandler(action, handler, handlers, log) {
|
|
2781
2898
|
handlers.set(action, handler);
|
|
2782
2899
|
log(`[ExternalRequest] Registered handler for action: ${action}`);
|
|
@@ -2818,12 +2935,14 @@ async function respondToExternalRequest(response, request) {
|
|
|
2818
2935
|
}
|
|
2819
2936
|
|
|
2820
2937
|
// src/commands/ai.ts
|
|
2938
|
+
init_cjs_shims();
|
|
2821
2939
|
var AI_COMMANDS = {
|
|
2822
2940
|
/** Respond to an AI action request */
|
|
2823
2941
|
actionRespond: "ai_action_respond"
|
|
2824
2942
|
};
|
|
2825
2943
|
|
|
2826
2944
|
// src/client/permissionRetry.ts
|
|
2945
|
+
init_cjs_shims();
|
|
2827
2946
|
var PERMISSION_DECISION_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
2828
2947
|
var MAX_PERMISSION_RETRIES = 3;
|
|
2829
2948
|
function permissionKey(resourceType, action, target) {
|
|
@@ -2937,6 +3056,8 @@ var HaexVaultSdk = class {
|
|
|
2937
3056
|
this.passwords = new PasswordsAPI(this);
|
|
2938
3057
|
this.mail = new MailAPI(this);
|
|
2939
3058
|
this.notifications = new NotificationsAPI(this);
|
|
3059
|
+
this.tab = new TabAPI(this);
|
|
3060
|
+
this.dialog = new DialogAPI(this);
|
|
2940
3061
|
installConsoleForwarding(this.config.debug);
|
|
2941
3062
|
this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
|
|
2942
3063
|
const data = event.data;
|
|
@@ -3092,7 +3213,7 @@ var HaexVaultSdk = class {
|
|
|
3092
3213
|
// ==========================================================================
|
|
3093
3214
|
// Communication
|
|
3094
3215
|
// ==========================================================================
|
|
3095
|
-
async request(method, params) {
|
|
3216
|
+
async request(method, params, options) {
|
|
3096
3217
|
const resolvedParams = params ?? {};
|
|
3097
3218
|
const send = () => {
|
|
3098
3219
|
if (this.isNativeWindow && hasTauri()) {
|
|
@@ -3111,7 +3232,8 @@ var HaexVaultSdk = class {
|
|
|
3111
3232
|
this.config,
|
|
3112
3233
|
this._extensionInfo,
|
|
3113
3234
|
this.pendingRequests,
|
|
3114
|
-
this.hostPort
|
|
3235
|
+
this.hostPort,
|
|
3236
|
+
options?.timeout
|
|
3115
3237
|
);
|
|
3116
3238
|
};
|
|
3117
3239
|
return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
|
|
@@ -3289,6 +3411,7 @@ var HaexVaultSdk = class {
|
|
|
3289
3411
|
};
|
|
3290
3412
|
|
|
3291
3413
|
// src/types/external.ts
|
|
3414
|
+
init_cjs_shims();
|
|
3292
3415
|
var ExternalConnectionState = /* @__PURE__ */ ((ExternalConnectionState2) => {
|
|
3293
3416
|
ExternalConnectionState2["DISCONNECTED"] = "disconnected";
|
|
3294
3417
|
ExternalConnectionState2["CONNECTING"] = "connecting";
|
|
@@ -3316,107 +3439,15 @@ function canExternalClientSendRequests(state) {
|
|
|
3316
3439
|
return state === "paired" /* PAIRED */;
|
|
3317
3440
|
}
|
|
3318
3441
|
|
|
3319
|
-
// src/
|
|
3320
|
-
|
|
3321
|
-
if (typeof obj !== "object" || obj === null) {
|
|
3322
|
-
return obj;
|
|
3323
|
-
}
|
|
3324
|
-
if (Array.isArray(obj)) {
|
|
3325
|
-
return obj.map((item) => sortObjectKeysRecursively(item));
|
|
3326
|
-
}
|
|
3327
|
-
return Object.keys(obj).sort().reduce((result, key) => {
|
|
3328
|
-
result[key] = sortObjectKeysRecursively(obj[key]);
|
|
3329
|
-
return result;
|
|
3330
|
-
}, {});
|
|
3331
|
-
}
|
|
3332
|
-
function hexToBytes(hex) {
|
|
3333
|
-
const bytes = new Uint8Array(hex.length / 2);
|
|
3334
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
3335
|
-
bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
|
|
3336
|
-
}
|
|
3337
|
-
return bytes.buffer;
|
|
3338
|
-
}
|
|
3339
|
-
async function verifyExtensionSignature(files, manifest) {
|
|
3340
|
-
try {
|
|
3341
|
-
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
3342
|
-
return { valid: false, error: "WebCrypto API not available" };
|
|
3343
|
-
}
|
|
3344
|
-
const { publicKey: publicKeyHex, signature: signatureHex } = manifest;
|
|
3345
|
-
if (!publicKeyHex) {
|
|
3346
|
-
return { valid: false, error: "Missing publicKey in manifest" };
|
|
3347
|
-
}
|
|
3348
|
-
if (!signatureHex) {
|
|
3349
|
-
return { valid: false, error: "Missing signature in manifest" };
|
|
3350
|
-
}
|
|
3351
|
-
if (!/^[0-9a-fA-F]+$/.test(publicKeyHex)) {
|
|
3352
|
-
return { valid: false, error: "Invalid publicKey format (must be hex)" };
|
|
3353
|
-
}
|
|
3354
|
-
if (!/^[0-9a-fA-F]+$/.test(signatureHex)) {
|
|
3355
|
-
return { valid: false, error: "Invalid signature format (must be hex)" };
|
|
3356
|
-
}
|
|
3357
|
-
const publicKeyBuffer = hexToBytes(publicKeyHex);
|
|
3358
|
-
let publicKey;
|
|
3359
|
-
try {
|
|
3360
|
-
publicKey = await crypto.subtle.importKey(
|
|
3361
|
-
"raw",
|
|
3362
|
-
publicKeyBuffer,
|
|
3363
|
-
{ name: "Ed25519", namedCurve: "Ed25519" },
|
|
3364
|
-
false,
|
|
3365
|
-
["verify"]
|
|
3366
|
-
);
|
|
3367
|
-
} catch (err) {
|
|
3368
|
-
return {
|
|
3369
|
-
valid: false,
|
|
3370
|
-
error: `Failed to import public key: ${err instanceof Error ? err.message : "Ed25519 may not be supported in this browser"}`
|
|
3371
|
-
};
|
|
3372
|
-
}
|
|
3373
|
-
const manifestForHashing = sortObjectKeysRecursively({
|
|
3374
|
-
...manifest,
|
|
3375
|
-
signature: ""
|
|
3376
|
-
});
|
|
3377
|
-
const manifestJson = JSON.stringify(manifestForHashing, null, 2);
|
|
3378
|
-
const manifestBytes = new TextEncoder().encode(manifestJson);
|
|
3379
|
-
const filesForHashing = files.map((file) => {
|
|
3380
|
-
if (file.path === "haextension/manifest.json") {
|
|
3381
|
-
return { path: file.path, content: manifestBytes };
|
|
3382
|
-
}
|
|
3383
|
-
return file;
|
|
3384
|
-
});
|
|
3385
|
-
filesForHashing.sort((a, b) => {
|
|
3386
|
-
if (a.path < b.path) return -1;
|
|
3387
|
-
if (a.path > b.path) return 1;
|
|
3388
|
-
return 0;
|
|
3389
|
-
});
|
|
3390
|
-
const totalLength = filesForHashing.reduce((sum, f) => sum + f.content.length, 0);
|
|
3391
|
-
const combined = new Uint8Array(totalLength);
|
|
3392
|
-
let offset = 0;
|
|
3393
|
-
for (const file of filesForHashing) {
|
|
3394
|
-
combined.set(file.content, offset);
|
|
3395
|
-
offset += file.content.length;
|
|
3396
|
-
}
|
|
3397
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", combined);
|
|
3398
|
-
const signatureBuffer = hexToBytes(signatureHex);
|
|
3399
|
-
const isValid = await crypto.subtle.verify(
|
|
3400
|
-
"Ed25519",
|
|
3401
|
-
publicKey,
|
|
3402
|
-
signatureBuffer,
|
|
3403
|
-
hashBuffer
|
|
3404
|
-
);
|
|
3405
|
-
return { valid: isValid };
|
|
3406
|
-
} catch (err) {
|
|
3407
|
-
console.error("Signature verification error:", err);
|
|
3408
|
-
return {
|
|
3409
|
-
valid: false,
|
|
3410
|
-
error: err instanceof Error ? err.message : "Unknown verification error"
|
|
3411
|
-
};
|
|
3412
|
-
}
|
|
3413
|
-
}
|
|
3442
|
+
// src/types/spaces.ts
|
|
3443
|
+
init_cjs_shims();
|
|
3414
3444
|
|
|
3415
3445
|
// src/index.ts
|
|
3416
3446
|
init_vaultKey();
|
|
3417
3447
|
init_userKeypair();
|
|
3418
3448
|
|
|
3419
3449
|
// src/crypto/didKey.ts
|
|
3450
|
+
init_cjs_shims();
|
|
3420
3451
|
init_userKeypair();
|
|
3421
3452
|
init_vaultKey();
|
|
3422
3453
|
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -3515,6 +3546,7 @@ async function generateIdentityAsync() {
|
|
|
3515
3546
|
}
|
|
3516
3547
|
|
|
3517
3548
|
// src/crypto/spaceKey.ts
|
|
3549
|
+
init_cjs_shims();
|
|
3518
3550
|
init_userKeypair();
|
|
3519
3551
|
init_vaultKey();
|
|
3520
3552
|
function generateSpaceKey() {
|
|
@@ -3605,6 +3637,7 @@ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
|
|
|
3605
3637
|
}
|
|
3606
3638
|
|
|
3607
3639
|
// src/crypto/claims.ts
|
|
3640
|
+
init_cjs_shims();
|
|
3608
3641
|
init_userKeypair();
|
|
3609
3642
|
async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateKeyBase64) {
|
|
3610
3643
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -3641,6 +3674,7 @@ async function verifyClaimPresentationAsync(presentation) {
|
|
|
3641
3674
|
}
|
|
3642
3675
|
|
|
3643
3676
|
// src/crypto/recordSigning.ts
|
|
3677
|
+
init_cjs_shims();
|
|
3644
3678
|
init_userKeypair();
|
|
3645
3679
|
init_vaultKey();
|
|
3646
3680
|
function canonicalize(record) {
|
|
@@ -3705,6 +3739,7 @@ async function verifySpaceChallengeAsync(spaceId, timestamp, signatureBase64, pu
|
|
|
3705
3739
|
}
|
|
3706
3740
|
|
|
3707
3741
|
// src/crypto/passkey.ts
|
|
3742
|
+
init_cjs_shims();
|
|
3708
3743
|
init_vaultKey();
|
|
3709
3744
|
function toArrayBuffer(data) {
|
|
3710
3745
|
if (data instanceof ArrayBuffer) {
|
|
@@ -3878,6 +3913,7 @@ function createHaexVaultSdk(config = {}) {
|
|
|
3878
3913
|
exports.COSE_ALGORITHM = COSE_ALGORITHM;
|
|
3879
3914
|
exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
3880
3915
|
exports.DatabaseAPI = DatabaseAPI;
|
|
3916
|
+
exports.DialogAPI = DialogAPI;
|
|
3881
3917
|
exports.EXTERNAL_EVENTS = EXTERNAL_EVENTS;
|
|
3882
3918
|
exports.ErrorCode = ErrorCode;
|
|
3883
3919
|
exports.ExternalConnectionErrorCode = ExternalConnectionErrorCode;
|
|
@@ -3908,6 +3944,7 @@ exports.ShellAPI = ShellAPI;
|
|
|
3908
3944
|
exports.SpacesAPI = SpacesAPI;
|
|
3909
3945
|
exports.TABLE_SEPARATOR = TABLE_SEPARATOR;
|
|
3910
3946
|
exports.TAURI_COMMANDS = TAURI_COMMANDS;
|
|
3947
|
+
exports.TabAPI = TabAPI;
|
|
3911
3948
|
exports.WebAPI = WebAPI;
|
|
3912
3949
|
exports.arrayBufferToBase64 = arrayBufferToBase64;
|
|
3913
3950
|
exports.base58btcDecode = base58btcDecode;
|
|
@@ -3942,7 +3979,6 @@ exports.generateSpaceKey = generateSpaceKey;
|
|
|
3942
3979
|
exports.generateUserKeypairAsync = generateUserKeypairAsync;
|
|
3943
3980
|
exports.generateVaultKey = generateVaultKey;
|
|
3944
3981
|
exports.getTableName = getTableName;
|
|
3945
|
-
exports.hexToBytes = hexToBytes;
|
|
3946
3982
|
exports.importPrivateKeyAsync = importPrivateKeyAsync;
|
|
3947
3983
|
exports.importPrivateKeyForKeyAgreementAsync = importPrivateKeyForKeyAgreementAsync;
|
|
3948
3984
|
exports.importPublicKeyAsync = importPublicKeyAsync;
|
|
@@ -3964,10 +4000,8 @@ exports.signClaimPresentationAsync = signClaimPresentationAsync;
|
|
|
3964
4000
|
exports.signRecordAsync = signRecordAsync;
|
|
3965
4001
|
exports.signSpaceChallengeAsync = signSpaceChallengeAsync;
|
|
3966
4002
|
exports.signWithPasskeyAsync = signWithPasskeyAsync;
|
|
3967
|
-
exports.sortObjectKeysRecursively = sortObjectKeysRecursively;
|
|
3968
4003
|
exports.unwrapKey = unwrapKey;
|
|
3969
4004
|
exports.verifyClaimPresentationAsync = verifyClaimPresentationAsync;
|
|
3970
|
-
exports.verifyExtensionSignature = verifyExtensionSignature;
|
|
3971
4005
|
exports.verifyRecordSignatureAsync = verifyRecordSignatureAsync;
|
|
3972
4006
|
exports.verifySpaceChallengeAsync = verifySpaceChallengeAsync;
|
|
3973
4007
|
exports.verifyWithPasskeyAsync = verifyWithPasskeyAsync;
|