@haex-space/vault-sdk 2.5.112 → 2.5.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-gfc9eCL4.js';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-neLTvZJ_.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -939,6 +939,75 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
+ type SpaceRole = 'admin' | 'member' | 'viewer';
943
+ interface SharedSpace {
944
+ id: string;
945
+ ownerId: string;
946
+ encryptedName: string;
947
+ nameNonce: string;
948
+ currentKeyGeneration: number;
949
+ role: SpaceRole;
950
+ canInvite: boolean;
951
+ createdAt: string;
952
+ }
953
+ interface SpaceMemberInfo {
954
+ publicKey: string;
955
+ label: string;
956
+ role: SpaceRole;
957
+ canInvite: boolean;
958
+ invitedBy: string | null;
959
+ joinedAt: string;
960
+ }
961
+ interface SpaceKeyGrantInfo {
962
+ spaceId: string;
963
+ generation: number;
964
+ encryptedSpaceKey: string;
965
+ keyNonce: string;
966
+ ephemeralPublicKey: string;
967
+ }
968
+ interface SpaceInvite {
969
+ spaceId: string;
970
+ serverUrl: string;
971
+ spaceName: string;
972
+ accessToken: string;
973
+ encryptedSpaceKey: string;
974
+ keyNonce: string;
975
+ ephemeralPublicKey: string;
976
+ generation: number;
977
+ role: SpaceRole;
978
+ }
979
+ interface SpaceAccessTokenInfo {
980
+ id: string;
981
+ publicKey: string;
982
+ role: SpaceRole;
983
+ label: string | null;
984
+ revoked: boolean;
985
+ createdAt: string;
986
+ lastUsedAt: string | null;
987
+ }
988
+ /**
989
+ * A shared space with its decrypted name.
990
+ * Returned by the extension API after vault-side decryption.
991
+ */
992
+ interface DecryptedSpace {
993
+ id: string;
994
+ name: string;
995
+ role: SpaceRole;
996
+ canInvite: boolean;
997
+ serverUrl: string;
998
+ createdAt: string;
999
+ }
1000
+ /**
1001
+ * Minimal sync backend info exposed to extensions.
1002
+ * Extensions use this to pick a server when creating a space.
1003
+ */
1004
+ interface SyncBackendInfo {
1005
+ id: string;
1006
+ name: string;
1007
+ serverUrl: string;
1008
+ isDefault: boolean;
1009
+ }
1010
+
942
1011
  /**
943
1012
  * A mapping of a row to a shared space.
944
1013
  */
@@ -1010,6 +1079,23 @@ declare class SpacesAPI {
1010
1079
  * @returns Number of assignments removed (0 or 1)
1011
1080
  */
1012
1081
  unassignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1082
+ /**
1083
+ * List all shared spaces the user is a member of.
1084
+ * Returns spaces with decrypted names (decryption happens vault-side).
1085
+ */
1086
+ listSpacesAsync(): Promise<DecryptedSpace[]>;
1087
+ /**
1088
+ * Create a new shared space.
1089
+ * @param name - Human-readable space name
1090
+ * @param serverUrl - The sync server URL to create the space on
1091
+ * @returns The created space with decrypted name
1092
+ */
1093
+ createSpaceAsync(name: string, serverUrl: string): Promise<DecryptedSpace>;
1094
+ /**
1095
+ * List available sync backends that can host shared spaces.
1096
+ * @returns Array of backend info with server URLs
1097
+ */
1098
+ listSyncBackendsAsync(): Promise<SyncBackendInfo[]>;
1013
1099
  }
1014
1100
 
