@haex-space/vault-sdk 2.5.118 → 2.5.120

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-neLTvZJ_.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-TFcm6hpl.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -939,7 +939,7 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
- type SpaceRole = 'admin' | 'member' | 'viewer';
942
+ type SpaceRole = 'admin' | 'owner' | 'member' | 'reader';
943
943
  interface SharedSpace {
944
944
  id: string;
945
945
  ownerId: string;
@@ -947,14 +947,12 @@ interface SharedSpace {
947
947
  nameNonce: string;
948
948
  currentKeyGeneration: number;
949
949
  role: SpaceRole;
950
- canInvite: boolean;
951
950
  createdAt: string;
952
951
  }
953
952
  interface SpaceMemberInfo {
954
953
  publicKey: string;
955
954
  label: string;
956
955
  role: SpaceRole;
957
- canInvite: boolean;
958
956
  invitedBy: string | null;
959
957
  joinedAt: string;
960
958
  }
@@ -993,7 +991,6 @@ interface DecryptedSpace {
993
991
  id: string;
994
992
  name: string;
995
993
  role: SpaceRole;
996
- canInvite: boolean;
997
994
  serverUrl: string;
998
995
  createdAt: string;
999
996
  }
@@ -1174,4 +1171,4 @@ declare class HaexVaultSdk {
1174
1171
  private log;
1175
1172
  }
1176
1173
 
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 };
1174
+ export { type TransferState as $, type AuthorizedClient as A, type BlockedClient as B, type RequestedExtension as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFileOptions as G, HaexVaultSdk as H, type SelectFolderOptions as I, type ServerInfo as J, type ServerStatus as K, LOCALSEND_EVENTS as L, type SessionAuthorization as M, type SharedSpace as N, type SpaceAccessTokenInfo as O, type PendingAuthorization as P, type SpaceAssignment as Q, RemoteStorageAPI as R, StorageAPI as S, type SpaceInvite as T, type UpdateBackendRequest as U, type SpaceKeyGrantInfo as V, type SpaceMemberInfo as W, SpacesAPI as X, type SyncBackendInfo as Y, type TransferDirection as Z, type TransferProgress as _, type SpaceRole as a, WebAPI as a0, canExternalClientSendRequests as a1, isExternalClientConnected as a2, type DecryptedSpace as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type PendingTransfer as t, PermissionsAPI as u, type AddBackendRequest as v, type S3Config as w, type S3PublicConfig as x, type StorageBackendInfo as y, type StorageObjectInfo 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-neLTvZJ_.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-TFcm6hpl.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -939,7 +939,7 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
- type SpaceRole = 'admin' | 'member' | 'viewer';
942
+ type SpaceRole = 'admin' | 'owner' | 'member' | 'reader';
943
943
  interface SharedSpace {
944
944
  id: string;
945
945
  ownerId: string;
@@ -947,14 +947,12 @@ interface SharedSpace {
947
947
  nameNonce: string;
948
948
  currentKeyGeneration: number;
949
949
  role: SpaceRole;
950
- canInvite: boolean;
951
950
  createdAt: string;
952
951
  }
953
952
  interface SpaceMemberInfo {
954
953
  publicKey: string;
955
954
  label: string;
956
955
  role: SpaceRole;
957
- canInvite: boolean;
958
956
  invitedBy: string | null;
959
957
  joinedAt: string;
960
958
  }
@@ -993,7 +991,6 @@ interface DecryptedSpace {
993
991
  id: string;
994
992
  name: string;
995
993
  role: SpaceRole;
996
- canInvite: boolean;
997
994
  serverUrl: string;
998
995
  createdAt: string;
999
996
  }
@@ -1174,4 +1171,4 @@ declare class HaexVaultSdk {
1174
1171
  private log;
1175
1172
  }
1176
1173
 
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 };
1174
+ export { type TransferState as $, type AuthorizedClient as A, type BlockedClient as B, type RequestedExtension as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type SelectFileOptions as G, HaexVaultSdk as H, type SelectFolderOptions as I, type ServerInfo as J, type ServerStatus as K, LOCALSEND_EVENTS as L, type SessionAuthorization as M, type SharedSpace as N, type SpaceAccessTokenInfo as O, type PendingAuthorization as P, type SpaceAssignment as Q, RemoteStorageAPI as R, StorageAPI as S, type SpaceInvite as T, type UpdateBackendRequest as U, type SpaceKeyGrantInfo as V, type SpaceMemberInfo as W, SpacesAPI as X, type SyncBackendInfo as Y, type TransferDirection as Z, type TransferProgress as _, type SpaceRole as a, WebAPI as a0, canExternalClientSendRequests as a1, isExternalClientConnected as a2, type DecryptedSpace as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, LocalSendAPI as p, type LocalSendEvent as q, type FileInfo as r, type LocalSendSettings as s, type PendingTransfer as t, PermissionsAPI as u, type AddBackendRequest as v, type S3Config as w, type S3PublicConfig as x, type StorageBackendInfo as y, type StorageObjectInfo as z };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
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';
1
+ import { a as SpaceRole, H as HaexVaultSdk } from './client-CrXV__Zx.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, b as DecryptedSpace, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, L as LOCALSEND_EVENTS, p as LocalSendAPI, q as LocalSendEvent, r as LocalSendFileInfo, s as LocalSendSettings, P as PendingAuthorization, t as PendingTransfer, u as PermissionsAPI, v as RemoteAddBackendRequest, w as RemoteS3Config, x as RemoteS3PublicConfig, R as RemoteStorageAPI, y as RemoteStorageBackendInfo, z as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, C as RequestedExtension, G as SelectFileOptions, I as SelectFolderOptions, J as ServerInfo, K as ServerStatus, M as SessionAuthorization, N as SharedSpace, O as SpaceAccessTokenInfo, Q as SpaceAssignment, T as SpaceInvite, V as SpaceKeyGrantInfo, W as SpaceMemberInfo, X as SpacesAPI, Y as SyncBackendInfo, Z as TransferDirection, _ as TransferProgress, $ as TransferState, a0 as WebAPI, a1 as canExternalClientSendRequests, a2 as isExternalClientConnected } from './client-CrXV__Zx.mjs';
3
+ import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-TFcm6hpl.mjs';
4
+ export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, f as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, g as EventCallback, a as ExtensionInfo, 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, I as IdentityClaim, B as PermissionDeniedError, G as PermissionErrorBase, J as PermissionErrorCode, K as PermissionPromptError, P as PermissionResponse, L as PermissionStatus, N as SearchQuery, O as SearchRequestEvent, S as SearchResult, Q as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, R as getTableName, U as isPermissionDeniedError, V as isPermissionError, X as isPermissionPromptError } from './types-TFcm6hpl.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -88,6 +88,7 @@ declare function installPolyfills(): void;
88
88
  * Types for communicating with the haex-sync-server authentication endpoints.
