@haex-space/vault-sdk 4.8.0 → 4.9.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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-DiqylZ59.js';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client-DiqylZ59.js';
3
- import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-3iifP-Q1.js';
4
- export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PermissionDeniedError, X as PermissionErrorBase, Y as PermissionErrorCode, Z as PermissionPromptError, P as PermissionResponse, _ as PermissionStatus, R as RequestOptions, $ as SHELL_EVENTS, a0 as SearchQuery, a1 as SearchRequestEvent, S as SearchResult, a2 as ShellEvent, a3 as SyncTablesUpdatedEvent, a4 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a5 as getTableName, a6 as isPermissionDeniedError, a7 as isPermissionError, a8 as isPermissionPromptError } from './types-3iifP-Q1.js';
1
+ import { H as HaexVaultSdk } from './client-BzgCo_Ch.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PEER_ERROR_KINDS, am as PasswordInput, an as PasswordItemFull, ao as PasswordItemSummary, ap as PasswordKeyValue, aq as PasswordKeyValueInput, ar as PasswordsAPI, as as PeerChannelClosed, at as PeerChannelOpened, au as PeerError, av as PeerErrorKind, aw as PeerErrorReason, ax as PeerEventMap, ay as PeerEventType, az as PeerInviteStatus, aA as PeerJoined, aB as PeerMessage, aC as PeerVisibility, aD as PeersAPI, aE as PendingAuthorization, aF as PendingTransfer, aG as PermissionsAPI, aH as RemoteAddBackendRequest, aI as RemoteFolderBackendInfo, aJ as RemoteS3BackendInfo, aK as RemoteS3Config, aL as RemoteS3Proposal, aM as RemoteS3PublicConfig, aN as RemoteSftpProposal, aO as RemoteStorageAPI, aP as RemoteStorageBackendInfo, aQ as RemoteStorageBackendType, aR as RemoteStorageObjectInfo, aS as RemoteUpdateBackendRequest, aT as RemoteWebDavProposal, aU as RequestedExtension, aV as SelectFileOptions, aW as SelectFolderOptions, aX as ServerInfo, aY as ServerStatus, aZ as SessionAuthorization, a_ as SharedSpace, a$ as ShellAPI, b0 as ShellCreateOptions, b1 as ShellCreateResponse, b2 as ShellExitEvent, b3 as ShellOutputEvent, b4 as SmtpConfig, b5 as SpaceAccessTokenInfo, b6 as SpaceAssignment, b7 as SpaceInvite, b8 as SpaceKeyGrantInfo, b9 as SpaceMember, ba as SpaceMemberInfo, bb as SpacesAPI, bc as SyncBackendInfo, bd as TabAPI, be as ToolContext, bf as ToolHandler, bg as ToolsAPI, bh as TransferDirection, bi as TransferProgress, bj as TransferState, bk as WebAPI, bl as canExternalClientSendRequests, bm as isExternalClientConnected } from './client-BzgCo_Ch.js';
3
+ import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-BZVkX0Wf.js';
4
+ export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PEERS_EVENTS, X as PeersEvent, Y as PermissionDeniedError, Z as PermissionErrorBase, _ as PermissionErrorCode, $ as PermissionPromptError, P as PermissionResponse, a0 as PermissionStatus, R as RequestOptions, a1 as SHELL_EVENTS, a2 as SearchQuery, a3 as SearchRequestEvent, S as SearchResult, a4 as ShellEvent, a5 as SyncTablesUpdatedEvent, a6 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a7 as getTableName, a8 as isPermissionDeniedError, a9 as isPermissionError, aa as isPermissionPromptError } from './types-BZVkX0Wf.js';
5
5
  export { H as HaextensionConfig } from './config-P_6DqTHl.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -169,6 +169,37 @@ declare const MODEL_COMMANDS: {
169
169
  };
170
170
  type ModelCommand = (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS];
171
171
 
