@sparkvault/sdk-js 8.10.0 → 8.10.2
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/entropy/index.d.ts +9 -1
- package/dist/index.d.ts +44 -8
- package/dist/notify/types.d.ts +6 -1
- package/dist/sparkvault.cjs.js +50 -16
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +50 -16
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +17 -8
- package/dist/vaults/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/entropy/index.d.ts
CHANGED
|
@@ -19,8 +19,16 @@ export declare class EntropyModule {
|
|
|
19
19
|
/**
|
|
20
20
|
* Generate `n` random bytes as a Uint8Array.
|
|
21
21
|
*
|
|
22
|
+
* SECURITY: this returns raw *server* entropy — it is NOT finished key
|
|
23
|
+
* material. Client secret keys MUST hybrid-mix it: XOR the returned bytes with
|
|
24
|
+
* a local CSPRNG (`crypto.getRandomValues`) before use, so the server share
|
|
25
|
+
* alone can never determine the key.
|
|
26
|
+
*
|
|
22
27
|
* @example
|
|
23
|
-
* const
|
|
28
|
+
* const serverEntropy = await sv.entropy.generateBytes(32);
|
|
29
|
+
* const localEntropy = crypto.getRandomValues(new Uint8Array(32));
|
|
30
|
+
* // Hybrid-mixed key material — safe to use as a secret key.
|
|
31
|
+
* const key = serverEntropy.map((b, i) => b ^ localEntropy[i]);
|
|
24
32
|
*/
|
|
25
33
|
generateBytes(n: number): Promise<Uint8Array>;
|
|
26
34
|
private validateByteCount;
|
package/dist/index.d.ts
CHANGED
|
@@ -634,6 +634,20 @@ interface VaultSummary {
|
|
|
634
634
|
/** Total storage used in bytes */
|
|
635
635
|
storageBytes: number;
|
|
636
636
|
}
|
|
637
|
+
/** Options for list. */
|
|
638
|
+
interface ListVaultsOptions {
|
|
639
|
+
/** Page size (1–500; server default 100) */
|
|
640
|
+
limit?: number;
|
|
641
|
+
/** Pagination cursor from a prior page's `nextCursor` */
|
|
642
|
+
cursor?: string;
|
|
643
|
+
}
|
|
644
|
+
/** A page of vaults. */
|
|
645
|
+
interface VaultPage {
|
|
646
|
+
/** Vaults on this page */
|
|
647
|
+
vaults: VaultSummary[];
|
|
648
|
+
/** Cursor for the next page, when more results exist */
|
|
649
|
+
nextCursor?: string;
|
|
650
|
+
}
|
|
637
651
|
/** A single vault's detail, as returned by get. */
|
|
638
652
|
interface VaultDetail {
|
|
639
653
|
/** Vault ID */
|
|
@@ -914,13 +928,18 @@ declare class VaultsModule {
|
|
|
914
928
|
*/
|
|
915
929
|
unseal(vaultId: string, vmk: string): Promise<UnsealedVault>;
|
|
916
930
|
/**
|
|
917
|
-
* List
|
|
931
|
+
* List vaults for the account. Results are paginated (server default 100 per
|
|
932
|
+
* page, max 500); follow `nextCursor` to fetch subsequent pages.
|
|
918
933
|
*
|
|
919
934
|
* @example
|
|
920
|
-
*
|
|
921
|
-
*
|
|
935
|
+
* let cursor: string | undefined;
|
|
936
|
+
* do {
|
|
937
|
+
* const page = await sv.vaults.list({ cursor });
|
|
938
|
+
* page.vaults.forEach((v) => console.log(v.name));
|
|
939
|
+
* cursor = page.nextCursor;
|
|
940
|
+
* } while (cursor);
|
|
922
941
|
*/
|
|
923
|
-
list(): Promise<
|
|
942
|
+
list(options?: ListVaultsOptions): Promise<VaultPage>;
|
|
924
943
|
/**
|
|
925
944
|
* Get a single vault's detail.
|
|
926
945
|
*
|
|
@@ -948,10 +967,14 @@ declare class VaultsModule {
|
|
|
948
967
|
/**
|
|
949
968
|
* Delete a vault and all its ingots. This action is irreversible!
|
|
950
969
|
*
|
|
970
|
+
* Requires the vault's exact name as confirmation. It is sent as the
|
|
971
|
+
* `X-Confirm-Name` header and must match the vault name exactly
|
|
972
|
+
* (case-sensitive).
|
|
973
|
+
*
|
|
951
974
|
* @example
|
|
952
|
-
* await sv.vaults.delete('vlt_abc',
|
|
975
|
+
* await sv.vaults.delete('vlt_abc', 'My Vault');
|
|
953
976
|
*/
|
|
954
|
-
delete(vaultId: string,
|
|
977
|
+
delete(vaultId: string, name: string): Promise<void>;
|
|
955
978
|
/**
|
|
956
979
|
* Get a vault's public-sharing configuration.
|
|
957
980
|
*
|
|
@@ -1801,8 +1824,16 @@ declare class EntropyModule {
|
|
|
1801
1824
|
/**
|
|
1802
1825
|
* Generate `n` random bytes as a Uint8Array.
|
|
1803
1826
|
*
|
|
1827
|
+
* SECURITY: this returns raw *server* entropy — it is NOT finished key
|
|
1828
|
+
* material. Client secret keys MUST hybrid-mix it: XOR the returned bytes with
|
|
1829
|
+
* a local CSPRNG (`crypto.getRandomValues`) before use, so the server share
|
|
1830
|
+
* alone can never determine the key.
|
|
1831
|
+
*
|
|
1804
1832
|
* @example
|
|
1805
|
-
* const
|
|
1833
|
+
* const serverEntropy = await sv.entropy.generateBytes(32);
|
|
1834
|
+
* const localEntropy = crypto.getRandomValues(new Uint8Array(32));
|
|
1835
|
+
* // Hybrid-mixed key material — safe to use as a secret key.
|
|
1836
|
+
* const key = serverEntropy.map((b, i) => b ^ localEntropy[i]);
|
|
1806
1837
|
*/
|
|
1807
1838
|
generateBytes(n: number): Promise<Uint8Array>;
|
|
1808
1839
|
private validateByteCount;
|
|
@@ -1838,7 +1869,12 @@ interface NotificationRow {
|
|
|
1838
1869
|
seen_at: number | null;
|
|
1839
1870
|
read_at: number | null;
|
|
1840
1871
|
archived_at: number | null;
|
|
1841
|
-
|
|
1872
|
+
/**
|
|
1873
|
+
* The grant to open. Present only for a SEALED send — a plaintext send delivers
|
|
1874
|
+
* its content inline in the channel and mints no grant, so its row has no
|
|
1875
|
+
* pointer. Guard before building a URL from it.
|
|
1876
|
+
*/
|
|
1877
|
+
sparklink_code?: string;
|
|
1842
1878
|
locked: true;
|
|
1843
1879
|
thread_id?: string;
|
|
1844
1880
|
}
|
package/dist/notify/types.d.ts
CHANGED
|
@@ -28,7 +28,12 @@ export interface NotificationRow {
|
|
|
28
28
|
seen_at: number | null;
|
|
29
29
|
read_at: number | null;
|
|
30
30
|
archived_at: number | null;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The grant to open. Present only for a SEALED send — a plaintext send delivers
|
|
33
|
+
* its content inline in the channel and mints no grant, so its row has no
|
|
34
|
+
* pointer. Guard before building a URL from it.
|
|
35
|
+
*/
|
|
36
|
+
sparklink_code?: string;
|
|
32
37
|
locked: true;
|
|
33
38
|
thread_id?: string;
|
|
34
39
|
}
|
package/dist/sparkvault.cjs.js
CHANGED
|
@@ -12371,21 +12371,30 @@ class VaultsModule {
|
|
|
12371
12371
|
};
|
|
12372
12372
|
}
|
|
12373
12373
|
/**
|
|
12374
|
-
* List
|
|
12374
|
+
* List vaults for the account. Results are paginated (server default 100 per
|
|
12375
|
+
* page, max 500); follow `nextCursor` to fetch subsequent pages.
|
|
12375
12376
|
*
|
|
12376
12377
|
* @example
|
|
12377
|
-
*
|
|
12378
|
-
*
|
|
12378
|
+
* let cursor: string | undefined;
|
|
12379
|
+
* do {
|
|
12380
|
+
* const page = await sv.vaults.list({ cursor });
|
|
12381
|
+
* page.vaults.forEach((v) => console.log(v.name));
|
|
12382
|
+
* cursor = page.nextCursor;
|
|
12383
|
+
* } while (cursor);
|
|
12379
12384
|
*/
|
|
12380
|
-
async list() {
|
|
12381
|
-
const
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12385
|
+
async list(options = {}) {
|
|
12386
|
+
const query = buildQuery$2({ limit: options.limit, cursor: options.cursor });
|
|
12387
|
+
const response = await this.http.get(`/v1/vaults${query}`);
|
|
12388
|
+
return {
|
|
12389
|
+
vaults: response.data.vaults.map((v) => ({
|
|
12390
|
+
id: v.vault_id,
|
|
12391
|
+
name: v.name,
|
|
12392
|
+
createdAt: v.created_at,
|
|
12393
|
+
ingotCount: v.ingot_count,
|
|
12394
|
+
storageBytes: v.storage_bytes,
|
|
12395
|
+
})),
|
|
12396
|
+
nextCursor: response.data.next_cursor,
|
|
12397
|
+
};
|
|
12389
12398
|
}
|
|
12390
12399
|
/**
|
|
12391
12400
|
* Get a single vault's detail.
|
|
@@ -12445,13 +12454,20 @@ class VaultsModule {
|
|
|
12445
12454
|
/**
|
|
12446
12455
|
* Delete a vault and all its ingots. This action is irreversible!
|
|
12447
12456
|
*
|
|
12457
|
+
* Requires the vault's exact name as confirmation. It is sent as the
|
|
12458
|
+
* `X-Confirm-Name` header and must match the vault name exactly
|
|
12459
|
+
* (case-sensitive).
|
|
12460
|
+
*
|
|
12448
12461
|
* @example
|
|
12449
|
-
* await sv.vaults.delete('vlt_abc',
|
|
12462
|
+
* await sv.vaults.delete('vlt_abc', 'My Vault');
|
|
12450
12463
|
*/
|
|
12451
|
-
async delete(vaultId,
|
|
12464
|
+
async delete(vaultId, name) {
|
|
12452
12465
|
const cleanId = this.normalizeVaultId(vaultId);
|
|
12466
|
+
if (!name) {
|
|
12467
|
+
throw new ValidationError('Vault name is required to confirm deletion');
|
|
12468
|
+
}
|
|
12453
12469
|
await this.http.delete(`/v1/vaults/${cleanId}`, {
|
|
12454
|
-
headers: { 'X-
|
|
12470
|
+
headers: { 'X-Confirm-Name': name },
|
|
12455
12471
|
});
|
|
12456
12472
|
}
|
|
12457
12473
|
/**
|
|
@@ -12632,6 +12648,16 @@ class VaultsModule {
|
|
|
12632
12648
|
}
|
|
12633
12649
|
}
|
|
12634
12650
|
}
|
|
12651
|
+
function buildQuery$2(params) {
|
|
12652
|
+
const search = new URLSearchParams();
|
|
12653
|
+
for (const [key, value] of Object.entries(params)) {
|
|
12654
|
+
if (value === undefined || value === '')
|
|
12655
|
+
continue;
|
|
12656
|
+
search.append(key, String(value));
|
|
12657
|
+
}
|
|
12658
|
+
const query = search.toString();
|
|
12659
|
+
return query ? `?${query}` : '';
|
|
12660
|
+
}
|
|
12635
12661
|
function mapSharingConfig$1(wire) {
|
|
12636
12662
|
return {
|
|
12637
12663
|
vaultId: wire.vault_id,
|
|
@@ -13499,8 +13525,16 @@ class EntropyModule {
|
|
|
13499
13525
|
/**
|
|
13500
13526
|
* Generate `n` random bytes as a Uint8Array.
|
|
13501
13527
|
*
|
|
13528
|
+
* SECURITY: this returns raw *server* entropy — it is NOT finished key
|
|
13529
|
+
* material. Client secret keys MUST hybrid-mix it: XOR the returned bytes with
|
|
13530
|
+
* a local CSPRNG (`crypto.getRandomValues`) before use, so the server share
|
|
13531
|
+
* alone can never determine the key.
|
|
13532
|
+
*
|
|
13502
13533
|
* @example
|
|
13503
|
-
* const
|
|
13534
|
+
* const serverEntropy = await sv.entropy.generateBytes(32);
|
|
13535
|
+
* const localEntropy = crypto.getRandomValues(new Uint8Array(32));
|
|
13536
|
+
* // Hybrid-mixed key material — safe to use as a secret key.
|
|
13537
|
+
* const key = serverEntropy.map((b, i) => b ^ localEntropy[i]);
|
|
13504
13538
|
*/
|
|
13505
13539
|
async generateBytes(n) {
|
|
13506
13540
|
this.validateByteCount(n);
|