@sparkvault/sdk-js 8.10.5 → 8.11.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/index.d.ts +30 -1
- package/dist/ingots/index.d.ts +11 -2
- package/dist/ingots/types.d.ts +20 -0
- package/dist/products/identity/index.d.ts +2 -1
- package/dist/sparkvault.cjs.js +30 -3
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +30 -3
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/sparkvault.esm.js
CHANGED
|
@@ -8570,7 +8570,8 @@ class IdentityModule {
|
|
|
8570
8570
|
/**
|
|
8571
8571
|
* One-click sign-in through the browser's native FedCM account chooser.
|
|
8572
8572
|
*
|
|
8573
|
-
* When the person is already signed into
|
|
8573
|
+
* When the person is already signed into SparkVault Identity (carrying the
|
|
8574
|
+
* SSO hub session on the Identity origin),
|
|
8574
8575
|
* the browser surfaces a "Continue as …" prompt with no popup, redirect, or
|
|
8575
8576
|
* typing. Requires a registered `clientId` in the SDK config and a browser
|
|
8576
8577
|
* with FedCM support — callers should feature-detect with
|
|
@@ -8595,7 +8596,10 @@ class IdentityModule {
|
|
|
8595
8596
|
});
|
|
8596
8597
|
}
|
|
8597
8598
|
const nonce = options.nonce ?? generateState();
|
|
8598
|
-
|
|
8599
|
+
// The FedCM IdP is the IDENTITY origin (where sign-in runs and the SSO hub
|
|
8600
|
+
// cookie lives) — not the auth.sv portal. The config, its endpoints, and
|
|
8601
|
+
// the credentialed accounts fetch must all be same-origin with that cookie.
|
|
8602
|
+
const configURL = `${this.config.identityBaseUrl}/${this.config.accountId}/fedcm/config.json`;
|
|
8599
8603
|
const request = {
|
|
8600
8604
|
identity: { providers: [{ configURL, clientId: this.config.clientId, nonce }] },
|
|
8601
8605
|
...(options.mediation ? { mediation: options.mediation } : {}),
|
|
@@ -12724,6 +12728,7 @@ class IngotsModule {
|
|
|
12724
12728
|
name: options.name,
|
|
12725
12729
|
content_type: options.contentType,
|
|
12726
12730
|
size_bytes: options.sizeBytes,
|
|
12731
|
+
contentHmac: options.contentHmac,
|
|
12727
12732
|
folder: options.folder,
|
|
12728
12733
|
folderId: options.folderId,
|
|
12729
12734
|
});
|
|
@@ -12758,6 +12763,7 @@ class IngotsModule {
|
|
|
12758
12763
|
name,
|
|
12759
12764
|
content_type: contentType,
|
|
12760
12765
|
size_bytes: options.file.size,
|
|
12766
|
+
contentHmac: options.contentHmac,
|
|
12761
12767
|
folder: options.folder,
|
|
12762
12768
|
folderId: options.folderId,
|
|
12763
12769
|
});
|
|
@@ -12774,7 +12780,12 @@ class IngotsModule {
|
|
|
12774
12780
|
const cleanId = normalizeIngotId(ingotId);
|
|
12775
12781
|
const name = options.name ?? getBlobName(options.file);
|
|
12776
12782
|
const contentType = options.contentType ?? options.file.type ?? 'application/octet-stream';
|
|
12777
|
-
const response = await this.http.put(`/v1/vaults/${vault.id}/ingots/${cleanId}`, {
|
|
12783
|
+
const response = await this.http.put(`/v1/vaults/${vault.id}/ingots/${cleanId}`, {
|
|
12784
|
+
name,
|
|
12785
|
+
content_type: contentType,
|
|
12786
|
+
size_bytes: options.file.size,
|
|
12787
|
+
...(options.contentHmac && { content_hmac: options.contentHmac }),
|
|
12788
|
+
}, { headers: { 'X-Vault-Access-Token': vault.vatToken } });
|
|
12778
12789
|
if (!response.data.forge_url) {
|
|
12779
12790
|
throw new ValidationError('Replace endpoint did not return a Forge upload URL');
|
|
12780
12791
|
}
|
|
@@ -12986,6 +12997,18 @@ class IngotsModule {
|
|
|
12986
12997
|
const cleanId = normalizeIngotId(ingotId);
|
|
12987
12998
|
await this.http.delete(`/v1/vaults/${vault.id}/ingots/${cleanId}/sharing/invite/${inviteId}`, { headers: { 'X-Vault-Access-Token': vault.vatToken } });
|
|
12988
12999
|
}
|
|
13000
|
+
/**
|
|
13001
|
+
* Batch content-HMAC existence check — the pre-upload dedup handshake.
|
|
13002
|
+
* Returns which of the supplied vault-keyed HMACs already exist on active
|
|
13003
|
+
* ingots in the vault, so callers can skip transferring those bytes.
|
|
13004
|
+
*
|
|
13005
|
+
* @example
|
|
13006
|
+
* const { found } = await sv.ingots.checkContentHmacs(unsealed, [hmac1, hmac2]);
|
|
13007
|
+
*/
|
|
13008
|
+
async checkContentHmacs(vault, hashes) {
|
|
13009
|
+
const response = await this.http.post(`/v1/vaults/${vault.id}/ingots/hash-check`, { hashes }, { headers: { 'X-Vault-Access-Token': vault.vatToken } });
|
|
13010
|
+
return response.data;
|
|
13011
|
+
}
|
|
12989
13012
|
/**
|
|
12990
13013
|
* Get an ingot's access logs.
|
|
12991
13014
|
*
|
|
@@ -13020,6 +13043,9 @@ class IngotsModule {
|
|
|
13020
13043
|
else if (body.folderId) {
|
|
13021
13044
|
payload.folder_id = body.folderId;
|
|
13022
13045
|
}
|
|
13046
|
+
if (body.contentHmac) {
|
|
13047
|
+
payload.content_hmac = body.contentHmac;
|
|
13048
|
+
}
|
|
13023
13049
|
const response = await this.http.post(`/v1/vaults/${vault.id}/ingots`, payload, { headers: { 'X-Vault-Access-Token': vault.vatToken } });
|
|
13024
13050
|
if (!response.data.forge_url) {
|
|
13025
13051
|
throw new ValidationError('Upload endpoint did not return a Forge upload URL');
|
|
@@ -13089,6 +13115,7 @@ function mapIngot(wire) {
|
|
|
13089
13115
|
status: wire.status ?? 'active',
|
|
13090
13116
|
createdAt: wire.created_at ?? 0,
|
|
13091
13117
|
folderId: wire.folder_id ?? null,
|
|
13118
|
+
contentHmac: wire.content_hmac ?? null,
|
|
13092
13119
|
};
|
|
13093
13120
|
}
|
|
13094
13121
|
function mapIngotPage(response) {
|