172
+ /**
173
+ * Peer Commands
174
+ *
175
+ * Commands for channels between frames of the same extension on devices of
176
+ * different vaults (holzi spec 057, `contracts/bridge.md`). Every method needs
177
+ * the `peers` permission (`action` = `connect`, `target` = "*"). There is no
178
+ * command to accept or decline an invitation: that happens only in holzi's
179
+ * own prompt.
180
+ *
181
+ * Naming convention: `extension_peers_<action>`
182
+ */
183
+ declare const PEER_COMMANDS: {
184
+ /** Invites a contact; the outcome follows as `peers:invite-status` */
185
+ readonly invite: "extension_peers_invite";
186
+ /** Withdraws an open invitation on all devices of the contact */
187
+ readonly inviteCancel: "extension_peers_invite_cancel";
188
+ /** Opens a lobby and returns its join code */
189
+ readonly lobbyOpen: "extension_peers_lobby_open";
190
+ /** Closes a lobby; its code stops working, its channels stay open */
191
+ readonly lobbyClose: "extension_peers_lobby_close";
192
+ /** Joins a lobby by its code; waits at most 15 s for the host */
193
+ readonly join: "extension_peers_join";
194
+ /** Closes a channel of an own lobby and keeps the device out of that lobby */
195
+ readonly remove: "extension_peers_remove";
196
+ /** Sends a fast or a reliable message over a channel */
197
+ readonly send: "extension_peers_send";
198
+ /** Closes a channel on both sides */
199
+ readonly close: "extension_peers_close";
200
+ };
201
+ type PeerCommand = (typeof PEER_COMMANDS)[keyof typeof PEER_COMMANDS];
202
+
172
203
  /**
173
204
  * Mail Commands (IMAP fetch + SMTP send).
174
205
  *
@@ -896,6 +927,16 @@ declare const TAURI_COMMANDS: {
896
927
  readonly start: "extension_model_job_start";
897
928
  readonly cancel: "extension_model_job_cancel";
898
929
  };
930
+ readonly peers: {
931
+ readonly invite: "extension_peers_invite";
932
+ readonly inviteCancel: "extension_peers_invite_cancel";
933
+ readonly lobbyOpen: "extension_peers_lobby_open";
934
+ readonly lobbyClose: "extension_peers_lobby_close";
935
+ readonly join: "extension_peers_join";
936
+ readonly remove: "extension_peers_remove";
937
+ readonly send: "extension_peers_send";
938
+ readonly close: "extension_peers_close";
939
+ };
899
940
  readonly mail: {
900
941
  readonly listMailboxes: "extension_mail_list_mailboxes";
901
942
  readonly fetchEnvelopes: "extension_mail_fetch_envelopes";
@@ -917,7 +958,7 @@ declare const TAURI_COMMANDS: {
917
958
  readonly dismiss: "extension_notifications_dismiss";
918
959
  };
919
960
  };
920
- type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS] | (typeof ENCRYPTED_FOLDER_COMMANDS)[keyof typeof ENCRYPTED_FOLDER_COMMANDS] | (typeof LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS] | (typeof SHELL_COMMANDS)[keyof typeof SHELL_COMMANDS] | (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS] | (typeof CONTACT_COMMANDS)[keyof typeof CONTACT_COMMANDS] | (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS] | (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS] | (typeof NOTIFICATION_COMMANDS)[keyof typeof NOTIFICATION_COMMANDS];
961
+ type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS] | (typeof ENCRYPTED_FOLDER_COMMANDS)[keyof typeof ENCRYPTED_FOLDER_COMMANDS] | (typeof LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS] | (typeof SHELL_COMMANDS)[keyof typeof SHELL_COMMANDS] | (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS] | (typeof CONTACT_COMMANDS)[keyof typeof CONTACT_COMMANDS] | (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS] | (typeof PEER_COMMANDS)[keyof typeof PEER_COMMANDS] | (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS] | (typeof NOTIFICATION_COMMANDS)[keyof typeof NOTIFICATION_COMMANDS];
921
962
 
922
963
  /**
923
964
  * Crypto utilities for Vault Key Management
@@ -1184,5 +1225,5 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
1184
1225
 
1185
1226
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
1186
1227
 
1187
- export { CONTACT_COMMANDS, COSE_ALGORITHM, ENCRYPTED_FOLDER_COMMANDS, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, KEY_AGREEMENT_ALGO, MAIL_COMMANDS, MODEL_COMMANDS, NOTIFICATION_COMMANDS, PASSWORD_COMMANDS, SIGNING_ALGO, SPACE_COMMANDS, SignedClaimPresentation, TAURI_COMMANDS, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, 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, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
1188
- export type { AuthUser, ContactCommand, CoseAlgorithm, CreateSpaceRequest, EncryptedFolderCommand, ExportedPasskeyKeyPair, ExportedUserKeypair, HaexspaceMessageType, InviteMemberRequest, MailCommand, ModelCommand, NotificationCommand, PasskeyKeyPair, PasswordCommand, RegisterKeypairRequest, SealedData, SignableRecord, SpaceCommand, StorageConfig, ErrorResponse as SyncServerErrorResponse, ServerInfo as SyncServerInfo, LoginRequest as SyncServerLoginRequest, LoginResponse as SyncServerLoginResponse, RefreshRequest as SyncServerRefreshRequest, TauriCommand, UserKeypair };
1228
+ export { CONTACT_COMMANDS, COSE_ALGORITHM, ENCRYPTED_FOLDER_COMMANDS, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, KEY_AGREEMENT_ALGO, MAIL_COMMANDS, MODEL_COMMANDS, NOTIFICATION_COMMANDS, PASSWORD_COMMANDS, PEER_COMMANDS, SIGNING_ALGO, SPACE_COMMANDS, SignedClaimPresentation, TAURI_COMMANDS, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, 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, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
1229
+ export type { AuthUser, ContactCommand, CoseAlgorithm, CreateSpaceRequest, EncryptedFolderCommand, ExportedPasskeyKeyPair, ExportedUserKeypair, HaexspaceMessageType, InviteMemberRequest, MailCommand, ModelCommand, NotificationCommand, PasskeyKeyPair, PasswordCommand, PeerCommand, RegisterKeypairRequest, SealedData, SignableRecord, SpaceCommand, StorageConfig, ErrorResponse as SyncServerErrorResponse, ServerInfo as SyncServerInfo, LoginRequest as SyncServerLoginRequest, LoginResponse as SyncServerLoginResponse, RefreshRequest as SyncServerRefreshRequest, TauriCommand, UserKeypair };
package/dist/index.js CHANGED
@@ -767,6 +767,18 @@ var MODEL_JOB_EVENTS = {
767
767
  /** A job of this frame ended: completed, failed or cancelled. */