1015
1101
  /**
@@ -1088,4 +1174,4 @@ declare class HaexVaultSdk {
1088
1174
  private log;
1089
1175
  }
1090
1176
 
1091
- export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type SpaceAssignment as K, LOCALSEND_EVENTS as L, SpacesAPI as M, type TransferProgress as N, type TransferState as O, type PendingAuthorization as P, canExternalClientSendRequests as Q, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, isExternalClientConnected as V, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
1177
+ export { type TransferState as $, type AuthorizedClient as A, type BlockedClient as B, type SelectFileOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFolderOptions as G, HaexVaultSdk as H, type ServerInfo as I, type ServerStatus as J, type SessionAuthorization as K, LOCALSEND_EVENTS as L, type SharedSpace as M, type SpaceAccessTokenInfo as N, type SpaceAssignment as O, type PendingAuthorization as P, type SpaceInvite as Q, RemoteStorageAPI as R, StorageAPI as S, type SpaceKeyGrantInfo as T, type UpdateBackendRequest as U, type SpaceMemberInfo as V, type SpaceRole as W, SpacesAPI as X, type SyncBackendInfo as Y, type TransferDirection as Z, type TransferProgress as _, type DecryptedSpace as a, WebAPI as a0, canExternalClientSendRequests as a1, isExternalClientConnected as a2, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, LocalSendAPI as o, type LocalSendEvent as p, type FileInfo as q, type LocalSendSettings as r, type PendingTransfer as s, PermissionsAPI as t, type AddBackendRequest as u, type S3Config as v, type S3PublicConfig as w, type StorageBackendInfo as x, type StorageObjectInfo as y, type RequestedExtension as z };
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-gfc9eCL4.mjs';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-neLTvZJ_.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -939,6 +939,75 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
+ type SpaceRole = 'admin' | 'member' | 'viewer';
943
+ interface SharedSpace {
944
+ id: string;
945
+ ownerId: string;
946
+ encryptedName: string;
947
+ nameNonce: string;
948
+ currentKeyGeneration: number;
949
+ role: SpaceRole;
950
+ canInvite: boolean;
951
+ createdAt: string;
952
+ }
953
+ interface SpaceMemberInfo {
954
+ publicKey: string;
955
+ label: string;
956
+ role: SpaceRole;
957
+ canInvite: boolean;
958
+ invitedBy: string | null;
959
+ joinedAt: string;
960
+ }
961
+ interface SpaceKeyGrantInfo {
962
+ spaceId: string;
963
+ generation: number;
964
+ encryptedSpaceKey: string;
965
+ keyNonce: string;
966
+ ephemeralPublicKey: string;
967
+ }
968
+ interface SpaceInvite {
969
+ spaceId: string;
970
+ serverUrl: string;
971
+ spaceName: string;
972
+ accessToken: string;
973
+ encryptedSpaceKey: string;
974
+ keyNonce: string;
975
+ ephemeralPublicKey: string;
976
+ generation: number;
977
+ role: SpaceRole;
978
+ }
979
+ interface SpaceAccessTokenInfo {
980
+ id: string;
981
+ publicKey: string;
982
+ role: SpaceRole;
983
+ label: string | null;
984
+ revoked: boolean;
985
+ createdAt: string;
986
+ lastUsedAt: string | null;
987
+ }
988
+ /**
989
+ * A shared space with its decrypted name.
990
+ * Returned by the extension API after vault-side decryption.
991
+ */
992
+ interface DecryptedSpace {
993
+ id: string;
994
+ name: string;
995
+ role: SpaceRole;
996
+ canInvite: boolean;
997
+ serverUrl: string;
998
+ createdAt: string;
999
+ }
1000
+ /**
1001
+ * Minimal sync backend info exposed to extensions.
1002
+ * Extensions use this to pick a server when creating a space.
1003
+ */
1004
+ interface SyncBackendInfo {
1005
+ id: string;
1006
+ name: string;
1007
+ serverUrl: string;
1008
+ isDefault: boolean;
1009
+ }
1010
+
942
1011
  /**
943
1012
  * A mapping of a row to a shared space.
944
1013
  */
@@ -1010,6 +1079,23 @@ declare class SpacesAPI {
1010
1079
  * @returns Number of assignments removed (0 or 1)
1011
1080
  */
1012
1081
  unassignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1082
+ /**
1083
+ * List all shared spaces the user is a member of.
1084
+ * Returns spaces with decrypted names (decryption happens vault-side).
1085
+ */
1086
+ listSpacesAsync(): Promise<DecryptedSpace[]>;
1087
+ /**
1088
+ * Create a new shared space.
1089
+ * @param name - Human-readable space name
1090
+ * @param serverUrl - The sync server URL to create the space on
1091
+ * @returns The created space with decrypted name
1092
+ */
1093
+ createSpaceAsync(name: string, serverUrl: string): Promise<DecryptedSpace>;
1094
+ /**
1095
+ * List available sync backends that can host shared spaces.
1096
+ * @returns Array of backend info with server URLs
1097
+ */
1098
+ listSyncBackendsAsync(): Promise<SyncBackendInfo[]>;
1013
1099
  }
