@sparkvault/sdk-js 11.2.2 → 11.2.4
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 +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +43 -2
- package/dist/index.mjs +17 -4
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +7 -1
- package/dist/ingots/types.d.ts +17 -0
- package/dist/sparks/types.d.ts +17 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/types.d.ts +4 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -748,7 +748,10 @@ interface Vault {
|
|
|
748
748
|
id: string;
|
|
749
749
|
/** Vault name */
|
|
750
750
|
name: string;
|
|
751
|
-
/**
|
|
751
|
+
/**
|
|
752
|
+
* Vault Master Key, minted by Core and returned only here, by create: 144
|
|
753
|
+
* random bits in Base62, at most 25 characters. STORE SECURELY!
|
|
754
|
+
*/
|
|
752
755
|
vmk: string;
|
|
753
756
|
/** Creation timestamp (Unix seconds) */
|
|
754
757
|
createdAt: number;
|
|
@@ -2275,6 +2278,22 @@ interface Ingot {
|
|
|
2275
2278
|
id: string;
|
|
2276
2279
|
/** Ingot name */
|
|
2277
2280
|
name: string;
|
|
2281
|
+
/**
|
|
2282
|
+
* The name a download of the ingot saves under, as Forge names it: `name`,
|
|
2283
|
+
* kept as it is when the first word of the extension it shows (up to an
|
|
2284
|
+
* ASCII space, in any case) is one the MIME registry knows or holds a
|
|
2285
|
+
* character none of the registry's extensions is spelled with, which may
|
|
2286
|
+
* draw as one, and otherwise completed with the first extension the
|
|
2287
|
+
* registry lists for `contentType`, never one a saved copy must never open
|
|
2288
|
+
* as. Save a copy under it, handed to a browser as
|
|
2289
|
+
* `application/octet-stream` unless `contentType` is a raster image, audio,
|
|
2290
|
+
* video or PDF format (never SVG, a playlist or a stream redirector): a
|
|
2291
|
+
* browser renames a saved copy by the type it is handed (Chrome saves
|
|
2292
|
+
* `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
|
|
2293
|
+
* completes or replaces no extension of a copy handed as
|
|
2294
|
+
* `application/octet-stream`.
|
|
2295
|
+
*/
|
|
2296
|
+
downloadFilename: string;
|
|
2278
2297
|
/** Content type (MIME) */
|
|
2279
2298
|
contentType: string;
|
|
2280
2299
|
/** Size in bytes */
|
|
@@ -2848,8 +2867,14 @@ declare class IngotsModule {
|
|
|
2848
2867
|
* and a link that is not a Forge decrypt URL on an allowed host, is final.
|
|
2849
2868
|
*
|
|
2850
2869
|
* @example
|
|
2870
|
+
* const ingot = await sv.ingots.get(unsealed, 'ing_abc');
|
|
2851
2871
|
* const blob = await sv.ingots.download(unsealed, 'ing_abc');
|
|
2852
|
-
*
|
|
2872
|
+
* // Saved under the name Forge would send, as opaque bytes, which no
|
|
2873
|
+
* // browser renames by a type (see Ingot.downloadFilename).
|
|
2874
|
+
* const link = document.createElement('a');
|
|
2875
|
+
* link.href = URL.createObjectURL(new Blob([blob], { type: 'application/octet-stream' }));
|
|
2876
|
+
* link.download = ingot.downloadFilename;
|
|
2877
|
+
* link.click();
|
|
2853
2878
|
*/
|
|
2854
2879
|
download(vault: UnsealedVault, ingotId: string): Promise<Blob>;
|
|
2855
2880
|
/**
|
|
@@ -3039,6 +3064,22 @@ interface Spark {
|
|
|
3039
3064
|
burnedAt: number;
|
|
3040
3065
|
/** Optional file name (for file payloads) */
|
|
3041
3066
|
filename?: string;
|
|
3067
|
+
/**
|
|
3068
|
+
* The name the payload saves under: `filename`, or `download` for a spark
|
|
3069
|
+
* with none, kept as it is when the first word of the extension it shows
|
|
3070
|
+
* (up to an ASCII space, in any case) is one the MIME registry knows or
|
|
3071
|
+
* holds a character none of the registry's extensions is spelled with,
|
|
3072
|
+
* which may draw as one, and otherwise completed with the first extension
|
|
3073
|
+
* the registry lists for `contentType`, never one a saved copy must never
|
|
3074
|
+
* open as. Save a copy under it, handed to a browser as
|
|
3075
|
+
* `application/octet-stream` unless `contentType` is a raster image, audio,
|
|
3076
|
+
* video or PDF format (never SVG, a playlist or a stream redirector): a
|
|
3077
|
+
* browser renames a saved copy by the type it is handed (Chrome saves
|
|
3078
|
+
* `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
|
|
3079
|
+
* completes or replaces no extension of a copy handed as
|
|
3080
|
+
* `application/octet-stream`.
|
|
3081
|
+
*/
|
|
3082
|
+
downloadFilename: string;
|
|
3042
3083
|
}
|
|
3043
3084
|
/** A newly created spark. */
|
|
3044
3085
|
interface CreatedSpark {
|
package/dist/index.mjs
CHANGED
|
@@ -11421,10 +11421,15 @@ class ProductsModule {
|
|
|
11421
11421
|
/** The prefix that marks a DVAK token apart from a Vault Master Key. */
|
|
11422
11422
|
const DVAK_TOKEN_PREFIX = 'dvak_';
|
|
11423
11423
|
|
|
11424
|
-
/**
|
|
11424
|
+
/**
|
|
11425
|
+
* The shortest and longest string, in characters, accepted as a Vault Master
|
|
11426
|
+
* Key. Every VMK is one Core minted, the Base62 of 18 random bytes (Core's
|
|
11427
|
+
* vault create, apps/api/src/vaults/create.js): 144 bits in at most 25
|
|
11428
|
+
* characters.
|
|
11429
|
+
*/
|
|
11425
11430
|
const VAULT_MASTER_KEY_LENGTH = Object.freeze({ min: 12, max: 32 });
|
|
11426
11431
|
|
|
11427
|
-
/**
|
|
11432
|
+
/** What a presented Vault Master Key must be: 12 to 32 ASCII letters and digits. */
|
|
11428
11433
|
new RegExp(
|
|
11429
11434
|
`^[A-Za-z0-9]{${VAULT_MASTER_KEY_LENGTH.min},${VAULT_MASTER_KEY_LENGTH.max}}$`
|
|
11430
11435
|
);
|
|
@@ -16515,8 +16520,14 @@ class IngotsModule {
|
|
|
16515
16520
|
* and a link that is not a Forge decrypt URL on an allowed host, is final.
|
|
16516
16521
|
*
|
|
16517
16522
|
* @example
|
|
16523
|
+
* const ingot = await sv.ingots.get(unsealed, 'ing_abc');
|
|
16518
16524
|
* const blob = await sv.ingots.download(unsealed, 'ing_abc');
|
|
16519
|
-
*
|
|
16525
|
+
* // Saved under the name Forge would send, as opaque bytes, which no
|
|
16526
|
+
* // browser renames by a type (see Ingot.downloadFilename).
|
|
16527
|
+
* const link = document.createElement('a');
|
|
16528
|
+
* link.href = URL.createObjectURL(new Blob([blob], { type: 'application/octet-stream' }));
|
|
16529
|
+
* link.download = ingot.downloadFilename;
|
|
16530
|
+
* link.click();
|
|
16520
16531
|
*/
|
|
16521
16532
|
async download(vault, ingotId) {
|
|
16522
16533
|
const mint = async () => (await this.createDownloadLink(vault, ingotId)).downloadUrl;
|
|
@@ -16695,6 +16706,7 @@ function mapIngot(wire) {
|
|
|
16695
16706
|
return {
|
|
16696
16707
|
id: wire.ingot_id,
|
|
16697
16708
|
name: wire.name,
|
|
16709
|
+
downloadFilename: wire.download_filename,
|
|
16698
16710
|
contentType: wire.content_type,
|
|
16699
16711
|
size: wire.size_bytes,
|
|
16700
16712
|
status: wire.status ?? 'active',
|
|
@@ -16786,6 +16798,7 @@ class SparksModule {
|
|
|
16786
16798
|
createdAt: data.created_at,
|
|
16787
16799
|
burnedAt: data.burned_at,
|
|
16788
16800
|
filename: data.filename,
|
|
16801
|
+
downloadFilename: data.download_filename,
|
|
16789
16802
|
};
|
|
16790
16803
|
}
|
|
16791
16804
|
/**
|
|
@@ -17427,7 +17440,7 @@ class SparkVault {
|
|
|
17427
17440
|
}
|
|
17428
17441
|
/** Get the SDK version */
|
|
17429
17442
|
static get version() {
|
|
17430
|
-
return '11.2.
|
|
17443
|
+
return '11.2.4';
|
|
17431
17444
|
}
|
|
17432
17445
|
}
|
|
17433
17446
|
if (typeof window !== 'undefined') {
|