768
768
  COMPLETED: "haextension:model-job:completed"
769
769
  };
770
+ var PEERS_EVENTS = {
771
+ /** The outcome of an invitation, once per invitation (inviting side). */
772
+ INVITE_STATUS: "peers:invite-status",
773
+ /** A channel opened after the user accepted an invitation in holzi's prompt (invited side). */
774
+ CHANNEL_OPENED: "peers:channel-opened",
775
+ /** A device joined one of this device's lobbies by code (host). */
776
+ JOINED: "peers:joined",
777
+ /** A message on a channel; `data` is Base64 on the bridge. */
778
+ MESSAGE: "peers:message",
779
+ /** A channel ended: closed, lost or timed out. */
780
+ CHANNEL_CLOSED: "peers:channel-closed"
781
+ };
770
782
  var EXTERNAL_EVENTS = {
771
783
  /** External request from authorized client */
772
784
  REQUEST: "haextension:external:request",
@@ -1208,6 +1220,27 @@ var MODEL_COMMANDS = {
1208
1220
  cancel: "extension_model_job_cancel"
1209
1221
  };
1210
1222
 
1223
+ // src/commands/peers.ts
1224
+ init_cjs_shims();
1225
+ var PEER_COMMANDS = {
1226
+ /** Invites a contact; the outcome follows as `peers:invite-status` */
1227
+ invite: "extension_peers_invite",
1228
+ /** Withdraws an open invitation on all devices of the contact */
1229
+ inviteCancel: "extension_peers_invite_cancel",
1230
+ /** Opens a lobby and returns its join code */
1231
+ lobbyOpen: "extension_peers_lobby_open",
1232
+ /** Closes a lobby; its code stops working, its channels stay open */
1233
+ lobbyClose: "extension_peers_lobby_close",
1234
+ /** Joins a lobby by its code; waits at most 15 s for the host */
1235
+ join: "extension_peers_join",
1236
+ /** Closes a channel of an own lobby and keeps the device out of that lobby */
1237
+ remove: "extension_peers_remove",
1238
+ /** Sends a fast or a reliable message over a channel */
1239
+ send: "extension_peers_send",
1240
+ /** Closes a channel on both sides */
1241
+ close: "extension_peers_close"
1242
+ };
1243
+
1211
1244
  // src/commands/mail.ts
1212
1245
  init_cjs_shims();
1213
1246
  var MAIL_COMMANDS = {
@@ -1267,6 +1300,7 @@ var TAURI_COMMANDS = {
1267
1300
  passwords: PASSWORD_COMMANDS,
1268
1301
  contacts: CONTACT_COMMANDS,
1269
1302
  models: MODEL_COMMANDS,
1303
+ peers: PEER_COMMANDS,
1270
1304
  mail: MAIL_COMMANDS,
1271
1305
  notifications: NOTIFICATION_COMMANDS
1272
1306
  };
@@ -1410,7 +1444,8 @@ var FilesystemAPI = class {
1410
1444
  this.client = client;
1411
1445
  }
1412
1446
  /**
1413
- * Opens a save file dialog and saves the provided data to the selected location
1447
+ * Opens a save file dialog and saves the provided data to the selected location.
1448
+ * Waits for the user without the request timeout.
1414
1449
  * @param data The file data as Uint8Array
1415
1450
  * @param options Options for the save dialog
1416
1451
  * @returns The path where the file was saved, or null if cancelled
@@ -1424,7 +1459,8 @@ var FilesystemAPI = class {
1424
1459
  defaultPath: options.defaultPath,
1425
1460
  title: options.title,
1426
1461
  filters: options.filters
1427
- }
1462
+ },
1463
+ { timeout: null }
1428
1464
  );
1429
1465
  return result;
1430
1466
  }
@@ -1544,25 +1580,27 @@ var FilesystemAPI = class {
1544
1580
  );
1545
1581
  }
1546
1582
  /**
1547
- * Open a folder selection dialog
1583
+ * Open a folder selection dialog; waits for the user without the request timeout
1548
1584
  * @param options Dialog options
1549
1585
  * @returns Selected folder path, or null if cancelled
1550
1586
  */
1551
1587
  async selectFolder(options = {}) {
1552
1588
  return this.client.request(
1553
1589
  FILESYSTEM_COMMANDS.selectFolder,
1554
- options
1590
+ options,
1591
+ { timeout: null }
1555
1592
  );
1556
1593
  }
1557
1594
  /**
1558
- * Open a file selection dialog
1595
+ * Open a file selection dialog; waits for the user without the request timeout
1559
1596
  * @param options Dialog options
1560
1597
  * @returns Selected file paths, or null if cancelled
1561
1598
  */
1562
1599
  async selectFile(options = {}) {
1563
1600
  return this.client.request(
1564
1601
  FILESYSTEM_COMMANDS.selectFile,
1565
- options
1602
+ options,
1603
+ { timeout: null }
1566
1604
  );
1567
1605
  }
1568
1606
  /**
@@ -2529,6 +2567,158 @@ var ModelsAPI = class {
2529
2567
  }
2530
2568
  };
2531
2569
 
2570
+ // src/api/peers.ts
2571
+ init_cjs_shims();
2572
+ init_vaultKey();
2573
+ var PEER_ERROR_KINDS = {
2574
+ contact_unknown: "PEER_CONTACT_UNKNOWN",
2575
+ invite_not_open: "PEER_INVITE_UNKNOWN",
2576
+ channel_unknown: "PEER_CHANNEL_CLOSED",
2577
+ channel_closed: "PEER_CHANNEL_CLOSED",
2578
+ too_large: "PEER_PAYLOAD_TOO_LARGE",
2579
+ lobby_closed: "PEER_LOBBY_CLOSED",
2580
+ not_admitted: "PEER_NOT_ALLOWED",
2581
+ limit: "PEER_LIMIT",
2582
+ network_unavailable: "PEER_NETWORK_UNAVAILABLE",
2583
+ invalid_input: "PEER_INVALID_INPUT"
2584
+ };
2585
+ var PeerError = class extends Error {
2586
+ constructor(code, reason, message, details = {}, options) {
2587
+ super(message, options);
2588
+ this.code = code;
2589
+ this.reason = reason;
2590
+ this.details = details;
2591
+ this.name = "PeerError";
2592
+ this.kind = PEER_ERROR_KINDS[reason];
2593
+ if (typeof details.limit === "number") this.limit = details.limit;
2594
+ }
2595
+ };
2596
+ function isPeerErrorReason(value) {
2597
+ return typeof value === "string" && Object.hasOwn(PEER_ERROR_KINDS, value);
2598
+ }
2599
+ function toPeerError(error) {
2600
+ if (typeof error !== "object" || error === null) return error;
2601
+ const { code, message, details } = error;
2602
+ if (typeof code !== "number" || typeof details !== "object" || details === null) return error;
2603
+ const reason = details.reason;
2604
+ if (!isPeerErrorReason(reason)) return error;
2605
+ return new PeerError(
2606
+ code,
2607
+ reason,
2608
+ typeof message === "string" ? message : reason,
2609
+ details,
2610
+ { cause: error }
2611
+ );
2612
+ }
2613
+ var EVENT_NAMES = {
2614
+ "invite-status": PEERS_EVENTS.INVITE_STATUS,
2615
+ "channel-opened": PEERS_EVENTS.CHANNEL_OPENED,
2616
+ joined: PEERS_EVENTS.JOINED,
2617
+ message: PEERS_EVENTS.MESSAGE,
2618
+ "channel-closed": PEERS_EVENTS.CHANNEL_CLOSED
2619
+ };
2620
+ function decodeEvent(type, data) {
2621
+ if (typeof data !== "object" || data === null) return void 0;
2622
+ if (type !== "message") return data;
2623
+ const message = data;
2624
+ if (typeof message.channelId !== "string" || typeof message.data !== "string") return void 0;
2625
+ let decoded;
2626
+ try {
2627
+ decoded = base64ToArrayBuffer(message.data);
2628
+ } catch {
2629
+ return void 0;
2630
+ }
2631
+ if (arrayBufferToBase64(decoded) !== message.data) return void 0;
2632
+ return {
2633
+ channelId: message.channelId,
2634
+ data: decoded,
2635
+ reliable: message.reliable === true
2636
+ };
2637
+ }
2638
+ var PeersAPI = class {
2639
+ constructor(client) {
2640
+ this.client = client;
2641
+ /** Largest fast message (`reliable: false`) in bytes. */
2642
+ this.MAX_FAST_BYTES = 1024;
2643
+ /** Largest reliable message in bytes. */
2644
+ this.MAX_RELIABLE_BYTES = 65536;
2645
+ /** Largest `payload` of an invitation or a join, as JSON, in bytes. */
2646
+ this.MAX_PAYLOAD_BYTES = 4096;
2647
+ }
2648
+ async call(method, params) {
2649
+ try {
2650
+ return await this.client.request(method, params);
2651
+ } catch (error) {
2652
+ throw toPeerError(error);
2653
+ }
2654
+ }
2655
+ /** Invites a contact; the outcome follows as `invite-status` with this `inviteId`. */
2656
+ async inviteAsync(contactId, payload) {
2657
+ const answer = await this.call(PEER_COMMANDS.invite, { contactId, payload });
2658
+ return { inviteId: answer.inviteId };
2659
+ }
2660
+ /** Withdraws an open invitation on all devices of the contact; no `invite-status` follows. */
2661
+ async cancelInviteAsync(inviteId) {
2662
+ await this.call(PEER_COMMANDS.inviteCancel, { inviteId });
2663
+ }
2664
+ /**
2665
+ * Opens a lobby; `lobbyId` is 1–64 characters of `[A-Za-z0-9._-]`. The join code is opaque:
2666
+ * hand it on as it is.
2667
+ */
2668
+ async openLobbyAsync(lobbyId, visibility) {
2669
+ const answer = await this.call(PEER_COMMANDS.lobbyOpen, { lobbyId, visibility });
2670
+ return { joinCode: answer.joinCode };
2671
+ }
2672
+ /** Closes a lobby: its code stops working, its channels stay open. An unknown lobby is fine. */
2673
+ async closeLobbyAsync(lobbyId) {
2674
+ await this.call(PEER_COMMANDS.lobbyClose, { lobbyId });
2675
+ }
2676
+ /**
2677
+ * Joins a lobby by its code with a self-chosen `displayName` (1–64 characters). The host
2678
+ * answers within 15 s; a lobby that cannot be joined for any reason rejects as `lobby_closed`.
2679
+ */
2680
+ async joinAsync(joinCode, displayName, payload) {
2681
+ const answer = await this.call(PEER_COMMANDS.join, {
2682
+ joinCode,
2683
+ displayName,
2684
+ payload
2685
+ });
2686
+ return { channelId: answer.channelId, lobbyId: answer.lobbyId };
2687
+ }
2688
+ /** Closes a channel of an own lobby and keeps that device (and vault) out of the lobby. */
2689
+ async removeAsync(channelId) {
2690
+ await this.call(PEER_COMMANDS.remove, { channelId });
2691
+ }
2692
+ /**
2693
+ * Sends bytes over a channel: fast (default, at most {@link MAX_FAST_BYTES}, may be lost) or
2694
+ * `reliable` (at most {@link MAX_RELIABLE_BYTES}, in order; 16 may wait per channel).
2695
+ */
2696
+ async sendAsync(channelId, data, options = {}) {
2697
+ await this.call(PEER_COMMANDS.send, {
2698
+ channelId,
2699
+ data: { $bytes: arrayBufferToBase64(data) },
2700
+ reliable: options.reliable ?? false
2701
+ });
2702
+ }
2703
+ /** Closes a channel; both sides get `channel-closed` with `reason: "closed"`. */
2704
+ async closeAsync(channelId) {
2705
+ await this.call(PEER_COMMANDS.close, { channelId });
2706
+ }
2707
+ /**
2708
+ * Listens for one of the peers events (`invite-status`, `channel-opened`, `joined`, `message`,
2709
+ * `channel-closed`); `message.data` arrives as bytes. Returns an unsubscribe function.
2710
+ */
2711
+ on(type, handler) {
2712
+ const name = EVENT_NAMES[type];
2713
+ const wrapped = (event) => {
2714
+ const decoded = decodeEvent(type, event.data);
2715
+ if (decoded) handler(decoded);
2716
+ };
2717
+ this.client.on(name, wrapped);
2718
+ return () => this.client.off(name, wrapped);
2719
+ }
2720
+ };
2721
+
2532
2722
  // src/api/mail.ts