1014
1100
 
1015
1101
  /**
@@ -1088,4 +1174,4 @@ declare class HaexVaultSdk {
1088
1174
  private log;
1089
1175
  }
1090
1176
 
1091
- export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type SpaceAssignment as K, LOCALSEND_EVENTS as L, SpacesAPI as M, type TransferProgress as N, type TransferState as O, type PendingAuthorization as P, canExternalClientSendRequests as Q, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, isExternalClientConnected as V, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
1177
+ export { type TransferState as $, type AuthorizedClient as A, type BlockedClient as B, type SelectFileOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFolderOptions as G, HaexVaultSdk as H, type ServerInfo as I, type ServerStatus as J, type SessionAuthorization as K, LOCALSEND_EVENTS as L, type SharedSpace as M, type SpaceAccessTokenInfo as N, type SpaceAssignment as O, type PendingAuthorization as P, type SpaceInvite as Q, RemoteStorageAPI as R, StorageAPI as S, type SpaceKeyGrantInfo as T, type UpdateBackendRequest as U, type SpaceMemberInfo as V, type SpaceRole as W, SpacesAPI as X, type SyncBackendInfo as Y, type TransferDirection as Z, type TransferProgress as _, type DecryptedSpace as a, WebAPI as a0, canExternalClientSendRequests as a1, isExternalClientConnected as a2, type Device as b, type DeviceInfo as c, type DeviceType as d, type DirEntry as e, type ExternalConnection as f, ExternalConnectionErrorCode as g, ExternalConnectionState as h, type ExternalRequest as i, type ExternalRequestEvent as j, type ExternalRequestHandler as k, type ExternalRequestPayload as l, type ExternalResponse as m, FilesystemAPI as n, LocalSendAPI as o, type LocalSendEvent as p, type FileInfo as q, type LocalSendSettings as r, type PendingTransfer as s, PermissionsAPI as t, type AddBackendRequest as u, type S3Config as v, type S3PublicConfig as w, type StorageBackendInfo as x, type StorageObjectInfo as y, type RequestedExtension as z };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-GPE112vL.mjs';
2
- export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, K as SpaceAssignment, M as SpacesAPI, T as TransferDirection, N as TransferProgress, O as TransferState, W as WebAPI, Q as canExternalClientSendRequests, V as isExternalClientConnected } from './client-GPE112vL.mjs';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.mjs';
4
- export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.mjs';
1
+ import { H as HaexVaultSdk } from './client-DSvkG_lC.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as DecryptedSpace, b as Device, c as DeviceInfo, d as DeviceType, e as DirEntry, E as ExternalAuthDecision, f as ExternalConnection, g as ExternalConnectionErrorCode, h as ExternalConnectionState, i as ExternalRequest, j as ExternalRequestEvent, k as ExternalRequestHandler, l as ExternalRequestPayload, m as ExternalResponse, F as FileStat, n as FilesystemAPI, L as LOCALSEND_EVENTS, o as LocalSendAPI, p as LocalSendEvent, q as LocalSendFileInfo, r as LocalSendSettings, P as PendingAuthorization, s as PendingTransfer, t as PermissionsAPI, u as RemoteAddBackendRequest, v as RemoteS3Config, w as RemoteS3PublicConfig, R as RemoteStorageAPI, x as RemoteStorageBackendInfo, y as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, z as RequestedExtension, C as SelectFileOptions, G as SelectFolderOptions, I as ServerInfo, J as ServerStatus, K as SessionAuthorization, M as SharedSpace, N as SpaceAccessTokenInfo, O as SpaceAssignment, Q as SpaceInvite, T as SpaceKeyGrantInfo, V as SpaceMemberInfo, W as SpaceRole, X as SpacesAPI, Y as SyncBackendInfo, Z as TransferDirection, _ as TransferProgress, $ as TransferState, a0 as WebAPI, a1 as canExternalClientSendRequests, a2 as isExternalClientConnected } from './client-DSvkG_lC.mjs';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-neLTvZJ_.mjs';
4
+ export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-neLTvZJ_.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -217,53 +217,6 @@ interface RegisterKeypairRequest {
217
217
  privateKeySalt: string;
218
218
  }
219
219
 
220
- type SpaceRole = 'admin' | 'member' | 'viewer';
221
- interface SharedSpace {
222
- id: string;
223
- ownerId: string;
224
- encryptedName: string;
225
- nameNonce: string;
226
- currentKeyGeneration: number;
227
- role: SpaceRole;
228
- canInvite: boolean;
229
- createdAt: string;
230
- }
231
- interface SpaceMemberInfo {
232
- publicKey: string;
233
- label: string;
234
- role: SpaceRole;
235
- canInvite: boolean;
236
- invitedBy: string | null;
237
- joinedAt: string;
238
- }
239
- interface SpaceKeyGrantInfo {
240
- spaceId: string;
241
- generation: number;
242
- encryptedSpaceKey: string;
243
- keyNonce: string;
244
- ephemeralPublicKey: string;
245
- }
246
- interface SpaceInvite {
247
- spaceId: string;
248
- serverUrl: string;
249
- spaceName: string;
250
- accessToken: string;
251
- encryptedSpaceKey: string;
252
- keyNonce: string;
253
- ephemeralPublicKey: string;
254
- generation: number;
255
- role: SpaceRole;
256
- }
257
- interface SpaceAccessTokenInfo {
258
- id: string;
259
- publicKey: string;
260
- role: SpaceRole;
261
- label: string | null;
262
- revoked: boolean;
263
- createdAt: string;
264
- lastUsedAt: string | null;
265
- }
266
-
267
220
  /**
268
221
  * Central message type definitions for HaexSpace SDK
269
222
  *
@@ -568,6 +521,12 @@ declare const SPACE_COMMANDS: {
568
521
  readonly unassign: "extension_space_unassign";
569
522
  /** Get space assignments for a table */