89
89
  * Used by haex-vault and extensions that need to interact with the sync server.
90
90
  */
91
+
91
92
  /**
92
93
  * S3-compatible storage configuration provided by the sync server.
93
94
  *
@@ -201,8 +202,7 @@ interface CreateSpaceRequest {
201
202
  interface InviteMemberRequest {
202
203
  publicKey: string;
203
204
  label: string;
204
- role: 'member' | 'viewer';
205
- canInvite?: boolean;
205
+ role: SpaceRole;
206
206
  keyGrant: {
207
207
  encryptedSpaceKey: string;
208
208
  keyNonce: string;
@@ -860,6 +860,19 @@ declare function encryptSpaceNameAsync(spaceKey: Uint8Array, spaceName: string):
860
860
  */
861
861
  declare function decryptSpaceNameAsync(spaceKey: Uint8Array, encryptedName: string, nameNonce: string): Promise<string>;
862
862
 
863
+ /**
864
+ * Creates a signed claim presentation for selective disclosure.
865
+ * The server can verify that the claims come from the identity holder.
866
+ *
867
+ * Canonical form for signing: did\0timestamp\0type1=value1\0type2=value2\0...
868
+ * (claims sorted alphabetically by type)
869
+ */
870
+ declare function signClaimPresentationAsync(did: string, publicKeyBase64: string, claims: Record<string, string>, privateKeyBase64: string): Promise<SignedClaimPresentation>;
871
+ /**
872
+ * Verifies a signed claim presentation.
873
+ */
874
+ declare function verifyClaimPresentationAsync(presentation: SignedClaimPresentation): Promise<boolean>;
875
+
863
876
  interface SignableRecord {
864
877
  tableName: string;
865
878
  rowPks: string;
@@ -963,4 +976,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
963
976
 
964
977
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
965
978
 
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, SPACE_COMMANDS, type SignableRecord, type SpaceCommand, 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, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
979
+ 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, SPACE_COMMANDS, type SignableRecord, SignedClaimPresentation, type SpaceCommand, 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, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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';
1
+ import { a as SpaceRole, H as HaexVaultSdk } from './client-DzQv-YCD.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, b as DecryptedSpace, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, L as LOCALSEND_EVENTS, p as LocalSendAPI, q as LocalSendEvent, r as LocalSendFileInfo, s as LocalSendSettings, P as PendingAuthorization, t as PendingTransfer, u as PermissionsAPI, v as RemoteAddBackendRequest, w as RemoteS3Config, x as RemoteS3PublicConfig, R as RemoteStorageAPI, y as RemoteStorageBackendInfo, z as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, C as RequestedExtension, G as SelectFileOptions, I as SelectFolderOptions, J as ServerInfo, K as ServerStatus, M as SessionAuthorization, N as SharedSpace, O as SpaceAccessTokenInfo, Q as SpaceAssignment, T as SpaceInvite, V as SpaceKeyGrantInfo, W as SpaceMemberInfo, X as SpacesAPI, Y as SyncBackendInfo, Z as TransferDirection, _ as TransferProgress, $ as TransferState, a0 as WebAPI, a1 as canExternalClientSendRequests, a2 as isExternalClientConnected } from './client-DzQv-YCD.js';
3
+ import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-TFcm6hpl.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, f as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, g as EventCallback, a as ExtensionInfo, 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, I as IdentityClaim, B as PermissionDeniedError, G as PermissionErrorBase, J as PermissionErrorCode, K as PermissionPromptError, P as PermissionResponse, L as PermissionStatus, N as SearchQuery, O as SearchRequestEvent, S as SearchResult, Q as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, R as getTableName, U as isPermissionDeniedError, V as isPermissionError, X as isPermissionPromptError } from './types-TFcm6hpl.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -88,6 +88,7 @@ declare function installPolyfills(): void;
88
88
  * Types for communicating with the haex-sync-server authentication endpoints.
