@haex-space/vault-sdk 2.5.118 → 2.5.119

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_.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.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -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.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
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 { H as HaexVaultSdk } from './client-CJTSbNLI.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-CJTSbNLI.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
 
@@ -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, 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 { H as HaexVaultSdk } from './client-E86CS0KK.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-E86CS0KK.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
 
@@ -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, 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;