570
523
  readonly getAssignments: "extension_space_get_assignments";
524
+ /** List all spaces the user is a member of (with decrypted names) */
525
+ readonly list: "extension_space_list";
526
+ /** Create a new shared space */
527
+ readonly create: "extension_space_create";
528
+ /** List available sync backends */
529
+ readonly listBackends: "extension_space_list_backends";
571
530
  };
572
531
 
573
532
  /**
@@ -692,6 +651,9 @@ declare const TAURI_COMMANDS: {
692
651
  readonly assign: "extension_space_assign";
693
652
  readonly unassign: "extension_space_unassign";
694
653
  readonly getAssignments: "extension_space_get_assignments";
654
+ readonly list: "extension_space_list";
655
+ readonly create: "extension_space_create";
656
+ readonly listBackends: "extension_space_list_backends";
695
657
  };
696
658
  };
697
659
  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 LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS];
@@ -859,6 +821,18 @@ interface EncryptedSpaceKey {
859
821
  declare function generateSpaceKey(): Uint8Array<ArrayBuffer>;
860
822
  declare function encryptSpaceKeyForRecipientAsync(spaceKey: Uint8Array<ArrayBuffer>, recipientPublicKeyBase64: string): Promise<EncryptedSpaceKey>;
861
823
  declare function decryptSpaceKeyAsync(encrypted: EncryptedSpaceKey, ownPrivateKeyBase64: string): Promise<Uint8Array>;
824
+ /**
825
+ * Encrypt a space name using the raw space key.
826
+ * Returns the encrypted name and nonce as base64 strings.
827
+ */
828
+ declare function encryptSpaceNameAsync(spaceKey: Uint8Array, spaceName: string): Promise<{
829
+ encryptedName: string;
830
+ nameNonce: string;
831
+ }>;
832
+ /**
833
+ * Decrypt a space name using the raw space key.
834
+ */
835
+ declare function decryptSpaceNameAsync(spaceKey: Uint8Array, encryptedName: string, nameNonce: string): Promise<string>;
862
836
 
