@sparkvault/sdk-js 9.2.3 → 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 +59 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +59 -6
- 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/dist/vaults/upload/api.d.ts +24 -1
- package/package.json +1 -1
package/dist/vaults/index.d.ts
CHANGED
|
@@ -53,11 +53,15 @@ export declare class VaultsModule {
|
|
|
53
53
|
* Unseal a vault to access its contents.
|
|
54
54
|
* Returns a short-lived Vault Access Token (VAT).
|
|
55
55
|
*
|
|
56
|
+
* @param vaultId - The vault to unseal.
|
|
57
|
+
* @param key - The vault's VMK, or a DVAK token issued for it.
|
|
58
|
+
*
|
|
56
59
|
* @example
|
|
57
60
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
61
|
+
* const delegated = await sv.vaults.unseal('vlt_abc', 'dvak_...');
|
|
58
62
|
* console.log('Token:', unsealed.vatToken);
|
|
59
63
|
*/
|
|
60
|
-
unseal(vaultId: string,
|
|
64
|
+
unseal(vaultId: string, key: string): Promise<UnsealedVault>;
|
|
61
65
|
/**
|
|
62
66
|
* List vaults for the account. Results are paginated (server default 100 per
|
|
63
67
|
* page, max 500); follow `nextCursor` to fetch subsequent pages.
|
|
@@ -16,6 +16,15 @@ export declare class UploadApiError extends SparkVaultError {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class UploadApi extends SparkVaultApi {
|
|
18
18
|
private readonly config;
|
|
19
|
+
/**
|
|
20
|
+
* Vault upload info by vault id, memoized for the life of this client.
|
|
21
|
+
*
|
|
22
|
+
* The client is built once with the SDK and the map dies with the page, so
|
|
23
|
+
* the memo cannot outlive the page it decorates — which is why there is no
|
|
24
|
+
* TTL and no invalidation API to get wrong. It deliberately survives
|
|
25
|
+
* `resetSession()`, alongside the other long-lived per-client state.
|
|
26
|
+
*/
|
|
27
|
+
private readonly vaultInfoMemo;
|
|
19
28
|
constructor(config: ResolvedConfig);
|
|
20
29
|
protected makeError(message: string, code: string, statusCode: number, details?: Record<string, unknown>): UploadApiError;
|
|
21
30
|
/**
|
|
@@ -23,9 +32,23 @@ export declare class UploadApi extends SparkVaultApi {
|
|
|
23
32
|
*/
|
|
24
33
|
private request;
|
|
25
34
|
/**
|
|
26
|
-
* Get vault upload info (public endpoint).
|
|
35
|
+
* Get vault upload info (public endpoint), fetched at most once per vault.
|
|
36
|
+
*
|
|
37
|
+
* Every widget interaction — `upload()`, `pop()`, `render()`, and each click
|
|
38
|
+
* an `attach()` handler serves — starts by asking for this, and the answer is
|
|
39
|
+
* pure display and geometry: the vault's name, its branding, and the size it
|
|
40
|
+
* advertises. It authorizes nothing. The server re-validates the vault, its
|
|
41
|
+
* upload source, the request origin, and the file size on the POST that
|
|
42
|
+
* actually creates the upload, and that re-validation is the correctness
|
|
43
|
+
* backstop for this whole flow — a memoized answer can never widen what an
|
|
44
|
+
* upload is allowed to do, and the backstop must stay in place.
|
|
45
|
+
*
|
|
46
|
+
* Only a successful answer is kept: a rejection evicts its entry so the next
|
|
47
|
+
* open retries against the server, and an entry whose request was aborted by
|
|
48
|
+
* a closing widget is never handed to the widget that replaces it.
|
|
27
49
|
*/
|
|
28
50
|
getVaultUploadInfo(vaultId: string): Promise<VaultUploadConfig>;
|
|
51
|
+
private fetchVaultUploadInfo;
|
|
29
52
|
/**
|
|
30
53
|
* Initiate an upload to get Forge URL and ingot ID.
|
|
31
54
|
*/
|