@haex-space/vault-sdk 2.7.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-3B1iWut9.d.ts → client-CQFc6DMu.d.ts} +6 -12
- package/dist/{client-BUsw25aA.d.mts → client-DdGvtNj_.d.mts} +6 -12
- package/dist/index.d.mts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +48 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -110
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -25
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -25
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +1 -1
- package/dist/runtime/nuxt.plugin.client.d.ts +1 -1
- package/dist/runtime/nuxt.plugin.client.js +1 -25
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +1 -25
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +1 -25
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +1 -25
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +1 -25
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +1 -25
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1044,6 +1044,12 @@ interface SpaceAssignment {
|
|
|
1044
1044
|
rowPks: string;
|
|
1045
1045
|
/** The shared space ID this row is assigned to */
|
|
1046
1046
|
spaceId: string;
|
|
1047
|
+
/** Optional group identifier for logically related assignments (e.g. a calendar ID groups the calendar row + all its event rows) */
|
|
1048
|
+
groupId?: string;
|
|
1049
|
+
/** Optional type label for display categorization (e.g. "Calendar", "Password Folder") */
|
|
1050
|
+
type?: string;
|
|
1051
|
+
/** Optional display label (e.g. "Personal", "Team Q1") */
|
|
1052
|
+
label?: string;
|
|
1047
1053
|
}
|
|
1048
1054
|
/**
|
|
1049
1055
|
* Spaces API for managing row-to-space assignments.
|
|
@@ -1110,18 +1116,6 @@ declare class SpacesAPI {
|
|
|
1110
1116
|
* Returns spaces with decrypted names (decryption happens vault-side).
|
|
1111
1117
|
*/
|
|
1112
1118
|
listSpacesAsync(): Promise<DecryptedSpace[]>;
|
|
1113
|
-
/**
|
|
1114
|
-
* Create a new shared space.
|
|
1115
|
-
* @param name - Human-readable space name
|
|
1116
|
-
* @param serverUrl - The sync server URL to create the space on
|
|
1117
|
-
* @returns The created space with decrypted name
|
|
1118
|
-
*/
|
|
1119
|
-
createSpaceAsync(name: string, serverUrl: string): Promise<DecryptedSpace>;
|
|
1120
|
-
/**
|
|
1121
|
-
* List available sync backends that can host shared spaces.
|
|
1122
|
-
* @returns Array of backend info with server URLs
|
|
1123
|
-
*/
|
|
1124
|
-
listSyncBackendsAsync(): Promise<SyncBackendInfo[]>;
|
|
1125
1119
|
}
|
|
1126
1120
|
|
|
1127
1121
|
interface ShellCreateOptions {
|
|
@@ -1044,6 +1044,12 @@ interface SpaceAssignment {
|
|
|
1044
1044
|
rowPks: string;
|
|
1045
1045
|
/** The shared space ID this row is assigned to */
|
|
1046
1046
|
spaceId: string;
|
|
1047
|
+
/** Optional group identifier for logically related assignments (e.g. a calendar ID groups the calendar row + all its event rows) */
|
|
1048
|
+
groupId?: string;
|
|
1049
|
+
/** Optional type label for display categorization (e.g. "Calendar", "Password Folder") */
|
|
1050
|
+
type?: string;
|
|
1051
|
+
/** Optional display label (e.g. "Personal", "Team Q1") */
|
|
1052
|
+
label?: string;
|
|
1047
1053
|
}
|
|
1048
1054
|
/**
|
|
1049
1055
|
* Spaces API for managing row-to-space assignments.
|
|
@@ -1110,18 +1116,6 @@ declare class SpacesAPI {
|
|
|
1110
1116
|
* Returns spaces with decrypted names (decryption happens vault-side).
|
|
1111
1117
|
*/
|
|
1112
1118
|
listSpacesAsync(): Promise<DecryptedSpace[]>;
|
|
1113
|
-
/**
|
|
1114
|
-
* Create a new shared space.
|
|
1115
|
-
* @param name - Human-readable space name
|
|
1116
|
-
* @param serverUrl - The sync server URL to create the space on
|
|
1117
|
-
* @returns The created space with decrypted name
|
|
1118
|
-
*/
|
|
1119
|
-
createSpaceAsync(name: string, serverUrl: string): Promise<DecryptedSpace>;
|
|
1120
|
-
/**
|
|
1121
|
-
* List available sync backends that can host shared spaces.
|
|
1122
|
-
* @returns Array of backend info with server URLs
|
|
1123
|
-
*/
|
|
1124
|
-
listSyncBackendsAsync(): Promise<SyncBackendInfo[]>;
|
|
1125
1119
|
}
|
|
1126
1120
|
|
|
1127
1121
|
interface ShellCreateOptions {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as SpaceRole, H as HaexVaultSdk } from './client-
|
|
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, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, P as PendingAuthorization, u as PendingTransfer, v as PermissionsAPI, w as RemoteAddBackendRequest, x as RemoteS3Config, y as RemoteS3PublicConfig, R as RemoteStorageAPI, z as RemoteStorageBackendInfo, C as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, G as RequestedExtension, I as SelectFileOptions, J as SelectFolderOptions, M as ServerInfo, N as ServerStatus, O as SessionAuthorization, Q as SharedSpace, T as ShellAPI, V as ShellCreateOptions, W as ShellCreateResponse, X as ShellExitEvent, Y as ShellOutputEvent, Z as SpaceAccessTokenInfo, _ as SpaceAssignment, $ as SpaceInvite, a0 as SpaceKeyGrantInfo, a1 as SpaceMemberInfo, a2 as SpaceRoles, a3 as SpacesAPI, a4 as SyncBackendInfo, a5 as TransferDirection, a6 as TransferProgress, a7 as TransferState, a8 as WebAPI, a9 as canExternalClientSendRequests, aa as isExternalClientConnected } from './client-
|
|
1
|
+
import { a as SpaceRole, H as HaexVaultSdk } from './client-DdGvtNj_.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, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, P as PendingAuthorization, u as PendingTransfer, v as PermissionsAPI, w as RemoteAddBackendRequest, x as RemoteS3Config, y as RemoteS3PublicConfig, R as RemoteStorageAPI, z as RemoteStorageBackendInfo, C as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, G as RequestedExtension, I as SelectFileOptions, J as SelectFolderOptions, M as ServerInfo, N as ServerStatus, O as SessionAuthorization, Q as SharedSpace, T as ShellAPI, V as ShellCreateOptions, W as ShellCreateResponse, X as ShellExitEvent, Y as ShellOutputEvent, Z as SpaceAccessTokenInfo, _ as SpaceAssignment, $ as SpaceInvite, a0 as SpaceKeyGrantInfo, a1 as SpaceMemberInfo, a2 as SpaceRoles, a3 as SpacesAPI, a4 as SyncBackendInfo, a5 as TransferDirection, a6 as TransferProgress, a7 as TransferState, a8 as WebAPI, a9 as canExternalClientSendRequests, aa as isExternalClientConnected } from './client-DdGvtNj_.mjs';
|
|
3
3
|
import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-DmCSegdY.mjs';
|
|
4
4
|
export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, 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 ManifestI18nEntry, G as PermissionDeniedError, J as PermissionErrorBase, K as PermissionErrorCode, L as PermissionPromptError, P as PermissionResponse, N as PermissionStatus, O as SHELL_EVENTS, Q as SearchQuery, R as SearchRequestEvent, S as SearchResult, T as ShellEvent, U as SyncTablesUpdatedEvent, V as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, X as getTableName, Y as isPermissionDeniedError, Z as isPermissionError, _ as isPermissionPromptError } from './types-DmCSegdY.mjs';
|
|
5
5
|
export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
|
|
@@ -814,21 +814,19 @@ declare function decryptCrdtData<T = object>(encryptedData: string, nonce: strin
|
|
|
814
814
|
declare function arrayBufferToBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
815
815
|
declare function base64ToArrayBuffer(base64: string): Uint8Array<ArrayBuffer>;
|
|
816
816
|
|
|
817
|
-
declare const SIGNING_ALGO:
|
|
818
|
-
|
|
819
|
-
namedCurve: string;
|
|
820
|
-
};
|
|
821
|
-
declare const KEY_AGREEMENT_ALGO: {
|
|
822
|
-
name: string;
|
|
823
|
-
namedCurve: string;
|
|
824
|
-
};
|
|
817
|
+
declare const SIGNING_ALGO: Algorithm;
|
|
818
|
+
declare const KEY_AGREEMENT_ALGO: Algorithm;
|
|
825
819
|
interface UserKeypair {
|
|
826
|
-
|
|
827
|
-
|
|
820
|
+
signingPublicKey: CryptoKey;
|
|
821
|
+
signingPrivateKey: CryptoKey;
|
|
822
|
+
agreementPublicKey: CryptoKey;
|
|
823
|
+
agreementPrivateKey: CryptoKey;
|
|
828
824
|
}
|
|
829
825
|
interface ExportedUserKeypair {
|
|
830
|
-
|
|
831
|
-
|
|
826
|
+
signingPublicKey: string;
|
|
827
|
+
signingPrivateKey: string;
|
|
828
|
+
agreementPublicKey: string;
|
|
829
|
+
agreementPrivateKey: string;
|
|
832
830
|
}
|
|
833
831
|
declare function generateUserKeypairAsync(): Promise<UserKeypair>;
|
|
834
832
|
declare function exportUserKeypairAsync(keypair: UserKeypair): Promise<ExportedUserKeypair>;
|
|
@@ -848,26 +846,28 @@ declare function base58btcDecode(str: string): Uint8Array;
|
|
|
848
846
|
/**
|
|
849
847
|
* Convert a Base64-encoded SPKI public key to a `did:key` identifier.
|
|
850
848
|
*
|
|
851
|
-
* @param publicKeyBase64 - Base64-encoded SPKI public key (
|
|
852
|
-
* @returns DID string, e.g. `did:key:
|
|
849
|
+
* @param publicKeyBase64 - Base64-encoded SPKI public key (Ed25519)
|
|
850
|
+
* @returns DID string, e.g. `did:key:z6Mk...`
|
|
853
851
|
*/
|
|
854
852
|
declare function publicKeyToDidKeyAsync(publicKeyBase64: string): Promise<string>;
|
|
855
853
|
/**
|
|
856
854
|
* Extract a Base64-encoded SPKI public key from a `did:key` identifier.
|
|
857
855
|
*
|
|
858
|
-
* @param did - DID string, e.g. `did:key:
|
|
856
|
+
* @param did - DID string, e.g. `did:key:z6Mk...`
|
|
859
857
|
* @returns Base64-encoded SPKI public key
|
|
860
858
|
*/
|
|
861
859
|
declare function didKeyToPublicKeyAsync(did: string): Promise<string>;
|
|
862
860
|
/**
|
|
863
861
|
* Generate a fresh identity keypair and return it with its did:key.
|
|
864
862
|
*
|
|
865
|
-
* @returns { did,
|
|
863
|
+
* @returns { did, signingPublicKey, signingPrivateKey, agreementPublicKey, agreementPrivateKey }
|
|
866
864
|
*/
|
|
867
865
|
declare function generateIdentityAsync(): Promise<{
|
|
868
866
|
did: string;
|
|
869
|
-
|
|
870
|
-
|
|
867
|
+
signingPublicKey: string;
|
|
868
|
+
signingPrivateKey: string;
|
|
869
|
+
agreementPublicKey: string;
|
|
870
|
+
agreementPrivateKey: string;
|
|
871
871
|
}>;
|
|
872
872
|
|
|
873
873
|
interface SealedData {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as SpaceRole, H as HaexVaultSdk } from './client-
|
|
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, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, P as PendingAuthorization, u as PendingTransfer, v as PermissionsAPI, w as RemoteAddBackendRequest, x as RemoteS3Config, y as RemoteS3PublicConfig, R as RemoteStorageAPI, z as RemoteStorageBackendInfo, C as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, G as RequestedExtension, I as SelectFileOptions, J as SelectFolderOptions, M as ServerInfo, N as ServerStatus, O as SessionAuthorization, Q as SharedSpace, T as ShellAPI, V as ShellCreateOptions, W as ShellCreateResponse, X as ShellExitEvent, Y as ShellOutputEvent, Z as SpaceAccessTokenInfo, _ as SpaceAssignment, $ as SpaceInvite, a0 as SpaceKeyGrantInfo, a1 as SpaceMemberInfo, a2 as SpaceRoles, a3 as SpacesAPI, a4 as SyncBackendInfo, a5 as TransferDirection, a6 as TransferProgress, a7 as TransferState, a8 as WebAPI, a9 as canExternalClientSendRequests, aa as isExternalClientConnected } from './client-
|
|
1
|
+
import { a as SpaceRole, H as HaexVaultSdk } from './client-CQFc6DMu.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, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, P as PendingAuthorization, u as PendingTransfer, v as PermissionsAPI, w as RemoteAddBackendRequest, x as RemoteS3Config, y as RemoteS3PublicConfig, R as RemoteStorageAPI, z as RemoteStorageBackendInfo, C as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, G as RequestedExtension, I as SelectFileOptions, J as SelectFolderOptions, M as ServerInfo, N as ServerStatus, O as SessionAuthorization, Q as SharedSpace, T as ShellAPI, V as ShellCreateOptions, W as ShellCreateResponse, X as ShellExitEvent, Y as ShellOutputEvent, Z as SpaceAccessTokenInfo, _ as SpaceAssignment, $ as SpaceInvite, a0 as SpaceKeyGrantInfo, a1 as SpaceMemberInfo, a2 as SpaceRoles, a3 as SpacesAPI, a4 as SyncBackendInfo, a5 as TransferDirection, a6 as TransferProgress, a7 as TransferState, a8 as WebAPI, a9 as canExternalClientSendRequests, aa as isExternalClientConnected } from './client-CQFc6DMu.js';
|
|
3
3
|
import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-DmCSegdY.js';
|
|
4
4
|
export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, 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 ManifestI18nEntry, G as PermissionDeniedError, J as PermissionErrorBase, K as PermissionErrorCode, L as PermissionPromptError, P as PermissionResponse, N as PermissionStatus, O as SHELL_EVENTS, Q as SearchQuery, R as SearchRequestEvent, S as SearchResult, T as ShellEvent, U as SyncTablesUpdatedEvent, V as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, X as getTableName, Y as isPermissionDeniedError, Z as isPermissionError, _ as isPermissionPromptError } from './types-DmCSegdY.js';
|
|
5
5
|
export { H as HaextensionConfig } from './config-D_HXjsEV.js';
|
|
@@ -814,21 +814,19 @@ declare function decryptCrdtData<T = object>(encryptedData: string, nonce: strin
|
|
|
814
814
|
declare function arrayBufferToBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
815
815
|
declare function base64ToArrayBuffer(base64: string): Uint8Array<ArrayBuffer>;
|
|
816
816
|
|
|
817
|
-
declare const SIGNING_ALGO:
|
|
818
|
-
|
|
819
|
-
namedCurve: string;
|
|
820
|
-
};
|
|
821
|
-
declare const KEY_AGREEMENT_ALGO: {
|
|
822
|
-
name: string;
|
|
823
|
-
namedCurve: string;
|
|
824
|
-
};
|
|
817
|
+
declare const SIGNING_ALGO: Algorithm;
|
|
818
|
+
declare const KEY_AGREEMENT_ALGO: Algorithm;
|
|
825
819
|
interface UserKeypair {
|
|
826
|
-
|
|
827
|
-
|
|
820
|
+
signingPublicKey: CryptoKey;
|
|
821
|
+
signingPrivateKey: CryptoKey;
|
|
822
|
+
agreementPublicKey: CryptoKey;
|
|
823
|
+
agreementPrivateKey: CryptoKey;
|
|
828
824
|
}
|
|
829
825
|
interface ExportedUserKeypair {
|
|
830
|
-
|
|
831
|
-
|
|
826
|
+
signingPublicKey: string;
|
|
827
|
+
signingPrivateKey: string;
|
|
828
|
+
agreementPublicKey: string;
|
|
829
|
+
agreementPrivateKey: string;
|
|
832
830
|
}
|
|
833
831
|
declare function generateUserKeypairAsync(): Promise<UserKeypair>;
|
|
834
832
|
declare function exportUserKeypairAsync(keypair: UserKeypair): Promise<ExportedUserKeypair>;
|
|
@@ -848,26 +846,28 @@ declare function base58btcDecode(str: string): Uint8Array;
|
|
|
848
846
|
/**
|
|
849
847
|
* Convert a Base64-encoded SPKI public key to a `did:key` identifier.
|
|
850
848
|
*
|
|
851
|
-
* @param publicKeyBase64 - Base64-encoded SPKI public key (
|
|
852
|
-
* @returns DID string, e.g. `did:key:
|
|
849
|
+
* @param publicKeyBase64 - Base64-encoded SPKI public key (Ed25519)
|
|
850
|
+
* @returns DID string, e.g. `did:key:z6Mk...`
|
|
853
851
|
*/
|
|
854
852
|
declare function publicKeyToDidKeyAsync(publicKeyBase64: string): Promise<string>;
|
|
855
853
|
/**
|
|
856
854
|
* Extract a Base64-encoded SPKI public key from a `did:key` identifier.
|
|
857
855
|
*
|
|
858
|
-
* @param did - DID string, e.g. `did:key:
|
|
856
|
+
* @param did - DID string, e.g. `did:key:z6Mk...`
|
|
859
857
|
* @returns Base64-encoded SPKI public key
|
|
860
858
|
*/
|
|
861
859
|
declare function didKeyToPublicKeyAsync(did: string): Promise<string>;
|
|
862
860
|
/**
|
|
863
861
|
* Generate a fresh identity keypair and return it with its did:key.
|
|
864
862
|
*
|
|
865
|
-
* @returns { did,
|
|
863
|
+
* @returns { did, signingPublicKey, signingPrivateKey, agreementPublicKey, agreementPrivateKey }
|
|
866
864
|
*/
|
|
867
865
|
declare function generateIdentityAsync(): Promise<{
|
|
868
866
|
did: string;
|
|
869
|
-
|
|
870
|
-
|
|
867
|
+
signingPublicKey: string;
|
|
868
|
+
signingPrivateKey: string;
|
|
869
|
+
agreementPublicKey: string;
|
|
870
|
+
agreementPrivateKey: string;
|
|
871
871
|
}>;
|
|
872
872
|
|
|
873
873
|
interface SealedData {
|
package/dist/index.js
CHANGED
|
@@ -250,13 +250,28 @@ __export(userKeypair_exports, {
|
|
|
250
250
|
importUserPublicKeyAsync: () => importUserPublicKeyAsync
|
|
251
251
|
});
|
|
252
252
|
async function generateUserKeypairAsync() {
|
|
253
|
-
const
|
|
254
|
-
|
|
253
|
+
const signing = await crypto.subtle.generateKey(exports.SIGNING_ALGO, true, ["sign", "verify"]);
|
|
254
|
+
const agreement = await crypto.subtle.generateKey(exports.KEY_AGREEMENT_ALGO, true, ["deriveBits"]);
|
|
255
|
+
return {
|
|
256
|
+
signingPublicKey: signing.publicKey,
|
|
257
|
+
signingPrivateKey: signing.privateKey,
|
|
258
|
+
agreementPublicKey: agreement.publicKey,
|
|
259
|
+
agreementPrivateKey: agreement.privateKey
|
|
260
|
+
};
|
|
255
261
|
}
|
|
256
262
|
async function exportUserKeypairAsync(keypair) {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
263
|
+
const [sigPub, sigPriv, agrPub, agrPriv] = await Promise.all([
|
|
264
|
+
crypto.subtle.exportKey("spki", keypair.signingPublicKey),
|
|
265
|
+
crypto.subtle.exportKey("pkcs8", keypair.signingPrivateKey),
|
|
266
|
+
crypto.subtle.exportKey("spki", keypair.agreementPublicKey),
|
|
267
|
+
crypto.subtle.exportKey("pkcs8", keypair.agreementPrivateKey)
|
|
268
|
+
]);
|
|
269
|
+
return {
|
|
270
|
+
signingPublicKey: arrayBufferToBase64(sigPub),
|
|
271
|
+
signingPrivateKey: arrayBufferToBase64(sigPriv),
|
|
272
|
+
agreementPublicKey: arrayBufferToBase64(agrPub),
|
|
273
|
+
agreementPrivateKey: arrayBufferToBase64(agrPriv)
|
|
274
|
+
};
|
|
260
275
|
}
|
|
261
276
|
async function importUserPublicKeyAsync(base64) {
|
|
262
277
|
return crypto.subtle.importKey("spki", base64ToArrayBuffer(base64), exports.SIGNING_ALGO, true, ["verify"]);
|
|
@@ -298,8 +313,8 @@ exports.SIGNING_ALGO = void 0; exports.KEY_AGREEMENT_ALGO = void 0;
|
|
|
298
313
|
var init_userKeypair = __esm({
|
|
299
314
|
"src/crypto/userKeypair.ts"() {
|
|
300
315
|
init_vaultKey();
|
|
301
|
-
exports.SIGNING_ALGO = { name: "
|
|
302
|
-
exports.KEY_AGREEMENT_ALGO = { name: "
|
|
316
|
+
exports.SIGNING_ALGO = { name: "Ed25519" };
|
|
317
|
+
exports.KEY_AGREEMENT_ALGO = { name: "X25519" };
|
|
303
318
|
}
|
|
304
319
|
});
|
|
305
320
|
|
|
@@ -1900,25 +1915,6 @@ var SpacesAPI = class {
|
|
|
1900
1915
|
async listSpacesAsync() {
|
|
1901
1916
|
return this.client.request(SPACE_COMMANDS.list);
|
|
1902
1917
|
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Create a new shared space.
|
|
1905
|
-
* @param name - Human-readable space name
|
|
1906
|
-
* @param serverUrl - The sync server URL to create the space on
|
|
1907
|
-
* @returns The created space with decrypted name
|
|
1908
|
-
*/
|
|
1909
|
-
async createSpaceAsync(name, serverUrl) {
|
|
1910
|
-
return this.client.request(SPACE_COMMANDS.create, {
|
|
1911
|
-
spaceName: name,
|
|
1912
|
-
serverUrl
|
|
1913
|
-
});
|
|
1914
|
-
}
|
|
1915
|
-
/**
|
|
1916
|
-
* List available sync backends that can host shared spaces.
|
|
1917
|
-
* @returns Array of backend info with server URLs
|
|
1918
|
-
*/
|
|
1919
|
-
async listSyncBackendsAsync() {
|
|
1920
|
-
return this.client.request(SPACE_COMMANDS.listBackends);
|
|
1921
|
-
}
|
|
1922
1918
|
};
|
|
1923
1919
|
|
|
1924
1920
|
// src/api/shell.ts
|
|
@@ -3193,76 +3189,17 @@ function base58btcDecode(str) {
|
|
|
3193
3189
|
}
|
|
3194
3190
|
return result;
|
|
3195
3191
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
throw new Error("Expected 65-byte uncompressed P-256 point (0x04 prefix)");
|
|
3199
|
-
}
|
|
3200
|
-
const x = uncompressed.slice(1, 33);
|
|
3201
|
-
const yLastByte = uncompressed[64];
|
|
3202
|
-
const prefix = (yLastByte & 1) === 0 ? 2 : 3;
|
|
3203
|
-
const compressed = new Uint8Array(33);
|
|
3204
|
-
compressed[0] = prefix;
|
|
3205
|
-
compressed.set(x, 1);
|
|
3206
|
-
return compressed;
|
|
3207
|
-
}
|
|
3208
|
-
function decompressP256Point(compressed) {
|
|
3209
|
-
if (compressed.length !== 33 || compressed[0] !== 2 && compressed[0] !== 3) {
|
|
3210
|
-
throw new Error("Expected 33-byte compressed P-256 point");
|
|
3211
|
-
}
|
|
3212
|
-
const isOdd = compressed[0] === 3;
|
|
3213
|
-
const x = bytesToBigInt(compressed.slice(1));
|
|
3214
|
-
const p = BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff");
|
|
3215
|
-
const b = BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");
|
|
3216
|
-
const a = p - 3n;
|
|
3217
|
-
const ySquared = (modPow(x, 3n, p) + a * x + b) % p;
|
|
3218
|
-
let y = modSqrt(ySquared, p);
|
|
3219
|
-
const yIsOdd = (y & 1n) === 1n;
|
|
3220
|
-
if (isOdd !== yIsOdd) {
|
|
3221
|
-
y = p - y;
|
|
3222
|
-
}
|
|
3223
|
-
const uncompressed = new Uint8Array(65);
|
|
3224
|
-
uncompressed[0] = 4;
|
|
3225
|
-
uncompressed.set(bigIntToBytes(x, 32), 1);
|
|
3226
|
-
uncompressed.set(bigIntToBytes(y, 32), 33);
|
|
3227
|
-
return uncompressed;
|
|
3228
|
-
}
|
|
3229
|
-
function bytesToBigInt(bytes) {
|
|
3230
|
-
let result = 0n;
|
|
3231
|
-
for (const b of bytes) {
|
|
3232
|
-
result = result << 8n | BigInt(b);
|
|
3233
|
-
}
|
|
3234
|
-
return result;
|
|
3235
|
-
}
|
|
3236
|
-
function bigIntToBytes(n, length) {
|
|
3237
|
-
const bytes = new Uint8Array(length);
|
|
3238
|
-
let val = n;
|
|
3239
|
-
for (let i = length - 1; i >= 0; i--) {
|
|
3240
|
-
bytes[i] = Number(val & 0xffn);
|
|
3241
|
-
val >>= 8n;
|
|
3242
|
-
}
|
|
3243
|
-
return bytes;
|
|
3244
|
-
}
|
|
3245
|
-
function modPow(base, exp, mod) {
|
|
3246
|
-
let result = 1n;
|
|
3247
|
-
base = base % mod;
|
|
3248
|
-
while (exp > 0n) {
|
|
3249
|
-
if (exp & 1n) result = result * base % mod;
|
|
3250
|
-
exp >>= 1n;
|
|
3251
|
-
base = base * base % mod;
|
|
3252
|
-
}
|
|
3253
|
-
return result;
|
|
3254
|
-
}
|
|
3255
|
-
function modSqrt(a, p) {
|
|
3256
|
-
return modPow(a, (p + 1n) / 4n, p);
|
|
3257
|
-
}
|
|
3258
|
-
var P256_MULTICODEC_PREFIX = new Uint8Array([128, 36]);
|
|
3192
|
+
var ED25519_MULTICODEC_PREFIX = new Uint8Array([237, 1]);
|
|
3193
|
+
var ED25519_PUBLIC_KEY_LENGTH = 32;
|
|
3259
3194
|
async function publicKeyToDidKeyAsync(publicKeyBase64) {
|
|
3260
3195
|
const cryptoKey = await importUserPublicKeyAsync(publicKeyBase64);
|
|
3261
3196
|
const rawBytes = new Uint8Array(await crypto.subtle.exportKey("raw", cryptoKey));
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
multicodecBytes.
|
|
3197
|
+
if (rawBytes.length !== ED25519_PUBLIC_KEY_LENGTH) {
|
|
3198
|
+
throw new Error(`Expected ${ED25519_PUBLIC_KEY_LENGTH}-byte Ed25519 public key, got ${rawBytes.length}`);
|
|
3199
|
+
}
|
|
3200
|
+
const multicodecBytes = new Uint8Array(ED25519_MULTICODEC_PREFIX.length + rawBytes.length);
|
|
3201
|
+
multicodecBytes.set(ED25519_MULTICODEC_PREFIX);
|
|
3202
|
+
multicodecBytes.set(rawBytes, ED25519_MULTICODEC_PREFIX.length);
|
|
3266
3203
|
return `did:key:z${base58btcEncode(multicodecBytes)}`;
|
|
3267
3204
|
}
|
|
3268
3205
|
async function didKeyToPublicKeyAsync(did) {
|
|
@@ -3270,15 +3207,17 @@ async function didKeyToPublicKeyAsync(did) {
|
|
|
3270
3207
|
throw new Error("Only did:key with base58-btc multibase (z prefix) is supported");
|
|
3271
3208
|
}
|
|
3272
3209
|
const multicodecBytes = base58btcDecode(did.slice("did:key:z".length));
|
|
3273
|
-
if (multicodecBytes[0] !==
|
|
3274
|
-
throw new Error("Unsupported key type in did:key (expected
|
|
3210
|
+
if (multicodecBytes[0] !== ED25519_MULTICODEC_PREFIX[0] || multicodecBytes[1] !== ED25519_MULTICODEC_PREFIX[1]) {
|
|
3211
|
+
throw new Error("Unsupported key type in did:key (expected Ed25519)");
|
|
3212
|
+
}
|
|
3213
|
+
const rawKey = multicodecBytes.slice(ED25519_MULTICODEC_PREFIX.length);
|
|
3214
|
+
if (rawKey.length !== ED25519_PUBLIC_KEY_LENGTH) {
|
|
3215
|
+
throw new Error(`Invalid Ed25519 public key length: ${rawKey.length}`);
|
|
3275
3216
|
}
|
|
3276
|
-
const compressed = multicodecBytes.slice(P256_MULTICODEC_PREFIX.length);
|
|
3277
|
-
const uncompressed = decompressP256Point(compressed);
|
|
3278
3217
|
const cryptoKey = await crypto.subtle.importKey(
|
|
3279
3218
|
"raw",
|
|
3280
|
-
|
|
3281
|
-
|
|
3219
|
+
rawKey.buffer,
|
|
3220
|
+
exports.SIGNING_ALGO,
|
|
3282
3221
|
true,
|
|
3283
3222
|
["verify"]
|
|
3284
3223
|
);
|
|
@@ -3289,11 +3228,10 @@ async function generateIdentityAsync() {
|
|
|
3289
3228
|
const { generateUserKeypairAsync: generateUserKeypairAsync2, exportUserKeypairAsync: exportUserKeypairAsync2 } = await Promise.resolve().then(() => (init_userKeypair(), userKeypair_exports));
|
|
3290
3229
|
const keypair = await generateUserKeypairAsync2();
|
|
3291
3230
|
const exported = await exportUserKeypairAsync2(keypair);
|
|
3292
|
-
const did = await publicKeyToDidKeyAsync(exported.
|
|
3231
|
+
const did = await publicKeyToDidKeyAsync(exported.signingPublicKey);
|
|
3293
3232
|
return {
|
|
3294
3233
|
did,
|
|
3295
|
-
|
|
3296
|
-
privateKeyBase64: exported.privateKey
|
|
3234
|
+
...exported
|
|
3297
3235
|
};
|
|
3298
3236
|
}
|
|
3299
3237
|
|
|
@@ -3307,7 +3245,7 @@ async function encryptWithPublicKeyAsync(data, recipientPublicKeyBase64) {
|
|
|
3307
3245
|
const ephemeral = await crypto.subtle.generateKey(exports.KEY_AGREEMENT_ALGO, true, ["deriveBits"]);
|
|
3308
3246
|
const recipientKey = await importPublicKeyForKeyAgreementAsync(recipientPublicKeyBase64);
|
|
3309
3247
|
const sharedBits = await crypto.subtle.deriveBits(
|
|
3310
|
-
{
|
|
3248
|
+
{ ...exports.KEY_AGREEMENT_ALGO, public: recipientKey },
|
|
3311
3249
|
ephemeral.privateKey,
|
|
3312
3250
|
256
|
|
3313
3251
|
);
|
|
@@ -3342,7 +3280,7 @@ async function decryptWithPrivateKeyAsync(sealed, ownPrivateKeyBase64) {
|
|
|
3342
3280
|
);
|
|
3343
3281
|
const ownPrivKey = await importPrivateKeyForKeyAgreementAsync(ownPrivateKeyBase64);
|
|
3344
3282
|
const sharedBits = await crypto.subtle.deriveBits(
|
|
3345
|
-
{
|
|
3283
|
+
{ ...exports.KEY_AGREEMENT_ALGO, public: ephPubKey },
|
|
3346
3284
|
ownPrivKey,
|
|
3347
3285
|
256
|
|
3348
3286
|
);
|
|
@@ -3396,7 +3334,7 @@ async function signClaimPresentationAsync(did, publicKeyBase64, claims, privateK
|
|
|
3396
3334
|
const privateKey = await importUserPrivateKeyAsync(privateKeyBase64);
|
|
3397
3335
|
const data = new TextEncoder().encode(canonical);
|
|
3398
3336
|
const sig = await crypto.subtle.sign(
|
|
3399
|
-
|
|
3337
|
+
exports.SIGNING_ALGO,
|
|
3400
3338
|
privateKey,
|
|
3401
3339
|
data
|
|
3402
3340
|
);
|
|
@@ -3416,7 +3354,7 @@ async function verifyClaimPresentationAsync(presentation) {
|
|
|
3416
3354
|
const data = new TextEncoder().encode(canonical);
|
|
3417
3355
|
const sigBytes = Uint8Array.from(atob(signature), (c) => c.charCodeAt(0));
|
|
3418
3356
|
return crypto.subtle.verify(
|
|
3419
|
-
|
|
3357
|
+
exports.SIGNING_ALGO,
|
|
3420
3358
|
pubKey,
|
|
3421
3359
|
sigBytes,
|
|
3422
3360
|
data
|
|
@@ -3438,13 +3376,13 @@ function canonicalize(record) {
|
|
|
3438
3376
|
}
|
|
3439
3377
|
async function signRecordAsync(record, privateKeyBase64) {
|
|
3440
3378
|
const key = await importUserPrivateKeyAsync(privateKeyBase64);
|
|
3441
|
-
const sig = await crypto.subtle.sign(
|
|
3379
|
+
const sig = await crypto.subtle.sign(exports.SIGNING_ALGO, key, canonicalize(record));
|
|
3442
3380
|
return arrayBufferToBase64(sig);
|
|
3443
3381
|
}
|
|
3444
3382
|
async function verifyRecordSignatureAsync(record, signatureBase64, publicKeyBase64) {
|
|
3445
3383
|
const key = await importUserPublicKeyAsync(publicKeyBase64);
|
|
3446
3384
|
return crypto.subtle.verify(
|
|
3447
|
-
|
|
3385
|
+
exports.SIGNING_ALGO,
|
|
3448
3386
|
key,
|
|
3449
3387
|
base64ToArrayBuffer(signatureBase64),
|
|
3450
3388
|
canonicalize(record)
|
|
@@ -3458,7 +3396,7 @@ async function signSpaceChallengeAsync(spaceId, privateKeyBase64) {
|
|
|
3458
3396
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
3459
3397
|
const key = await importUserPrivateKeyAsync(privateKeyBase64);
|
|
3460
3398
|
const sig = await crypto.subtle.sign(
|
|
3461
|
-
|
|
3399
|
+
exports.SIGNING_ALGO,
|
|
3462
3400
|
key,
|
|
3463
3401
|
canonicalizeChallenge(spaceId, timestamp)
|
|
3464
3402
|
);
|
|
@@ -3476,7 +3414,7 @@ async function verifySpaceChallengeAsync(spaceId, timestamp, signatureBase64, pu
|
|
|
3476
3414
|
try {
|
|
3477
3415
|
const key = await importUserPublicKeyAsync(publicKeyBase64);
|
|
3478
3416
|
const isValid = await crypto.subtle.verify(
|
|
3479
|
-
|
|
3417
|
+
exports.SIGNING_ALGO,
|
|
3480
3418
|
key,
|
|
3481
3419
|
base64ToArrayBuffer(signatureBase64),
|
|
3482
3420
|
canonicalizeChallenge(spaceId, timestamp)
|