863
837
  interface SignableRecord {
864
838
  tableName: string;
@@ -963,4 +937,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
963
937
 
964
938
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
965
939
 
966
- export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SharedSpace, type SignableRecord, type SpaceAccessTokenInfo, type SpaceInvite, type SpaceKeyGrantInfo, type SpaceMemberInfo, type SpaceRole, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
940
+ export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SignableRecord, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-BVMJXZiK.js';
2
- export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, K as SpaceAssignment, M as SpacesAPI, T as TransferDirection, N as TransferProgress, O as TransferState, W as WebAPI, Q as canExternalClientSendRequests, V as isExternalClientConnected } from './client-BVMJXZiK.js';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.js';
4
- export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.js';
1
+ import { H as HaexVaultSdk } from './client-CA59HZfa.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as DecryptedSpace, b as Device, c as DeviceInfo, d as DeviceType, e as DirEntry, E as ExternalAuthDecision, f as ExternalConnection, g as ExternalConnectionErrorCode, h as ExternalConnectionState, i as ExternalRequest, j as ExternalRequestEvent, k as ExternalRequestHandler, l as ExternalRequestPayload, m as ExternalResponse, F as FileStat, n as FilesystemAPI, L as LOCALSEND_EVENTS, o as LocalSendAPI, p as LocalSendEvent, q as LocalSendFileInfo, r as LocalSendSettings, P as PendingAuthorization, s as PendingTransfer, t as PermissionsAPI, u as RemoteAddBackendRequest, v as RemoteS3Config, w as RemoteS3PublicConfig, R as RemoteStorageAPI, x as RemoteStorageBackendInfo, y as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, z as RequestedExtension, C as SelectFileOptions, G as SelectFolderOptions, I as ServerInfo, J as ServerStatus, K as SessionAuthorization, M as SharedSpace, N as SpaceAccessTokenInfo, O as SpaceAssignment, Q as SpaceInvite, T as SpaceKeyGrantInfo, V as SpaceMemberInfo, W as SpaceRole, X as SpacesAPI, Y as SyncBackendInfo, Z as TransferDirection, _ as TransferProgress, $ as TransferState, a0 as WebAPI, a1 as canExternalClientSendRequests, a2 as isExternalClientConnected } from './client-CA59HZfa.js';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-neLTvZJ_.js';
4
+ export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-neLTvZJ_.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -217,53 +217,6 @@ interface RegisterKeypairRequest {
217
217
  privateKeySalt: string;
218
218
  }
219
219
 
220
- type SpaceRole = 'admin' | 'member' | 'viewer';
221
- interface SharedSpace {
222
- id: string;
223
- ownerId: string;
224
- encryptedName: string;
225
- nameNonce: string;
226
- currentKeyGeneration: number;
227
- role: SpaceRole;
228
- canInvite: boolean;
229
- createdAt: string;
230
- }
231
- interface SpaceMemberInfo {
232
- publicKey: string;
233
- label: string;
234
- role: SpaceRole;
235
- canInvite: boolean;
236
- invitedBy: string | null;
237
- joinedAt: string;
238
- }
239
- interface SpaceKeyGrantInfo {
240
- spaceId: string;
241
- generation: number;
242
- encryptedSpaceKey: string;
243
- keyNonce: string;
244
- ephemeralPublicKey: string;
245
- }
246
- interface SpaceInvite {
247
- spaceId: string;
248
- serverUrl: string;
249
- spaceName: string;
250
- accessToken: string;
251
- encryptedSpaceKey: string;
252
- keyNonce: string;
253
- ephemeralPublicKey: string;
254
- generation: number;
255
- role: SpaceRole;
256
- }
257
- interface SpaceAccessTokenInfo {
258
- id: string;
259
- publicKey: string;
260
- role: SpaceRole;
261
- label: string | null;
262
- revoked: boolean;
263
- createdAt: string;
264
- lastUsedAt: string | null;
265
- }
266
-
267
220
  /**
268
221
  * Central message type definitions for HaexSpace SDK
269
222
  *
@@ -568,6 +521,12 @@ declare const SPACE_COMMANDS: {
568
521
  readonly unassign: "extension_space_unassign";
569
522
  /** Get space assignments for a table */