2533
2723
  init_cjs_shims();
2534
2724
  var MailAPI = class {
@@ -3646,6 +3836,7 @@ var HaexVaultSdk = class {
3646
3836
  this.passwords = new PasswordsAPI(this);
3647
3837
  this.contacts = new ContactsAPI(this);
3648
3838
  this.models = new ModelsAPI(this);
3839
+ this.peers = new PeersAPI(this);
3649
3840
  this.mail = new MailAPI(this);
3650
3841
  this.notifications = new NotificationsAPI(this);
3651
3842
  this.tab = new TabAPI(this);
@@ -4546,7 +4737,12 @@ exports.NOTIFICATION_COMMANDS = NOTIFICATION_COMMANDS;
4546
4737
  exports.NOTIFICATION_EVENTS = NOTIFICATION_EVENTS;
4547
4738
  exports.NotificationsAPI = NotificationsAPI;
4548
4739
  exports.PASSWORD_COMMANDS = PASSWORD_COMMANDS;
4740
+ exports.PEERS_EVENTS = PEERS_EVENTS;
4741
+ exports.PEER_COMMANDS = PEER_COMMANDS;
4742
+ exports.PEER_ERROR_KINDS = PEER_ERROR_KINDS;
4549
4743
  exports.PasswordsAPI = PasswordsAPI;
4744
+ exports.PeerError = PeerError;
4745
+ exports.PeersAPI = PeersAPI;
4550
4746
  exports.PermissionErrorCode = PermissionErrorCode;
4551
4747
  exports.PermissionStatus = PermissionStatus;
4552
4748
  exports.PermissionsAPI = PermissionsAPI;