89
89
  * Used by haex-vault and extensions that need to interact with the sync server.
90
90
  */
91
+
91
92
  /**
92
93
  * S3-compatible storage configuration provided by the sync server.
93
94
  *
@@ -201,8 +202,7 @@ interface CreateSpaceRequest {
201
202
  interface InviteMemberRequest {
202
203
  publicKey: string;
203
204
  label: string;
204
- role: 'member' | 'viewer';
205
- canInvite?: boolean;
205
+ role: SpaceRole;
206
206
  keyGrant: {
207
207
  encryptedSpaceKey: string;
208
208
  keyNonce: string;
@@ -860,6 +860,19 @@ declare function encryptSpaceNameAsync(spaceKey: Uint8Array, spaceName: string):
860
860
  */
861
861
  declare function decryptSpaceNameAsync(spaceKey: Uint8Array, encryptedName: string, nameNonce: string): Promise<string>;
862
862
 
863
+ /**
864
+ * Creates a signed claim presentation for selective disclosure.
865
+ * The server can verify that the claims come from the identity holder.
866
+ *
867
+ * Canonical form for signing: did\0timestamp\0type1=value1\0type2=value2\0...
868
+ * (claims sorted alphabetically by type)
869
+ */
870
+ declare function signClaimPresentationAsync(did: string, publicKeyBase64: string, claims: Record<string, string>, privateKeyBase64: string): Promise<SignedClaimPresentation>;
871
+ /**
872
+ * Verifies a signed claim presentation.
873
+ */
874
+ declare function verifyClaimPresentationAsync(presentation: SignedClaimPresentation): Promise<boolean>;
875
+
863
876
  interface SignableRecord {
864
877
  tableName: string;
865
878
  rowPks: string;
@@ -963,4 +976,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
963
976
 
964
977
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
965
978
 
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, SPACE_COMMANDS, type SignableRecord, type SpaceCommand, 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, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
979
+ 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, SPACE_COMMANDS, type SignableRecord, SignedClaimPresentation, type SpaceCommand, 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, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
package/dist/index.js CHANGED
@@ -3183,6 +3183,42 @@ async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
3183
3183
  return decryptString(encryptedName, nameNonce, cryptoKey);
3184
3184
  }