570
523
  readonly getAssignments: "extension_space_get_assignments";
524
+ /** List all spaces the user is a member of (with decrypted names) */
525
+ readonly list: "extension_space_list";
526
+ /** Create a new shared space */
527
+ readonly create: "extension_space_create";
528
+ /** List available sync backends */
529
+ readonly listBackends: "extension_space_list_backends";
571
530
  };
572
531
 
573
532
  /**
@@ -692,6 +651,9 @@ declare const TAURI_COMMANDS: {
692
651
  readonly assign: "extension_space_assign";
693
652
  readonly unassign: "extension_space_unassign";
694
653
  readonly getAssignments: "extension_space_get_assignments";
654
+ readonly list: "extension_space_list";
655
+ readonly create: "extension_space_create";
656
+ readonly listBackends: "extension_space_list_backends";
695
657
  };
696
658
  };
697
659
  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 LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS];
@@ -859,6 +821,18 @@ interface EncryptedSpaceKey {
859
821
  declare function generateSpaceKey(): Uint8Array<ArrayBuffer>;
860
822
  declare function encryptSpaceKeyForRecipientAsync(spaceKey: Uint8Array<ArrayBuffer>, recipientPublicKeyBase64: string): Promise<EncryptedSpaceKey>;
861
823
  declare function decryptSpaceKeyAsync(encrypted: EncryptedSpaceKey, ownPrivateKeyBase64: string): Promise<Uint8Array>;
824
+ /**
825
+ * Encrypt a space name using the raw space key.
826
+ * Returns the encrypted name and nonce as base64 strings.
827
+ */
828
+ declare function encryptSpaceNameAsync(spaceKey: Uint8Array, spaceName: string): Promise<{
829
+ encryptedName: string;
830
+ nameNonce: string;
831
+ }>;
832
+ /**
833
+ * Decrypt a space name using the raw space key.
834
+ */
835
+ declare function decryptSpaceNameAsync(spaceKey: Uint8Array, encryptedName: string, nameNonce: string): Promise<string>;
862
836
 
