@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.d.ts
CHANGED
|
@@ -2015,11 +2015,15 @@ declare class VaultsModule {
|
|
|
2015
2015
|
* Unseal a vault to access its contents.
|
|
2016
2016
|
* Returns a short-lived Vault Access Token (VAT).
|
|
2017
2017
|
*
|
|
2018
|
+
* @param vaultId - The vault to unseal.
|
|
2019
|
+
* @param key - The vault's VMK, or a DVAK token issued for it.
|
|
2020
|
+
*
|
|
2018
2021
|
* @example
|
|
2019
2022
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
2023
|
+
* const delegated = await sv.vaults.unseal('vlt_abc', 'dvak_...');
|
|
2020
2024
|
* console.log('Token:', unsealed.vatToken);
|
|
2021
2025
|
*/
|
|
2022
|
-
unseal(vaultId: string,
|
|
2026
|
+
unseal(vaultId: string, key: string): Promise<UnsealedVault>;
|
|
2023
2027
|
/**
|
|
2024
2028
|
* List vaults for the account. Results are paginated (server default 100 per
|
|
2025
2029
|
* page, max 500); follow `nextCursor` to fetch subsequent pages.
|
package/dist/index.mjs
CHANGED
|
@@ -13255,6 +13255,8 @@ class VaultUploadModule {
|
|
|
13255
13255
|
* operations live in their own modules; this module owns the vault record,
|
|
13256
13256
|
* its sharing/upload configuration, and the browser upload widget.
|
|
13257
13257
|
*/
|
|
13258
|
+
/** Marks a Delegated Vault Access Key token apart from a Vault Master Key. */
|
|
13259
|
+
const DVAK_TOKEN_PREFIX = 'dvak_';
|
|
13258
13260
|
/** A string every char of which fits in a single header byte (latin1). */
|
|
13259
13261
|
function isLatin1(value) {
|
|
13260
13262
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -13299,16 +13301,20 @@ class VaultsModule {
|
|
|
13299
13301
|
* Unseal a vault to access its contents.
|
|
13300
13302
|
* Returns a short-lived Vault Access Token (VAT).
|
|
13301
13303
|
*
|
|
13304
|
+
* @param vaultId - The vault to unseal.
|
|
13305
|
+
* @param key - The vault's VMK, or a DVAK token issued for it.
|
|
13306
|
+
*
|
|
13302
13307
|
* @example
|
|
13303
13308
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
13309
|
+
* const delegated = await sv.vaults.unseal('vlt_abc', 'dvak_...');
|
|
13304
13310
|
* console.log('Token:', unsealed.vatToken);
|
|
13305
13311
|
*/
|
|
13306
|
-
async unseal(vaultId,
|
|
13312
|
+
async unseal(vaultId, key) {
|
|
13307
13313
|
const cleanId = this.normalizeVaultId(vaultId);
|
|
13308
|
-
if (!
|
|
13309
|
-
throw new ValidationError('VMK is required');
|
|
13314
|
+
if (!key) {
|
|
13315
|
+
throw new ValidationError('A VMK or DVAK token is required');
|
|
13310
13316
|
}
|
|
13311
|
-
const response = await this.http.post(`/v1/vaults/${cleanId}/unseal`, { vmk });
|
|
13317
|
+
const response = await this.http.post(`/v1/vaults/${cleanId}/unseal`, key.startsWith(DVAK_TOKEN_PREFIX) ? { dvak_token: key } : { vmk: key });
|
|
13312
13318
|
if (!response.data.vat) {
|
|
13313
13319
|
throw new ValidationError('Unseal response did not include a vault access token');
|
|
13314
13320
|
}
|
|
@@ -15104,7 +15110,7 @@ class SparkVault {
|
|
|
15104
15110
|
}
|
|
15105
15111
|
/** Get the SDK version */
|
|
15106
15112
|
static get version() {
|
|
15107
|
-
return '9.
|
|
15113
|
+
return '9.3.0';
|
|
15108
15114
|
}
|
|
15109
15115
|
}
|
|
15110
15116
|
if (typeof window !== 'undefined') {
|