3185
3185
 
3186
+ // src/crypto/claims.ts
3187
+ init_userKeypair();
3188
+ async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateKeyBase64) {
3189
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
3190
+ const sortedEntries = Object.entries(claims).sort(([a], [b]) => a.localeCompare(b));
3191
+ const canonical = [did, timestamp, ...sortedEntries.map(([k, v]) => `${k}=${v}`)].join("\0");
3192
+ const privateKey = await importUserPrivateKeyAsync(privateKeyBase64);
3193
+ const data = new TextEncoder().encode(canonical);
3194
+ const sig = await crypto.subtle.sign(
3195
+ { name: "ECDSA", hash: "SHA-256" },
3196
+ privateKey,
3197
+ data
3198
+ );
3199
+ return {
3200
+ did,
3201
+ publicKey: publicKeyBase64,
3202
+ claims,
3203
+ timestamp,
3204
+ signature: btoa(String.fromCharCode(...new Uint8Array(sig)))
3205
+ };
3206
+ }
3207
+ async function verifyClaimPresentationAsync(presentation) {
3208
+ const { did, publicKey, claims, timestamp, signature } = presentation;
3209
+ const sortedEntries = Object.entries(claims).sort(([a], [b]) => a.localeCompare(b));
3210
+ const canonical = [did, timestamp, ...sortedEntries.map(([k, v]) => `${k}=${v}`)].join("\0");
3211
+ const pubKey = await importUserPublicKeyAsync(publicKey);
3212
+ const data = new TextEncoder().encode(canonical);
3213
+ const sigBytes = Uint8Array.from(atob(signature), (c) => c.charCodeAt(0));
3214
+ return crypto.subtle.verify(
3215
+ { name: "ECDSA", hash: "SHA-256" },
3216
+ pubKey,
3217
+ sigBytes,
3218
+ data
3219
+ );
3220
+ }
3221
+
3186
3222
  // src/crypto/recordSigning.ts
3187
3223
  init_userKeypair();
3188
3224
  init_vaultKey();
@@ -3490,11 +3526,13 @@ exports.isPermissionDeniedError = isPermissionDeniedError;
3490
3526
  exports.isPermissionError = isPermissionError;
3491
3527
  exports.isPermissionPromptError = isPermissionPromptError;
3492
3528
  exports.publicKeyToDidKeyAsync = publicKeyToDidKeyAsync;
3529
+ exports.signClaimPresentationAsync = signClaimPresentationAsync;
3493
3530
  exports.signRecordAsync = signRecordAsync;
3494
3531
  exports.signSpaceChallengeAsync = signSpaceChallengeAsync;
3495
3532
  exports.signWithPasskeyAsync = signWithPasskeyAsync;
3496
3533
  exports.sortObjectKeysRecursively = sortObjectKeysRecursively;
3497
3534
  exports.unwrapKey = unwrapKey;
3535
+ exports.verifyClaimPresentationAsync = verifyClaimPresentationAsync;
3498
3536
  exports.verifyExtensionSignature = verifyExtensionSignature;
3499
3537
  exports.verifyRecordSignatureAsync = verifyRecordSignatureAsync;
3500
3538
  exports.verifySpaceChallengeAsync = verifySpaceChallengeAsync;