@sparkvault/sdk-js 9.2.4 → 9.3.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.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +5 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13259,6 +13259,8 @@ class VaultUploadModule {
|
|
|
13259
13259
|
* operations live in their own modules; this module owns the vault record,
|
|
13260
13260
|
* its sharing/upload configuration, and the browser upload widget.
|
|
13261
13261
|
*/
|
|
13262
|
+
/** Marks a Delegated Vault Access Key token apart from a Vault Master Key. */
|
|
13263
|
+
const DVAK_TOKEN_PREFIX = 'dvak_';
|
|
13262
13264
|
/** A string every char of which fits in a single header byte (latin1). */
|
|
13263
13265
|
function isLatin1(value) {
|
|
13264
13266
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -13303,16 +13305,20 @@ class VaultsModule {
|
|
|
13303
13305
|
* Unseal a vault to access its contents.
|
|
13304
13306
|
* Returns a short-lived Vault Access Token (VAT).
|
|
13305
13307
|
*
|
|
13308
|
+
* @param vaultId - The vault to unseal.
|
|
13309
|
+
* @param key - The vault's VMK, or a DVAK token issued for it.
|
|
13310
|
+
*
|
|
13306
13311
|
* @example
|
|
13307
13312
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
13313
|
+
* const delegated = await sv.vaults.unseal('vlt_abc', 'dvak_...');
|
|
13308
13314
|
* console.log('Token:', unsealed.vatToken);
|
|
13309
13315
|
*/
|
|
13310
|
-
async unseal(vaultId,
|
|
13316
|
+
async unseal(vaultId, key) {
|
|
13311
13317
|
const cleanId = this.normalizeVaultId(vaultId);
|
|
13312
|
-
if (!
|
|
13313
|
-
throw new ValidationError('VMK is required');
|
|
13318
|
+
if (!key) {
|
|
13319
|
+
throw new ValidationError('A VMK or DVAK token is required');
|
|
13314
13320
|
}
|
|
13315
|
-
const response = await this.http.post(`/v1/vaults/${cleanId}/unseal`, { vmk });
|
|
13321
|
+
const response = await this.http.post(`/v1/vaults/${cleanId}/unseal`, key.startsWith(DVAK_TOKEN_PREFIX) ? { dvak_token: key } : { vmk: key });
|
|
13316
13322
|
if (!response.data.vat) {
|
|
13317
13323
|
throw new ValidationError('Unseal response did not include a vault access token');
|
|
13318
13324
|
}
|
|
@@ -15108,7 +15114,7 @@ class SparkVault {
|
|
|
15108
15114
|
}
|
|
15109
15115
|
/** Get the SDK version */
|
|
15110
15116
|
static get version() {
|
|
15111
|
-
return '9.
|
|
15117
|
+
return '9.3.0';
|
|
15112
15118
|
}
|
|
15113
15119
|
}
|
|
15114
15120
|
if (typeof window !== 'undefined') {
|