@haex-space/vault-sdk 2.5.112 → 2.5.113
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-GPE112vL.d.mts → client-Dfy9UQeu.d.mts} +87 -1
- package/dist/{client-BVMJXZiK.d.ts → client-Dhn288AJ.d.ts} +87 -1
- package/dist/index.d.mts +24 -50
- package/dist/index.d.ts +24 -50
- package/dist/index.js +67 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -10
- 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 +44 -9
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +44 -9
- 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 +44 -9
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +44 -9
- 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 +44 -9
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +44 -9
- 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 +44 -9
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +44 -9
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -681,7 +681,13 @@ var SPACE_COMMANDS = {
|
|
|
681
681
|
/** Bulk unassign rows from spaces */
|
|
682
682
|
unassign: "extension_space_unassign",
|
|
683
683
|
/** Get space assignments for a table */
|
|
684
|
-
getAssignments: "extension_space_get_assignments"
|
|
684
|
+
getAssignments: "extension_space_get_assignments",
|
|
685
|
+
/** List all spaces the user is a member of (with decrypted names) */
|
|
686
|
+
list: "extension_space_list",
|
|
687
|
+
/** Create a new shared space */
|
|
688
|
+
create: "extension_space_create",
|
|
689
|
+
/** List available sync backends */
|
|
690
|
+
listBackends: "extension_space_list_backends"
|
|
685
691
|
};
|
|
686
692
|
|
|
687
693
|
// src/commands/index.ts
|
|
@@ -1758,19 +1764,48 @@ var SpacesAPI = class {
|
|
|
1758
1764
|
async unassignRowAsync(tableName, rowPks, spaceId) {
|
|
1759
1765
|
return this.unassignAsync([{ tableName, rowPks, spaceId }]);
|
|
1760
1766
|
}
|
|
1767
|
+
// ==========================================================================
|
|
1768
|
+
// Space Management
|
|
1769
|
+
// ==========================================================================
|
|
1770
|
+
/**
|
|
1771
|
+
* List all shared spaces the user is a member of.
|
|
1772
|
+
* Returns spaces with decrypted names (decryption happens vault-side).
|
|
1773
|
+
*/
|
|
1774
|
+
async listSpacesAsync() {
|
|
1775
|
+
return this.client.request(SPACE_COMMANDS.list);
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Create a new shared space.
|
|
1779
|
+
* @param name - Human-readable space name
|
|
1780
|
+
* @param serverUrl - The sync server URL to create the space on
|
|
1781
|
+
* @returns The created space with decrypted name
|
|
1782
|
+
*/
|
|
1783
|
+
async createSpaceAsync(name, serverUrl) {
|
|
1784
|
+
return this.client.request(SPACE_COMMANDS.create, {
|
|
1785
|
+
name,
|
|
1786
|
+
server_url: serverUrl
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* List available sync backends that can host shared spaces.
|
|
1791
|
+
* @returns Array of backend info with server URLs
|
|
1792
|
+
*/
|
|
1793
|
+
async listSyncBackendsAsync() {
|
|
1794
|
+
return this.client.request(SPACE_COMMANDS.listBackends);
|
|
1795
|
+
}
|
|
1761
1796
|
};
|
|
1762
|
-
function toSnakeCase(
|
|
1797
|
+
function toSnakeCase(assignment) {
|
|
1763
1798
|
return {
|
|
1764
|
-
table_name:
|
|
1765
|
-
row_pks:
|
|
1766
|
-
space_id:
|
|
1799
|
+
table_name: assignment.tableName,
|
|
1800
|
+
row_pks: assignment.rowPks,
|
|
1801
|
+
space_id: assignment.spaceId
|
|
1767
1802
|
};
|
|
1768
1803
|
}
|
|
1769
|
-
function fromSnakeCase(
|
|
1804
|
+
function fromSnakeCase(assignment) {
|
|
1770
1805
|
return {
|
|
1771
|
-
tableName:
|
|
1772
|
-
rowPks:
|
|
1773
|
-
spaceId:
|
|
1806
|
+
tableName: assignment.table_name,
|
|
1807
|
+
rowPks: assignment.row_pks,
|
|
1808
|
+
spaceId: assignment.space_id
|
|
1774
1809
|
};
|
|
1775
1810
|
}
|
|
1776
1811
|
|
|
@@ -2948,6 +2983,27 @@ async function decryptSpaceKeyAsync(encrypted, ownPrivateKeyBase64) {
|
|
|
2948
2983
|
);
|
|
2949
2984
|
return new Uint8Array(decrypted);
|
|
2950
2985
|
}
|
|
2986
|
+
async function encryptSpaceNameAsync(spaceKey, spaceName) {
|
|
2987
|
+
const cryptoKey = await crypto.subtle.importKey(
|
|
2988
|
+
"raw",
|
|
2989
|
+
new Uint8Array(spaceKey).buffer,
|
|
2990
|
+
{ name: "AES-GCM" },
|
|
2991
|
+
false,
|
|
2992
|
+
["encrypt"]
|
|
2993
|
+
);
|
|
2994
|
+
const { encryptedData, nonce } = await encryptString(spaceName, cryptoKey);
|
|
2995
|
+
return { encryptedName: encryptedData, nameNonce: nonce };
|
|
2996
|
+
}
|
|
2997
|
+
async function decryptSpaceNameAsync(spaceKey, encryptedName, nameNonce) {
|
|
2998
|
+
const cryptoKey = await crypto.subtle.importKey(
|
|
2999
|
+
"raw",
|
|
3000
|
+
new Uint8Array(spaceKey).buffer,
|
|
3001
|
+
{ name: "AES-GCM" },
|
|
3002
|
+
false,
|
|
3003
|
+
["decrypt"]
|
|
3004
|
+
);
|
|
3005
|
+
return decryptString(encryptedName, nameNonce, cryptoKey);
|
|
3006
|
+
}
|
|
2951
3007
|
|
|
2952
3008
|
// src/crypto/recordSigning.ts
|
|
2953
3009
|
function canonicalize(record) {
|
|
@@ -3181,6 +3237,6 @@ function createHaexVaultSdk(config = {}) {
|
|
|
3181
3237
|
return new HaexVaultSdk(config);
|
|
3182
3238
|
}
|
|
3183
3239
|
|
|
3184
|
-
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SIGNING_ALGO, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
|
3240
|
+
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SIGNING_ALGO, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
|
3185
3241
|
//# sourceMappingURL=index.mjs.map
|
|
3186
3242
|
//# sourceMappingURL=index.mjs.map
|