863
837
  interface SignableRecord {
864
838
  tableName: string;
@@ -963,4 +937,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
963
937
 
964
938
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
965
939
 
966
- export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SharedSpace, type SignableRecord, type SpaceAccessTokenInfo, type SpaceInvite, type SpaceKeyGrantInfo, type SpaceMemberInfo, type SpaceRole, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
940
+ export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SignableRecord, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
package/dist/index.js CHANGED
@@ -683,7 +683,13 @@ var SPACE_COMMANDS = {
683
683
  /** Bulk unassign rows from spaces */
684
684
  unassign: "extension_space_unassign",
685
685
  /** Get space assignments for a table */
686
- getAssignments: "extension_space_get_assignments"
686
+ getAssignments: "extension_space_get_assignments",
687
+ /** List all spaces the user is a member of (with decrypted names) */
688
+ list: "extension_space_list",
689
+ /** Create a new shared space */
690
+ create: "extension_space_create",
691
+ /** List available sync backends */
692
+ listBackends: "extension_space_list_backends"
687
693
  };
688
694
 
689
695
  // src/commands/index.ts
@@ -1760,19 +1766,48 @@ var SpacesAPI = class {
1760
1766
  async unassignRowAsync(tableName, rowPks, spaceId) {
1761
1767
  return this.unassignAsync([{ tableName, rowPks, spaceId }]);
1762
1768
  }
1769
+ // ==========================================================================
1770
+ // Space Management
1771
+ // ==========================================================================
1772
+ /**
1773
+ * List all shared spaces the user is a member of.
1774
+ * Returns spaces with decrypted names (decryption happens vault-side).
1775
+ */
1776
+ async listSpacesAsync() {
1777
+ return this.client.request(SPACE_COMMANDS.list);
1778
+ }
1779
+ /**
1780
+ * Create a new shared space.
1781
+ * @param name - Human-readable space name
1782
+ * @param serverUrl - The sync server URL to create the space on
1783
+ * @returns The created space with decrypted name
1784
+ */
1785
+ async createSpaceAsync(name, serverUrl) {
1786
+ return this.client.request(SPACE_COMMANDS.create, {
1787
+ name,
1788
+ server_url: serverUrl
1789
+ });
1790
+ }
1791
+ /**
1792
+ * List available sync backends that can host shared spaces.
1793
+ * @returns Array of backend info with server URLs
1794
+ */
1795
+ async listSyncBackendsAsync() {
1796
+ return this.client.request(SPACE_COMMANDS.listBackends);
1797
+ }
1763
1798
  };
1764
- function toSnakeCase(a) {
1799
+ function toSnakeCase(assignment) {
1765
1800
  return {
1766
- table_name: a.tableName,
1767
- row_pks: a.rowPks,
1768
- space_id: a.spaceId
1801
+ table_name: assignment.tableName,
1802
+ row_pks: assignment.rowPks,
1803
+ space_id: assignment.spaceId
1769
1804
  };
1770
1805
  }
1771
- function fromSnakeCase(a) {
1806
+ function fromSnakeCase(assignment) {
1772
1807
  return {
1773
- tableName: a.table_name,
1774
- rowPks: a.row_pks,
1775
- spaceId: a.space_id
1808
+ tableName: assignment.table_name,
1809
+ rowPks: assignment.row_pks,
1810
+ spaceId: assignment.space_id
1776
1811
  };
1777
1812
  }
1778
1813
 
@@ -2950,6 +2985,27 @@ async function decryptSpaceKeyAsync(encrypted, ownPrivateKeyBase64) {
2950
2985
  );
2951
2986
  return new Uint8Array(decrypted);
2952
2987
  }
2988
+ async function encryptSpaceNameAsync(spaceKey, spaceName) {
2989
+ const cryptoKey = await crypto.subtle.importKey(
2990
+ "raw",
2991
+ new Uint8Array(spaceKey).buffer,
2992
+ { name: "AES-GCM" },
2993
+ false,
2994
+ ["encrypt"]
2995
+ );
2996
+ const { encryptedData, nonce } = await encryptString(spaceName, cryptoKey);
2997
+ return { encryptedName: encryptedData, nameNonce: nonce };
2998
+ }
2999
+ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
3000
+ const cryptoKey = await crypto.subtle.importKey(
3001
+ "raw",
3002
+ new Uint8Array(spaceKey).buffer,
3003
+ { name: "AES-GCM" },
3004
+ false,
3005
+ ["decrypt"]
3006
+ );
3007
+ return decryptString(encryptedName, nameNonce, cryptoKey);
3008
+ }
2953
3009
 
2954
3010
  // src/crypto/recordSigning.ts
2955
3011
  function canonicalize(record) {
@@ -3214,6 +3270,7 @@ exports.createHaexVaultSdk = createHaexVaultSdk;
3214
3270
  exports.decryptCrdtData = decryptCrdtData;
3215
3271
  exports.decryptPrivateKeyAsync = decryptPrivateKeyAsync;
3216
3272
  exports.decryptSpaceKeyAsync = decryptSpaceKeyAsync;
3273
+ exports.decryptSpaceNameAsync = decryptSpaceNameAsync;
3217
3274
  exports.decryptString = decryptString;
3218
3275
  exports.decryptVaultKey = decryptVaultKey;
3219
3276
  exports.decryptVaultName = decryptVaultName;
@@ -3221,6 +3278,7 @@ exports.deriveKeyFromPassword = deriveKeyFromPassword;
3221
3278
  exports.encryptCrdtData = encryptCrdtData;
3222
3279
  exports.encryptPrivateKeyAsync = encryptPrivateKeyAsync;
3223
3280
  exports.encryptSpaceKeyForRecipientAsync = encryptSpaceKeyForRecipientAsync;
3281
+ exports.encryptSpaceNameAsync = encryptSpaceNameAsync;
3224
3282
  exports.encryptString = encryptString;
3225
3283
  exports.encryptVaultKey = encryptVaultKey;
3226
3284
  exports.exportKeyPairAsync = exportKeyPairAsync;