@sparkvault/sdk-js 2.2.5 → 4.0.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/auto-init.d.ts +1 -1
- package/dist/entropy/index.d.ts +28 -0
- package/dist/entropy/types.d.ts +32 -0
- package/dist/folders/index.d.ts +77 -0
- package/dist/folders/types.d.ts +64 -0
- package/dist/http.d.ts +3 -1
- package/dist/index.d.ts +982 -78
- package/dist/ingots/index.d.ts +183 -0
- package/dist/ingots/types.d.ts +286 -0
- package/dist/{identity → products/identity}/api.d.ts +3 -3
- package/dist/{identity → products/identity}/embedder.d.ts +1 -1
- package/dist/{identity → products/identity}/index.d.ts +7 -7
- package/dist/{identity → products/identity}/utils.d.ts +1 -1
- package/dist/products/index.d.ts +18 -0
- package/dist/sparks/index.d.ts +65 -0
- package/dist/sparks/types.d.ts +174 -0
- package/dist/sparkvault.cjs.js +1077 -101
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +1071 -102
- 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 +102 -34
- package/dist/vaults/types.d.ts +121 -57
- package/dist/vaults/upload/api.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/{identity → products/identity}/container.d.ts +0 -0
- /package/dist/{identity → products/identity}/handlers/index.d.ts +0 -0
- /package/dist/{identity → products/identity}/handlers/passkey-handler.d.ts +0 -0
- /package/dist/{identity → products/identity}/handlers/sparklink-handler.d.ts +0 -0
- /package/dist/{identity → products/identity}/handlers/totp-handler.d.ts +0 -0
- /package/dist/{identity → products/identity}/inline-container.d.ts +0 -0
- /package/dist/{identity → products/identity}/methods.d.ts +0 -0
- /package/dist/{identity → products/identity}/modal.d.ts +0 -0
- /package/dist/{identity → products/identity}/renderer.d.ts +0 -0
- /package/dist/{identity → products/identity}/state.d.ts +0 -0
- /package/dist/{identity → products/identity}/styles.d.ts +0 -0
- /package/dist/{identity → products/identity}/types.d.ts +0 -0
- /package/dist/{identity → products/identity}/utils/cooldown-timer.d.ts +0 -0
- /package/dist/{identity → products/identity}/utils/index.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/backup-verify.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/base.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/error.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/icons.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/identity-input.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/index.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/loading.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/method-select.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/origin-not-allowed.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/passkey-prompt.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/passkey.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/product-not-configured.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/service-unavailable.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/sparklink-waiting.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/totp-verify.d.ts +0 -0
- /package/dist/{identity → products/identity}/views/two-factor.d.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -260,13 +260,13 @@ declare class PopupBlockedError extends SparkVaultError {
|
|
|
260
260
|
* Supports passkey, TOTP, SparkLink, and social authentication.
|
|
261
261
|
*
|
|
262
262
|
* @example Dialog mode (immediate)
|
|
263
|
-
* const result = await sv.identity.verify();
|
|
263
|
+
* const result = await sv.products.identity.verify();
|
|
264
264
|
*
|
|
265
265
|
* @example Dialog mode (attached to clicks)
|
|
266
|
-
* sv.identity.attach('.login-btn');
|
|
266
|
+
* sv.products.identity.attach('.login-btn');
|
|
267
267
|
*
|
|
268
268
|
* @example Inline mode
|
|
269
|
-
* const result = await sv.identity.verify({ target: '#auth-container' });
|
|
269
|
+
* const result = await sv.products.identity.verify({ target: '#auth-container' });
|
|
270
270
|
*/
|
|
271
271
|
|
|
272
272
|
declare class IdentityModule {
|
|
@@ -282,11 +282,11 @@ declare class IdentityModule {
|
|
|
282
282
|
* - With `target`: Renders inline into the specified element
|
|
283
283
|
*
|
|
284
284
|
* @example Dialog mode
|
|
285
|
-
* const result = await sv.identity.verify();
|
|
285
|
+
* const result = await sv.products.identity.verify();
|
|
286
286
|
* console.log(result.token, result.identity);
|
|
287
287
|
*
|
|
288
288
|
* @example Inline mode
|
|
289
|
-
* const result = await sv.identity.verify({
|
|
289
|
+
* const result = await sv.products.identity.verify({
|
|
290
290
|
* target: '#auth-container',
|
|
291
291
|
* email: 'user@example.com'
|
|
292
292
|
* });
|
|
@@ -301,7 +301,7 @@ declare class IdentityModule {
|
|
|
301
301
|
* @returns Cleanup function to remove event listeners
|
|
302
302
|
*
|
|
303
303
|
* @example
|
|
304
|
-
* const cleanup = sv.identity.attach('.login-btn', {
|
|
304
|
+
* const cleanup = sv.products.identity.attach('.login-btn', {
|
|
305
305
|
* onSuccess: (result) => console.log('Verified:', result.identity)
|
|
306
306
|
* });
|
|
307
307
|
*
|
|
@@ -360,12 +360,26 @@ declare class IdentityModule {
|
|
|
360
360
|
}): Promise<VerifyResult>;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Products Module
|
|
365
|
+
*
|
|
366
|
+
* Namespace for SparkVault first-party products. Each product is a
|
|
367
|
+
* self-contained surface (UI + API) the account can enable independently.
|
|
368
|
+
* Currently exposes `identity`; future products attach here alongside it.
|
|
369
|
+
*/
|
|
370
|
+
|
|
371
|
+
declare class ProductsModule {
|
|
372
|
+
/** Identity verification product (passkey, TOTP, SparkLink, social). */
|
|
373
|
+
readonly identity: IdentityModule;
|
|
374
|
+
constructor(config: ResolvedConfig);
|
|
375
|
+
}
|
|
376
|
+
|
|
363
377
|
/**
|
|
364
378
|
* SparkVault SDK HTTP Client
|
|
365
379
|
*/
|
|
366
380
|
|
|
367
381
|
interface RequestOptions {
|
|
368
|
-
method?: 'GET' | 'POST' | 'DELETE';
|
|
382
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
369
383
|
headers?: Record<string, string>;
|
|
370
384
|
body?: unknown;
|
|
371
385
|
timeout?: number;
|
|
@@ -423,6 +437,8 @@ declare class HttpClient {
|
|
|
423
437
|
private extractResponseMeta;
|
|
424
438
|
get<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
|
|
425
439
|
post<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
440
|
+
put<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
441
|
+
patch<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
426
442
|
delete<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
|
|
427
443
|
}
|
|
428
444
|
|
|
@@ -432,8 +448,6 @@ declare class HttpClient {
|
|
|
432
448
|
interface CreateVaultOptions {
|
|
433
449
|
/** Vault name */
|
|
434
450
|
name: string;
|
|
435
|
-
/** Store VMK server-side (less secure, more convenient) */
|
|
436
|
-
hostedVmk?: boolean;
|
|
437
451
|
}
|
|
438
452
|
interface Vault {
|
|
439
453
|
/** Vault ID */
|
|
@@ -444,8 +458,6 @@ interface Vault {
|
|
|
444
458
|
vmk: string;
|
|
445
459
|
/** Creation timestamp (Unix seconds) */
|
|
446
460
|
createdAt: number;
|
|
447
|
-
/** Whether VMK is hosted server-side */
|
|
448
|
-
hostedVmk: boolean;
|
|
449
461
|
}
|
|
450
462
|
interface UnsealedVault {
|
|
451
463
|
/** Vault ID */
|
|
@@ -470,42 +482,91 @@ interface VaultSummary {
|
|
|
470
482
|
ingotCount: number;
|
|
471
483
|
/** Total storage used in bytes */
|
|
472
484
|
storageBytes: number;
|
|
473
|
-
/** Whether VMK is hosted server-side */
|
|
474
|
-
hostedVmk: boolean;
|
|
475
485
|
}
|
|
476
|
-
|
|
477
|
-
|
|
486
|
+
/** A single vault's detail, as returned by get. */
|
|
487
|
+
interface VaultDetail {
|
|
488
|
+
/** Vault ID */
|
|
478
489
|
id: string;
|
|
479
|
-
/**
|
|
490
|
+
/** Vault name */
|
|
480
491
|
name: string;
|
|
481
|
-
/**
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
|
|
492
|
+
/** Optional description */
|
|
493
|
+
description: string | null;
|
|
494
|
+
/** Sealed/unsealed status */
|
|
495
|
+
status: string;
|
|
496
|
+
/** Number of ingots */
|
|
497
|
+
ingotCount: number;
|
|
498
|
+
/** Total storage used in bytes */
|
|
499
|
+
storageBytes: number;
|
|
485
500
|
/** Creation timestamp (Unix seconds) */
|
|
486
501
|
createdAt: number;
|
|
502
|
+
/** Last unseal timestamp (Unix seconds), or null */
|
|
503
|
+
lastUnsealedAt: number | null;
|
|
504
|
+
/** Lifetime unseal count */
|
|
505
|
+
unsealCount: number;
|
|
487
506
|
}
|
|
488
|
-
|
|
489
|
-
|
|
507
|
+
/** The result of renaming a vault. */
|
|
508
|
+
interface UpdatedVault {
|
|
509
|
+
/** Vault ID */
|
|
490
510
|
id: string;
|
|
491
|
-
/**
|
|
511
|
+
/** Vault name */
|
|
492
512
|
name: string;
|
|
493
|
-
/**
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
|
|
497
|
-
/** Forge upload session expiry (Unix seconds) */
|
|
498
|
-
uploadExpiresAt: number;
|
|
513
|
+
/** Optional description */
|
|
514
|
+
description: string | null;
|
|
515
|
+
/** Update timestamp (Unix seconds) */
|
|
516
|
+
updatedAt: number;
|
|
499
517
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
518
|
+
/** Vault public-sharing configuration. */
|
|
519
|
+
interface VaultSharingConfig {
|
|
520
|
+
/** Vault ID */
|
|
521
|
+
vaultId: string;
|
|
522
|
+
/** Whether public sharing is enabled */
|
|
523
|
+
publicSharingEnabled: boolean;
|
|
524
|
+
/** Whether all ingots are public */
|
|
525
|
+
allIngotsPublic: boolean;
|
|
526
|
+
/** Public-session lifetime in seconds, or null */
|
|
527
|
+
sessionLengthSeconds: number | null;
|
|
528
|
+
/** Timestamp sharing was enabled (Unix seconds), or null */
|
|
529
|
+
enabledAt: number | null;
|
|
530
|
+
}
|
|
531
|
+
/** Options for enabling/updating vault sharing. */
|
|
532
|
+
interface VaultSharingOptions {
|
|
533
|
+
/** Make all ingots public */
|
|
534
|
+
allIngotsPublic?: boolean;
|
|
535
|
+
/** Public-session lifetime in seconds */
|
|
536
|
+
sessionLengthSeconds?: number;
|
|
537
|
+
}
|
|
538
|
+
/** Vault access-log retention configuration. */
|
|
539
|
+
interface AccessLogRetention {
|
|
540
|
+
/** Vault ID */
|
|
541
|
+
vaultId: string;
|
|
542
|
+
/** Retention window in seconds */
|
|
543
|
+
retentionSeconds: number;
|
|
544
|
+
}
|
|
545
|
+
/** Vault upload-channel configuration. */
|
|
546
|
+
interface VaultUploadSettings {
|
|
547
|
+
/** Vault ID */
|
|
548
|
+
vaultId: string;
|
|
549
|
+
/** Whether the upload portal is enabled */
|
|
550
|
+
uploadPortalEnabled: boolean;
|
|
551
|
+
/** Timestamp the portal was enabled (Unix seconds), or null */
|
|
552
|
+
uploadPortalEnabledAt: number | null;
|
|
553
|
+
/** Whether the upload widget is enabled */
|
|
554
|
+
uploadWidgetEnabled: boolean;
|
|
555
|
+
/** Timestamp the widget was enabled (Unix seconds), or null */
|
|
556
|
+
uploadWidgetEnabledAt: number | null;
|
|
557
|
+
/** Max upload size in bytes, or null for the account default */
|
|
558
|
+
maxSizeBytes: number | null;
|
|
559
|
+
/** Upload notification email, or null */
|
|
560
|
+
notificationEmail: string | null;
|
|
561
|
+
/** Public portal URL (present when the portal is enabled) */
|
|
562
|
+
portalUrl?: string;
|
|
563
|
+
}
|
|
564
|
+
/** Options for updating vault upload settings. */
|
|
565
|
+
interface UpdateVaultUploadOptions {
|
|
566
|
+
/** Max upload size in bytes */
|
|
567
|
+
maxSizeBytes?: number;
|
|
568
|
+
/** Upload notification email, or null to clear */
|
|
569
|
+
notificationEmail?: string | null;
|
|
509
570
|
}
|
|
510
571
|
|
|
511
572
|
/**
|
|
@@ -647,8 +708,10 @@ interface UploadResult {
|
|
|
647
708
|
/**
|
|
648
709
|
* Vaults Module
|
|
649
710
|
*
|
|
650
|
-
* Create and manage encrypted vaults
|
|
651
|
-
*
|
|
711
|
+
* Create and manage encrypted vaults (the control plane). Uses Triple
|
|
712
|
+
* Zero-Trust encryption (SVMK + AMK + VMK). Ingot, folder, spark, and entropy
|
|
713
|
+
* operations live in their own modules; this module owns the vault record,
|
|
714
|
+
* its sharing/upload configuration, and the browser upload widget.
|
|
652
715
|
*/
|
|
653
716
|
|
|
654
717
|
/**
|
|
@@ -665,16 +728,8 @@ interface UploadCallable {
|
|
|
665
728
|
render(options: UploadOptions): Promise<UploadResult>;
|
|
666
729
|
}
|
|
667
730
|
declare class VaultsModule {
|
|
668
|
-
private readonly config;
|
|
669
731
|
private readonly http;
|
|
670
732
|
private readonly uploadModule;
|
|
671
|
-
/**
|
|
672
|
-
* Forge transfer client for authenticated ingot uploads. A dedicated
|
|
673
|
-
* instance: the widget's own client is session-scoped (reset/aborted with
|
|
674
|
-
* the widget lifecycle), and sharing it would let a widget close() abort
|
|
675
|
-
* an unrelated uploadIngot() transfer.
|
|
676
|
-
*/
|
|
677
|
-
private readonly uploadApi;
|
|
678
733
|
/**
|
|
679
734
|
* Upload to a vault with public upload enabled.
|
|
680
735
|
*
|
|
@@ -704,7 +759,7 @@ declare class VaultsModule {
|
|
|
704
759
|
*
|
|
705
760
|
* @example
|
|
706
761
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
707
|
-
* console.log('
|
|
762
|
+
* console.log('Token:', unsealed.vatToken);
|
|
708
763
|
*/
|
|
709
764
|
unseal(vaultId: string, vmk: string): Promise<UnsealedVault>;
|
|
710
765
|
/**
|
|
@@ -716,51 +771,892 @@ declare class VaultsModule {
|
|
|
716
771
|
*/
|
|
717
772
|
list(): Promise<VaultSummary[]>;
|
|
718
773
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
774
|
+
* Get a single vault's detail.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* const vault = await sv.vaults.get('vlt_abc');
|
|
778
|
+
* console.log(vault.status, vault.ingotCount);
|
|
779
|
+
*/
|
|
780
|
+
get(vaultId: string): Promise<VaultDetail>;
|
|
781
|
+
/**
|
|
782
|
+
* Rename a vault.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* await sv.vaults.update('vlt_abc', { name: 'Renamed Vault' });
|
|
786
|
+
*/
|
|
787
|
+
update(vaultId: string, options: {
|
|
788
|
+
name: string;
|
|
789
|
+
}): Promise<UpdatedVault>;
|
|
790
|
+
/**
|
|
791
|
+
* Seal a vault, revoking all active access tokens.
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* await sv.vaults.seal('vlt_abc');
|
|
795
|
+
*/
|
|
796
|
+
seal(vaultId: string): Promise<void>;
|
|
797
|
+
/**
|
|
798
|
+
* Delete a vault and all its ingots. This action is irreversible!
|
|
721
799
|
*
|
|
722
800
|
* @example
|
|
723
801
|
* await sv.vaults.delete('vlt_abc', vmk);
|
|
724
802
|
*/
|
|
725
803
|
delete(vaultId: string, vmk: string): Promise<void>;
|
|
726
804
|
/**
|
|
727
|
-
*
|
|
805
|
+
* Get a vault's public-sharing configuration.
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* const sharing = await sv.vaults.getSharingConfig('vlt_abc');
|
|
809
|
+
*/
|
|
810
|
+
getSharingConfig(vaultId: string): Promise<VaultSharingConfig>;
|
|
811
|
+
/**
|
|
812
|
+
* Enable public sharing for a vault.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* await sv.vaults.enableSharing('vlt_abc', vmk, { sessionLengthSeconds: 3600 });
|
|
816
|
+
*/
|
|
817
|
+
enableSharing(vaultId: string, vmk: string, options?: VaultSharingOptions): Promise<VaultSharingConfig>;
|
|
818
|
+
/**
|
|
819
|
+
* Disable public sharing for a vault.
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* await sv.vaults.disableSharing('vlt_abc');
|
|
823
|
+
*/
|
|
824
|
+
disableSharing(vaultId: string): Promise<VaultSharingConfig>;
|
|
825
|
+
/**
|
|
826
|
+
* Update a vault's sharing configuration (without changing enabled state).
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* await sv.vaults.updateSharingConfig('vlt_abc', { allIngotsPublic: true });
|
|
830
|
+
*/
|
|
831
|
+
updateSharingConfig(vaultId: string, config: VaultSharingOptions): Promise<VaultSharingConfig>;
|
|
832
|
+
/**
|
|
833
|
+
* Get a vault's access-log retention window.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* const { retentionSeconds } = await sv.vaults.getAccessLogRetention('vlt_abc');
|
|
837
|
+
*/
|
|
838
|
+
getAccessLogRetention(vaultId: string): Promise<AccessLogRetention>;
|
|
839
|
+
/**
|
|
840
|
+
* Update a vault's access-log retention window.
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* await sv.vaults.updateAccessLogRetention('vlt_abc', 7776000);
|
|
844
|
+
*/
|
|
845
|
+
updateAccessLogRetention(vaultId: string, seconds: number): Promise<AccessLogRetention>;
|
|
846
|
+
/**
|
|
847
|
+
* Get a vault's upload-channel configuration.
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* const upload = await sv.vaults.getUploadConfig('vlt_abc');
|
|
851
|
+
*/
|
|
852
|
+
getUploadConfig(vaultId: string): Promise<VaultUploadSettings>;
|
|
853
|
+
/**
|
|
854
|
+
* Enable the public upload portal for a vault.
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* await sv.vaults.enableUploadPortal('vlt_abc', vmk);
|
|
858
|
+
*/
|
|
859
|
+
enableUploadPortal(vaultId: string, vmk: string): Promise<VaultUploadSettings>;
|
|
860
|
+
/**
|
|
861
|
+
* Disable the public upload portal for a vault.
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* await sv.vaults.disableUploadPortal('vlt_abc');
|
|
865
|
+
*/
|
|
866
|
+
disableUploadPortal(vaultId: string): Promise<VaultUploadSettings>;
|
|
867
|
+
/**
|
|
868
|
+
* Enable the upload widget for a vault.
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* await sv.vaults.enableUploadWidget('vlt_abc', vmk);
|
|
872
|
+
*/
|
|
873
|
+
enableUploadWidget(vaultId: string, vmk: string): Promise<VaultUploadSettings>;
|
|
874
|
+
/**
|
|
875
|
+
* Disable the upload widget for a vault.
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* await sv.vaults.disableUploadWidget('vlt_abc');
|
|
879
|
+
*/
|
|
880
|
+
disableUploadWidget(vaultId: string): Promise<VaultUploadSettings>;
|
|
881
|
+
/**
|
|
882
|
+
* Update a vault's upload settings (max size, notification email).
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
* await sv.vaults.updateUploadConfig('vlt_abc', { maxSizeBytes: 1048576 });
|
|
886
|
+
*/
|
|
887
|
+
updateUploadConfig(vaultId: string, config: UpdateVaultUploadOptions): Promise<VaultUploadSettings>;
|
|
888
|
+
private toggleUploadChannel;
|
|
889
|
+
private normalizeVaultId;
|
|
890
|
+
private validateCreateOptions;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Ingots Module Types
|
|
895
|
+
*
|
|
896
|
+
* Ingot operations run against an unsealed vault: every call carries the
|
|
897
|
+
* vault's short-lived Vault Access Token (VAT) via the `X-Vault-Access-Token`
|
|
898
|
+
* header. Public domain objects are camelCase; wire shapes (snake_case) stay
|
|
899
|
+
* private to the module.
|
|
900
|
+
*/
|
|
901
|
+
|
|
902
|
+
/** Ingot metadata as returned by list/get/contents. */
|
|
903
|
+
interface Ingot {
|
|
904
|
+
/** Ingot ID */
|
|
905
|
+
id: string;
|
|
906
|
+
/** Ingot name */
|
|
907
|
+
name: string;
|
|
908
|
+
/** Content type (MIME) */
|
|
909
|
+
contentType: string;
|
|
910
|
+
/** Size in bytes */
|
|
911
|
+
size: number;
|
|
912
|
+
/** Lifecycle status (uploading | active | failed) */
|
|
913
|
+
status: string;
|
|
914
|
+
/** Creation timestamp (Unix seconds) */
|
|
915
|
+
createdAt: number;
|
|
916
|
+
/** Containing folder ID, or null at the vault root */
|
|
917
|
+
folderId: string | null;
|
|
918
|
+
}
|
|
919
|
+
/** The discrete primitive returned by createUpload — a Forge TUS session. */
|
|
920
|
+
interface IngotUpload {
|
|
921
|
+
/** Ingot ID */
|
|
922
|
+
id: string;
|
|
923
|
+
/** Ingot name */
|
|
924
|
+
name: string;
|
|
925
|
+
/** Content type (MIME) */
|
|
926
|
+
contentType: string;
|
|
927
|
+
/** Size in bytes */
|
|
928
|
+
size: number;
|
|
929
|
+
/** Forge upload URL carrying the ISTK (upload session token) */
|
|
930
|
+
uploadUrl: string;
|
|
931
|
+
/** Upload session expiry (Unix seconds) */
|
|
932
|
+
expiresAt: number;
|
|
933
|
+
}
|
|
934
|
+
/** A finalized ingot, returned by the high-level upload/replace flows. */
|
|
935
|
+
interface CreatedIngot {
|
|
936
|
+
/** Ingot ID */
|
|
937
|
+
id: string;
|
|
938
|
+
/** Ingot name */
|
|
939
|
+
name: string;
|
|
940
|
+
/** Content type (MIME) */
|
|
941
|
+
contentType: string;
|
|
942
|
+
/** Size in bytes */
|
|
943
|
+
size: number;
|
|
944
|
+
}
|
|
945
|
+
/** The discrete primitive returned by createDownloadLink. */
|
|
946
|
+
interface IngotDownloadLink {
|
|
947
|
+
/** Short-lived signed Forge download URL */
|
|
948
|
+
downloadUrl: string;
|
|
949
|
+
/** Ingot ID */
|
|
950
|
+
id: string;
|
|
951
|
+
/** Ingot name */
|
|
952
|
+
name: string;
|
|
953
|
+
/** Size in bytes */
|
|
954
|
+
size: number;
|
|
955
|
+
/** Content type (MIME) */
|
|
956
|
+
contentType: string;
|
|
957
|
+
}
|
|
958
|
+
/** Options for the createUpload primitive. */
|
|
959
|
+
interface CreateUploadOptions {
|
|
960
|
+
/** Unsealed vault the ingot belongs to */
|
|
961
|
+
vault: UnsealedVault;
|
|
962
|
+
/** Ingot name */
|
|
963
|
+
name: string;
|
|
964
|
+
/** Content type (MIME) */
|
|
965
|
+
contentType: string;
|
|
966
|
+
/** Declared upload size in bytes */
|
|
967
|
+
sizeBytes: number;
|
|
968
|
+
/** Slash-delimited folder path (find-or-created from root). */
|
|
969
|
+
folder?: string;
|
|
970
|
+
/** Existing folder ID to upload into. Mutually exclusive with `folder`. */
|
|
971
|
+
folderId?: string;
|
|
972
|
+
}
|
|
973
|
+
/** Options for the high-level upload flow. */
|
|
974
|
+
interface UploadIngotOptions {
|
|
975
|
+
/** File or Blob to upload */
|
|
976
|
+
file: File | Blob;
|
|
977
|
+
/** Optional name (defaults to file name) */
|
|
978
|
+
name?: string;
|
|
979
|
+
/** Content type (auto-detected from the file if not provided) */
|
|
980
|
+
contentType?: string;
|
|
981
|
+
/** Slash-delimited folder path (find-or-created from root). */
|
|
982
|
+
folder?: string;
|
|
983
|
+
/** Existing folder ID to upload into. Mutually exclusive with `folder`. */
|
|
984
|
+
folderId?: string;
|
|
985
|
+
/** Progress callback for the Forge/TUS transfer */
|
|
986
|
+
onProgress?: (bytesUploaded: number, bytesTotal: number) => void;
|
|
987
|
+
}
|
|
988
|
+
/** Options for replacing an existing ingot's content. */
|
|
989
|
+
interface ReplaceIngotOptions {
|
|
990
|
+
/** File or Blob to upload as the new content */
|
|
991
|
+
file: File | Blob;
|
|
992
|
+
/** Optional new name (defaults to file name) */
|
|
993
|
+
name?: string;
|
|
994
|
+
/** Content type (auto-detected from the file if not provided) */
|
|
995
|
+
contentType?: string;
|
|
996
|
+
/** Progress callback for the Forge/TUS transfer */
|
|
997
|
+
onProgress?: (bytesUploaded: number, bytesTotal: number) => void;
|
|
998
|
+
}
|
|
999
|
+
/** Options for list. */
|
|
1000
|
+
interface ListIngotsOptions {
|
|
1001
|
+
/** Page size */
|
|
1002
|
+
limit?: number;
|
|
1003
|
+
/** Pagination cursor */
|
|
1004
|
+
cursor?: string;
|
|
1005
|
+
/** Sort field (name | size | content_type | created | access_count) */
|
|
1006
|
+
sortBy?: string;
|
|
1007
|
+
/** Sort direction */
|
|
1008
|
+
sortOrder?: 'asc' | 'desc';
|
|
1009
|
+
}
|
|
1010
|
+
/** Options for listContents. */
|
|
1011
|
+
interface ListContentsOptions {
|
|
1012
|
+
/** Folder to list (null/omitted lists the vault root) */
|
|
1013
|
+
folderId?: string | null;
|
|
1014
|
+
/** Page size */
|
|
1015
|
+
limit?: number;
|
|
1016
|
+
/** Pagination cursor */
|
|
1017
|
+
cursor?: string;
|
|
1018
|
+
/** Sort field */
|
|
1019
|
+
sortBy?: string;
|
|
1020
|
+
/** Sort direction */
|
|
1021
|
+
sortOrder?: 'asc' | 'desc';
|
|
1022
|
+
/** Filter by item type */
|
|
1023
|
+
type?: string;
|
|
1024
|
+
}
|
|
1025
|
+
/** Options for search. */
|
|
1026
|
+
interface SearchIngotsOptions {
|
|
1027
|
+
/** Free-text query */
|
|
1028
|
+
q?: string;
|
|
1029
|
+
/** File type filter */
|
|
1030
|
+
fileType?: string;
|
|
1031
|
+
/** Minimum size in bytes */
|
|
1032
|
+
minSize?: number;
|
|
1033
|
+
/** Maximum size in bytes */
|
|
1034
|
+
maxSize?: number;
|
|
1035
|
+
/** Page size */
|
|
1036
|
+
limit?: number;
|
|
1037
|
+
/** Pagination cursor */
|
|
1038
|
+
cursor?: string;
|
|
1039
|
+
/** Sort direction */
|
|
1040
|
+
sortOrder?: 'asc' | 'desc';
|
|
1041
|
+
}
|
|
1042
|
+
/** A page of ingots. */
|
|
1043
|
+
interface IngotPage {
|
|
1044
|
+
/** Ingots on this page */
|
|
1045
|
+
ingots: Ingot[];
|
|
1046
|
+
/** Cursor for the next page, when more results exist */
|
|
1047
|
+
nextCursor?: string;
|
|
1048
|
+
}
|
|
1049
|
+
/** Ingot sharing configuration. */
|
|
1050
|
+
interface IngotSharingConfig {
|
|
1051
|
+
/** Whether the ingot is shared */
|
|
1052
|
+
shared: boolean;
|
|
1053
|
+
/** Visibility mode */
|
|
1054
|
+
visibility?: 'invite_only' | 'authenticated' | 'public';
|
|
1055
|
+
/** Active invites */
|
|
1056
|
+
invites?: IngotInvite[];
|
|
1057
|
+
}
|
|
1058
|
+
/** Options for updateSharingConfig. */
|
|
1059
|
+
interface UpdateIngotSharingOptions {
|
|
1060
|
+
/** Whether the ingot is shared */
|
|
1061
|
+
shared?: boolean;
|
|
1062
|
+
/** Visibility mode */
|
|
1063
|
+
visibility?: 'invite_only' | 'authenticated' | 'public';
|
|
1064
|
+
}
|
|
1065
|
+
/** Options for addInvite. */
|
|
1066
|
+
interface AddInviteOptions {
|
|
1067
|
+
/** Invite lifetime in seconds. Omit to inherit the link's existing expiry. */
|
|
1068
|
+
expiresInSeconds?: number;
|
|
1069
|
+
}
|
|
1070
|
+
/** A sharing invite on an ingot. */
|
|
1071
|
+
interface IngotInvite {
|
|
1072
|
+
/** Invite ID */
|
|
1073
|
+
id: string;
|
|
1074
|
+
/** Invited identity (email/phone) */
|
|
1075
|
+
identity: string;
|
|
1076
|
+
/** Identity type */
|
|
1077
|
+
identityType: string;
|
|
1078
|
+
}
|
|
1079
|
+
/** An ingot access-log entry. */
|
|
1080
|
+
interface IngotAccessLog {
|
|
1081
|
+
/** Log entry ID */
|
|
1082
|
+
id: string;
|
|
1083
|
+
/** Action performed (download | view) */
|
|
1084
|
+
action: string;
|
|
1085
|
+
/** Acting identity */
|
|
1086
|
+
identity: string;
|
|
1087
|
+
/** Source IP address */
|
|
1088
|
+
ipAddress: string;
|
|
1089
|
+
/** Client user agent */
|
|
1090
|
+
userAgent: string;
|
|
1091
|
+
/** Event timestamp (Unix seconds) */
|
|
1092
|
+
timestamp: number;
|
|
1093
|
+
}
|
|
1094
|
+
/** A page of access logs. */
|
|
1095
|
+
interface IngotAccessLogPage {
|
|
1096
|
+
/** Log entries on this page */
|
|
1097
|
+
logs: IngotAccessLog[];
|
|
1098
|
+
/** Cursor for the next page, when more results exist */
|
|
1099
|
+
nextCursor?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/** Options for getAccessLogs. */
|
|
1102
|
+
interface AccessLogsOptions {
|
|
1103
|
+
/** Page size */
|
|
1104
|
+
limit?: number;
|
|
1105
|
+
/** Pagination cursor */
|
|
1106
|
+
cursor?: string;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Ingots Module
|
|
1111
|
+
*
|
|
1112
|
+
* Data-plane operations on the contents of an *unsealed* vault. Every method
|
|
1113
|
+
* takes the {@link UnsealedVault} returned by `sv.vaults.unseal(...)` and
|
|
1114
|
+
* authenticates with its short-lived Vault Access Token (VAT).
|
|
1115
|
+
*
|
|
1116
|
+
* Uploads and downloads run over the single canonical Forge TUS transfer path
|
|
1117
|
+
* (shared with the public upload widget), with server-side finalization and
|
|
1118
|
+
* download-host allowlisting enforced — no per-size branching.
|
|
1119
|
+
*/
|
|
1120
|
+
|
|
1121
|
+
declare class IngotsModule {
|
|
1122
|
+
private readonly config;
|
|
1123
|
+
private readonly http;
|
|
1124
|
+
/**
|
|
1125
|
+
* Forge transfer client for authenticated ingot uploads. A dedicated
|
|
1126
|
+
* instance: the widget's own client is session-scoped (reset/aborted with
|
|
1127
|
+
* the widget lifecycle), and sharing it would let a widget close() abort an
|
|
1128
|
+
* unrelated upload() transfer.
|
|
1129
|
+
*/
|
|
1130
|
+
private readonly uploadApi;
|
|
1131
|
+
constructor(config: ResolvedConfig, http: HttpClient);
|
|
1132
|
+
/**
|
|
1133
|
+
* Create an ingot upload session (discrete primitive).
|
|
1134
|
+
*
|
|
1135
|
+
* Reserves the ingot record and returns the Forge upload URL (carrying the
|
|
1136
|
+
* ISTK upload session token). Use this when you want to drive the TUS
|
|
1137
|
+
* transfer yourself; otherwise prefer {@link upload}.
|
|
1138
|
+
*
|
|
1139
|
+
* @example
|
|
1140
|
+
* const session = await sv.ingots.createUpload({
|
|
1141
|
+
* vault: unsealed, name: 'report.pdf',
|
|
1142
|
+
* contentType: 'application/pdf', sizeBytes: file.size,
|
|
1143
|
+
* });
|
|
1144
|
+
* console.log(session.uploadUrl);
|
|
1145
|
+
*/
|
|
1146
|
+
createUpload(options: CreateUploadOptions): Promise<IngotUpload>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Upload a file as a new ingot (high-level flow).
|
|
1149
|
+
*
|
|
1150
|
+
* Creates the upload session, streams the file to Forge over TUS, then
|
|
1151
|
+
* confirms the server finalized the upload before resolving.
|
|
728
1152
|
*
|
|
729
1153
|
* @example
|
|
730
|
-
* const ingot = await sv.
|
|
731
|
-
* file: myFile,
|
|
732
|
-
* name: 'document.pdf'
|
|
1154
|
+
* const ingot = await sv.ingots.upload(unsealed, {
|
|
1155
|
+
* file: myFile, name: 'document.pdf'
|
|
733
1156
|
* });
|
|
734
1157
|
*/
|
|
735
|
-
|
|
1158
|
+
upload(vault: UnsealedVault, options: UploadIngotOptions): Promise<CreatedIngot>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Replace an existing ingot's content (high-level flow).
|
|
1161
|
+
*
|
|
1162
|
+
* @example
|
|
1163
|
+
* await sv.ingots.replace(unsealed, 'ing_abc', { file: updatedFile });
|
|
1164
|
+
*/
|
|
1165
|
+
replace(vault: UnsealedVault, ingotId: string, options: ReplaceIngotOptions): Promise<CreatedIngot>;
|
|
1166
|
+
/**
|
|
1167
|
+
* Rename an ingot.
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* await sv.ingots.rename(unsealed, 'ing_abc', 'new-name.pdf');
|
|
1171
|
+
*/
|
|
1172
|
+
rename(vault: UnsealedVault, ingotId: string, name: string): Promise<Ingot>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Move an ingot to a folder, or to the vault root with `null`.
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* await sv.ingots.move(unsealed, 'ing_abc', 'fld_xyz');
|
|
1178
|
+
* await sv.ingots.move(unsealed, 'ing_abc', null); // root
|
|
1179
|
+
*/
|
|
1180
|
+
move(vault: UnsealedVault, ingotId: string, folderId: string | null): Promise<Ingot>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Delete an ingot.
|
|
1183
|
+
*
|
|
1184
|
+
* @example
|
|
1185
|
+
* await sv.ingots.delete(unsealed, 'ing_abc');
|
|
1186
|
+
*/
|
|
1187
|
+
delete(vault: UnsealedVault, ingotId: string): Promise<void>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Get ingot metadata.
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* const ingot = await sv.ingots.get(unsealed, 'ing_abc');
|
|
1193
|
+
*/
|
|
1194
|
+
get(vault: UnsealedVault, ingotId: string): Promise<Ingot>;
|
|
1195
|
+
/**
|
|
1196
|
+
* List ingots in an unsealed vault.
|
|
1197
|
+
*
|
|
1198
|
+
* @example
|
|
1199
|
+
* const { ingots } = await sv.ingots.list(unsealed);
|
|
1200
|
+
*/
|
|
1201
|
+
list(vault: UnsealedVault, options?: ListIngotsOptions): Promise<IngotPage>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Search ingots in an unsealed vault.
|
|
1204
|
+
*
|
|
1205
|
+
* @example
|
|
1206
|
+
* const { ingots } = await sv.ingots.search(unsealed, { q: 'invoice' });
|
|
1207
|
+
*/
|
|
1208
|
+
search(vault: UnsealedVault, options?: SearchIngotsOptions): Promise<IngotPage>;
|
|
1209
|
+
/**
|
|
1210
|
+
* List the contents (ingots) of a folder, or the vault root.
|
|
1211
|
+
*
|
|
1212
|
+
* @example
|
|
1213
|
+
* const { ingots } = await sv.ingots.listContents(unsealed, { folderId: 'fld_x' });
|
|
1214
|
+
*/
|
|
1215
|
+
listContents(vault: UnsealedVault, options?: ListContentsOptions): Promise<IngotPage>;
|
|
736
1216
|
/**
|
|
737
|
-
*
|
|
1217
|
+
* Create a signed download link for an ingot (discrete primitive).
|
|
1218
|
+
*
|
|
1219
|
+
* Validates the returned URL against the download-host allowlist. Use this
|
|
1220
|
+
* when you want the URL itself; otherwise prefer {@link download}.
|
|
738
1221
|
*
|
|
739
1222
|
* @example
|
|
740
|
-
* const
|
|
1223
|
+
* const link = await sv.ingots.createDownloadLink(unsealed, 'ing_abc');
|
|
1224
|
+
* window.location.href = link.downloadUrl;
|
|
1225
|
+
*/
|
|
1226
|
+
createDownloadLink(vault: UnsealedVault, ingotId: string): Promise<IngotDownloadLink>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Download an ingot as a Blob (high-level flow).
|
|
1229
|
+
*
|
|
1230
|
+
* Requests a fresh signed link on every attempt (server URLs are
|
|
1231
|
+
* short-lived) and retries transient transport failures with exponential
|
|
1232
|
+
* backoff. Validation failures (bad host, non-HTTPS) are never retried.
|
|
1233
|
+
*
|
|
1234
|
+
* @example
|
|
1235
|
+
* const blob = await sv.ingots.download(unsealed, 'ing_abc');
|
|
741
1236
|
* const url = URL.createObjectURL(blob);
|
|
742
1237
|
*/
|
|
743
|
-
|
|
1238
|
+
download(vault: UnsealedVault, ingotId: string): Promise<Blob>;
|
|
744
1239
|
/**
|
|
745
|
-
*
|
|
1240
|
+
* Get an ingot's sharing configuration.
|
|
746
1241
|
*
|
|
747
1242
|
* @example
|
|
748
|
-
* const
|
|
749
|
-
* ingots.forEach(i => console.log(i.name, i.size));
|
|
1243
|
+
* const sharing = await sv.ingots.getSharingConfig(unsealed, 'ing_abc');
|
|
750
1244
|
*/
|
|
751
|
-
|
|
1245
|
+
getSharingConfig(vault: UnsealedVault, ingotId: string): Promise<IngotSharingConfig>;
|
|
752
1246
|
/**
|
|
753
|
-
*
|
|
1247
|
+
* Update an ingot's sharing configuration.
|
|
754
1248
|
*
|
|
755
1249
|
* @example
|
|
756
|
-
* await sv.
|
|
1250
|
+
* await sv.ingots.updateSharingConfig(unsealed, 'ing_abc', { shared: true });
|
|
757
1251
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1252
|
+
updateSharingConfig(vault: UnsealedVault, ingotId: string, config: UpdateIngotSharingOptions): Promise<IngotSharingConfig>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Invite an identity to a shared ingot. The identity type (email or phone)
|
|
1255
|
+
* is inferred server-side from the identity value.
|
|
1256
|
+
*
|
|
1257
|
+
* @example
|
|
1258
|
+
* await sv.ingots.addInvite(unsealed, 'ing_abc', 'user@example.com');
|
|
1259
|
+
* await sv.ingots.addInvite(unsealed, 'ing_abc', 'user@example.com', { expiresInSeconds: 86400 });
|
|
1260
|
+
*/
|
|
1261
|
+
addInvite(vault: UnsealedVault, ingotId: string, identity: string, options?: AddInviteOptions): Promise<IngotInvite>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Revoke an ingot sharing invite.
|
|
1264
|
+
*
|
|
1265
|
+
* @example
|
|
1266
|
+
* await sv.ingots.revokeInvite(unsealed, 'ing_abc', 'inv_123');
|
|
1267
|
+
*/
|
|
1268
|
+
revokeInvite(vault: UnsealedVault, ingotId: string, inviteId: string): Promise<void>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Get an ingot's access logs.
|
|
1271
|
+
*
|
|
1272
|
+
* @example
|
|
1273
|
+
* const { logs } = await sv.ingots.getAccessLogs(unsealed, 'ing_abc');
|
|
1274
|
+
*/
|
|
1275
|
+
getAccessLogs(vault: UnsealedVault, ingotId: string, options?: AccessLogsOptions): Promise<IngotAccessLogPage>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Request a Forge upload session for a new ingot.
|
|
1278
|
+
* Shared by createUpload and upload — the single ingot-create path.
|
|
1279
|
+
*/
|
|
1280
|
+
private requestUploadSession;
|
|
1281
|
+
/**
|
|
1282
|
+
* Run the canonical TUS transfer for a created/replaced ingot, then confirm
|
|
1283
|
+
* the server finalized the upload before reporting success.
|
|
1284
|
+
*/
|
|
1285
|
+
private transferAndFinalize;
|
|
1286
|
+
private validateFile;
|
|
761
1287
|
private validateDownloadUrl;
|
|
762
1288
|
}
|
|
763
1289
|
|
|
1290
|
+
/**
|
|
1291
|
+
* Folders Module Types
|
|
1292
|
+
*
|
|
1293
|
+
* Folders organize ingots within an unsealed vault. Public domain objects are
|
|
1294
|
+
* camelCase; wire shapes (snake_case) stay private to the module.
|
|
1295
|
+
*/
|
|
1296
|
+
|
|
1297
|
+
/** A folder within a vault. */
|
|
1298
|
+
interface Folder {
|
|
1299
|
+
/** Folder ID */
|
|
1300
|
+
id: string;
|
|
1301
|
+
/** Folder name */
|
|
1302
|
+
name: string;
|
|
1303
|
+
/** Parent folder ID, or null at the vault root */
|
|
1304
|
+
parentId: string | null;
|
|
1305
|
+
/** Whether the folder is pinned */
|
|
1306
|
+
pinned: boolean;
|
|
1307
|
+
/** Creation timestamp (Unix seconds) */
|
|
1308
|
+
createdAt: number;
|
|
1309
|
+
/** Last update timestamp (Unix seconds) */
|
|
1310
|
+
updatedAt: number;
|
|
1311
|
+
}
|
|
1312
|
+
/** A single hop in a folder breadcrumb trail. */
|
|
1313
|
+
interface FolderBreadcrumbItem {
|
|
1314
|
+
/** Folder ID, or null for the Root entry */
|
|
1315
|
+
id: string | null;
|
|
1316
|
+
/** Folder name */
|
|
1317
|
+
name: string;
|
|
1318
|
+
}
|
|
1319
|
+
/** Options for creating a folder. */
|
|
1320
|
+
interface CreateFolderOptions {
|
|
1321
|
+
/** Folder name */
|
|
1322
|
+
name: string;
|
|
1323
|
+
/** Parent folder ID, or null/omitted for the vault root */
|
|
1324
|
+
parentId?: string | null;
|
|
1325
|
+
}
|
|
1326
|
+
/** Options for updating a folder. */
|
|
1327
|
+
interface UpdateFolderOptions {
|
|
1328
|
+
/** New name */
|
|
1329
|
+
name?: string;
|
|
1330
|
+
/** New parent folder ID, or null for the vault root */
|
|
1331
|
+
parentId?: string | null;
|
|
1332
|
+
/** New pinned state */
|
|
1333
|
+
pinned?: boolean;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Folders Module
|
|
1338
|
+
*
|
|
1339
|
+
* Organize ingots within an *unsealed* vault. Every method takes the
|
|
1340
|
+
* {@link UnsealedVault} returned by `sv.vaults.unseal(...)` and authenticates
|
|
1341
|
+
* with its short-lived Vault Access Token (VAT).
|
|
1342
|
+
*/
|
|
1343
|
+
|
|
1344
|
+
declare class FoldersModule {
|
|
1345
|
+
private readonly http;
|
|
1346
|
+
constructor(http: HttpClient);
|
|
1347
|
+
/**
|
|
1348
|
+
* List all folders in a vault (flat list — build the tree client-side).
|
|
1349
|
+
*
|
|
1350
|
+
* @example
|
|
1351
|
+
* const folders = await sv.folders.list(unsealed);
|
|
1352
|
+
*/
|
|
1353
|
+
list(vault: UnsealedVault): Promise<Folder[]>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Get a single folder.
|
|
1356
|
+
*
|
|
1357
|
+
* @example
|
|
1358
|
+
* const folder = await sv.folders.get(unsealed, 'fld_abc');
|
|
1359
|
+
*/
|
|
1360
|
+
get(vault: UnsealedVault, folderId: string): Promise<Folder>;
|
|
1361
|
+
/**
|
|
1362
|
+
* Get a folder's breadcrumb trail (Root → … → folder).
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* const trail = await sv.folders.getBreadcrumb(unsealed, 'fld_abc');
|
|
1366
|
+
*/
|
|
1367
|
+
getBreadcrumb(vault: UnsealedVault, folderId: string): Promise<FolderBreadcrumbItem[]>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Create a folder.
|
|
1370
|
+
*
|
|
1371
|
+
* @example
|
|
1372
|
+
* const folder = await sv.folders.create(unsealed, { name: 'Invoices' });
|
|
1373
|
+
*/
|
|
1374
|
+
create(vault: UnsealedVault, data: CreateFolderOptions): Promise<Folder>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Update a folder (rename, move, pin/unpin).
|
|
1377
|
+
*
|
|
1378
|
+
* @example
|
|
1379
|
+
* await sv.folders.update(unsealed, 'fld_abc', { name: 'Renamed' });
|
|
1380
|
+
*/
|
|
1381
|
+
update(vault: UnsealedVault, folderId: string, data: UpdateFolderOptions): Promise<Folder>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Move a folder under a new parent, or to the vault root with `null`.
|
|
1384
|
+
*
|
|
1385
|
+
* @example
|
|
1386
|
+
* await sv.folders.move(unsealed, 'fld_abc', 'fld_parent');
|
|
1387
|
+
*/
|
|
1388
|
+
move(vault: UnsealedVault, folderId: string, newParentId: string | null): Promise<Folder>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Pin or unpin a folder.
|
|
1391
|
+
*
|
|
1392
|
+
* @example
|
|
1393
|
+
* await sv.folders.togglePin(unsealed, 'fld_abc', true);
|
|
1394
|
+
*/
|
|
1395
|
+
togglePin(vault: UnsealedVault, folderId: string, pinned: boolean): Promise<Folder>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Delete a folder.
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* await sv.folders.delete(unsealed, 'fld_abc');
|
|
1401
|
+
*/
|
|
1402
|
+
delete(vault: UnsealedVault, folderId: string): Promise<void>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Move an ingot into a folder, or to the vault root with `null`.
|
|
1405
|
+
*
|
|
1406
|
+
* @example
|
|
1407
|
+
* await sv.folders.moveIngot(unsealed, 'ing_abc', 'fld_xyz');
|
|
1408
|
+
*/
|
|
1409
|
+
moveIngot(vault: UnsealedVault, ingotId: string, folderId: string | null): Promise<void>;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Sparks Module Types
|
|
1414
|
+
*
|
|
1415
|
+
* Sparks are end-to-end encrypted, read-once ephemeral secrets scoped to the
|
|
1416
|
+
* account (no vault/VAT). Public domain objects are camelCase; wire shapes
|
|
1417
|
+
* (snake_case) stay private to the module.
|
|
1418
|
+
*/
|
|
1419
|
+
/** A spark summary as returned by list. */
|
|
1420
|
+
interface SparkSummary {
|
|
1421
|
+
/** Spark ID */
|
|
1422
|
+
id: string;
|
|
1423
|
+
/** Content type (MIME) */
|
|
1424
|
+
contentType: string;
|
|
1425
|
+
/** Size in bytes */
|
|
1426
|
+
size: number;
|
|
1427
|
+
/** Lifecycle status (active | expired | ash) */
|
|
1428
|
+
status: string;
|
|
1429
|
+
/** Creation timestamp (Unix seconds) */
|
|
1430
|
+
createdAt: number;
|
|
1431
|
+
/** Expiry timestamp (Unix seconds) */
|
|
1432
|
+
expiresAt: number;
|
|
1433
|
+
/** Burn timestamp (Unix seconds), or null if not yet read */
|
|
1434
|
+
burnedAt: number | null;
|
|
1435
|
+
/** Seconds remaining until expiry */
|
|
1436
|
+
timeRemaining: number;
|
|
1437
|
+
/** Optional file name (for file payloads) */
|
|
1438
|
+
filename?: string;
|
|
1439
|
+
/** Optional kindling family ID */
|
|
1440
|
+
kindling?: string;
|
|
1441
|
+
}
|
|
1442
|
+
/** The decrypted spark, returned by get (reading burns it). */
|
|
1443
|
+
interface Spark {
|
|
1444
|
+
/** Spark ID */
|
|
1445
|
+
id: string;
|
|
1446
|
+
/** Decrypted payload (text, or base64 for binary content types) */
|
|
1447
|
+
payload: string;
|
|
1448
|
+
/** Content type (MIME) */
|
|
1449
|
+
contentType: string;
|
|
1450
|
+
/** Size in bytes */
|
|
1451
|
+
size: number;
|
|
1452
|
+
/** Lifecycle status after the read (ash) */
|
|
1453
|
+
status: string;
|
|
1454
|
+
/** Creation timestamp (Unix seconds) */
|
|
1455
|
+
createdAt: number;
|
|
1456
|
+
/** Burn timestamp (Unix seconds) */
|
|
1457
|
+
burnedAt: number;
|
|
1458
|
+
/** Optional file name (for file payloads) */
|
|
1459
|
+
filename?: string;
|
|
1460
|
+
}
|
|
1461
|
+
/** A newly created spark. */
|
|
1462
|
+
interface CreatedSpark {
|
|
1463
|
+
/** Spark ID */
|
|
1464
|
+
id: string;
|
|
1465
|
+
/** Size in bytes */
|
|
1466
|
+
size: number;
|
|
1467
|
+
/** Lifecycle status (active) */
|
|
1468
|
+
status: string;
|
|
1469
|
+
/** Creation timestamp (Unix seconds) */
|
|
1470
|
+
createdAt: number;
|
|
1471
|
+
/** Expiry timestamp (Unix seconds) */
|
|
1472
|
+
expiresAt: number;
|
|
1473
|
+
/** Time-to-live in minutes */
|
|
1474
|
+
ttlMinutes: number;
|
|
1475
|
+
/** Optional file name (echoed when provided) */
|
|
1476
|
+
filename?: string;
|
|
1477
|
+
/** Optional kindling family ID (echoed when provided) */
|
|
1478
|
+
kindling?: string;
|
|
1479
|
+
}
|
|
1480
|
+
/** Options for list. */
|
|
1481
|
+
interface ListSparksOptions {
|
|
1482
|
+
/** Filter to a kindling family */
|
|
1483
|
+
kindling?: string;
|
|
1484
|
+
/** Filter by status */
|
|
1485
|
+
status?: string;
|
|
1486
|
+
/** Page size */
|
|
1487
|
+
limit?: number;
|
|
1488
|
+
/** Pagination cursor */
|
|
1489
|
+
cursor?: string;
|
|
1490
|
+
}
|
|
1491
|
+
/** A page of sparks. */
|
|
1492
|
+
interface SparkPage {
|
|
1493
|
+
/** Sparks on this page */
|
|
1494
|
+
sparks: SparkSummary[];
|
|
1495
|
+
/** Cursor for the next page, when more results exist */
|
|
1496
|
+
nextCursor?: string;
|
|
1497
|
+
}
|
|
1498
|
+
/** Options for create. */
|
|
1499
|
+
interface CreateSparkOptions {
|
|
1500
|
+
/** Payload (text, or base64 for binary content types) */
|
|
1501
|
+
payload: string;
|
|
1502
|
+
/** Content type (MIME). Defaults to text/plain. */
|
|
1503
|
+
contentType?: string;
|
|
1504
|
+
/** Time-to-live in minutes. Defaults to 1440 (24h). */
|
|
1505
|
+
ttlMinutes?: number;
|
|
1506
|
+
/** Join an existing kindling family by ID */
|
|
1507
|
+
kindling?: string;
|
|
1508
|
+
/** Generate a new kindling family for this spark */
|
|
1509
|
+
withKindling?: boolean;
|
|
1510
|
+
/** Optional file name (for file payloads) */
|
|
1511
|
+
filename?: string;
|
|
1512
|
+
}
|
|
1513
|
+
/** Visibility mode for a shared spark. */
|
|
1514
|
+
type SparkVisibility = 'public' | 'authenticated' | 'invite_only';
|
|
1515
|
+
/** Options for share. */
|
|
1516
|
+
interface ShareSparkOptions {
|
|
1517
|
+
/** Visibility mode. Defaults to public. */
|
|
1518
|
+
visibility?: SparkVisibility;
|
|
1519
|
+
/** Invited identities (emails/phones) */
|
|
1520
|
+
invites?: string[];
|
|
1521
|
+
/** Link lifetime in seconds */
|
|
1522
|
+
expiresInSeconds?: number;
|
|
1523
|
+
}
|
|
1524
|
+
/** The result of sharing a spark. */
|
|
1525
|
+
interface SparkShare {
|
|
1526
|
+
/** Whether the spark is shared */
|
|
1527
|
+
shared: boolean;
|
|
1528
|
+
/** Public share URL (x.sv link) */
|
|
1529
|
+
shareUrl?: string;
|
|
1530
|
+
/** Short link code */
|
|
1531
|
+
linkCode?: string;
|
|
1532
|
+
/** Visibility mode */
|
|
1533
|
+
visibility?: SparkVisibility;
|
|
1534
|
+
/** Invited identities */
|
|
1535
|
+
invites?: string[];
|
|
1536
|
+
/** Link expiry timestamp (Unix seconds) */
|
|
1537
|
+
expiresAt?: number;
|
|
1538
|
+
/** Link creation timestamp (Unix seconds) */
|
|
1539
|
+
createdAt?: number;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Sparks Module
|
|
1544
|
+
*
|
|
1545
|
+
* Create, read, share, and delete end-to-end encrypted, read-once ephemeral
|
|
1546
|
+
* secrets. Sparks are account-scoped — no vault or VAT is involved.
|
|
1547
|
+
*/
|
|
1548
|
+
|
|
1549
|
+
declare class SparksModule {
|
|
1550
|
+
private readonly http;
|
|
1551
|
+
constructor(http: HttpClient);
|
|
1552
|
+
/**
|
|
1553
|
+
* List sparks for the account.
|
|
1554
|
+
*
|
|
1555
|
+
* @example
|
|
1556
|
+
* const { sparks } = await sv.sparks.list();
|
|
1557
|
+
*/
|
|
1558
|
+
list(options?: ListSparksOptions): Promise<SparkPage>;
|
|
1559
|
+
/**
|
|
1560
|
+
* Read (and burn) a spark. Reading is destructive — the spark can be read
|
|
1561
|
+
* exactly once.
|
|
1562
|
+
*
|
|
1563
|
+
* @example
|
|
1564
|
+
* const spark = await sv.sparks.get('spk_abc');
|
|
1565
|
+
* console.log(spark.payload);
|
|
1566
|
+
*/
|
|
1567
|
+
get(sparkId: string): Promise<Spark>;
|
|
1568
|
+
/**
|
|
1569
|
+
* Create a spark.
|
|
1570
|
+
*
|
|
1571
|
+
* @example
|
|
1572
|
+
* const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
|
|
1573
|
+
*/
|
|
1574
|
+
create(options: CreateSparkOptions): Promise<CreatedSpark>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Delete a spark.
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* await sv.sparks.delete('spk_abc');
|
|
1580
|
+
*/
|
|
1581
|
+
delete(sparkId: string): Promise<void>;
|
|
1582
|
+
/**
|
|
1583
|
+
* Share a spark via a public SparkLink (x.sv URL).
|
|
1584
|
+
*
|
|
1585
|
+
* @example
|
|
1586
|
+
* const share = await sv.sparks.share('spk_abc', { visibility: 'public' });
|
|
1587
|
+
* console.log(share.shareUrl);
|
|
1588
|
+
*/
|
|
1589
|
+
share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
|
|
1590
|
+
/**
|
|
1591
|
+
* Get a spark's sharing status.
|
|
1592
|
+
*
|
|
1593
|
+
* @example
|
|
1594
|
+
* const share = await sv.sparks.getShare('spk_abc');
|
|
1595
|
+
*/
|
|
1596
|
+
getShare(sparkId: string): Promise<SparkShare>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Unshare a spark (delete its SparkLink).
|
|
1599
|
+
*
|
|
1600
|
+
* @example
|
|
1601
|
+
* await sv.sparks.unshare('spk_abc');
|
|
1602
|
+
*/
|
|
1603
|
+
unshare(sparkId: string): Promise<SparkShare>;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Entropy Module Types
|
|
1608
|
+
*
|
|
1609
|
+
* Hardware-backed random generation. Public domain objects are camelCase;
|
|
1610
|
+
* wire shapes (snake_case) stay private to the module.
|
|
1611
|
+
*/
|
|
1612
|
+
/** Output encoding for generated entropy. */
|
|
1613
|
+
type EntropyFormat = 'hex' | 'base64' | 'base64url' | 'alphanumeric' | 'alphanumeric-mixed' | 'password' | 'numeric' | 'uuid' | 'bytes';
|
|
1614
|
+
/** Options for generate. */
|
|
1615
|
+
interface GenerateEntropyOptions {
|
|
1616
|
+
/** Number of random bytes (1–1024) */
|
|
1617
|
+
bytes: number;
|
|
1618
|
+
/** Output format. Defaults to hex. */
|
|
1619
|
+
format?: EntropyFormat;
|
|
1620
|
+
}
|
|
1621
|
+
/** The result of generating entropy. */
|
|
1622
|
+
interface EntropyResult {
|
|
1623
|
+
/** Generated value in the requested format. For `bytes`, a number array. */
|
|
1624
|
+
value: string | number[];
|
|
1625
|
+
/** Number of bytes the server drew */
|
|
1626
|
+
numBytes: number;
|
|
1627
|
+
/** Format the value is encoded in */
|
|
1628
|
+
format: EntropyFormat;
|
|
1629
|
+
/** Server reference ID for the operation */
|
|
1630
|
+
referenceId?: string;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Entropy Module
|
|
1635
|
+
*
|
|
1636
|
+
* Generate cryptographically strong random values from the SparkVault
|
|
1637
|
+
* hardware-backed entropy service.
|
|
1638
|
+
*/
|
|
1639
|
+
|
|
1640
|
+
declare class EntropyModule {
|
|
1641
|
+
private readonly http;
|
|
1642
|
+
constructor(http: HttpClient);
|
|
1643
|
+
/**
|
|
1644
|
+
* Generate random entropy in the requested format.
|
|
1645
|
+
*
|
|
1646
|
+
* @example
|
|
1647
|
+
* const { value } = await sv.entropy.generate({ bytes: 32, format: 'hex' });
|
|
1648
|
+
*/
|
|
1649
|
+
generate(options: GenerateEntropyOptions): Promise<EntropyResult>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Generate `n` random bytes as a Uint8Array.
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* const key = await sv.entropy.generateBytes(32);
|
|
1655
|
+
*/
|
|
1656
|
+
generateBytes(n: number): Promise<Uint8Array>;
|
|
1657
|
+
private validateByteCount;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
764
1660
|
/**
|
|
765
1661
|
* SparkVault Debug Logger
|
|
766
1662
|
*
|
|
@@ -805,7 +1701,7 @@ declare const logger: {
|
|
|
805
1701
|
/**
|
|
806
1702
|
* SparkVault JavaScript SDK
|
|
807
1703
|
*
|
|
808
|
-
* A unified SDK for Identity and
|
|
1704
|
+
* A unified SDK for Identity, Vaults, Ingots, Folders, Sparks, and Entropy.
|
|
809
1705
|
*
|
|
810
1706
|
* @example CDN Usage (Recommended)
|
|
811
1707
|
* ```html
|
|
@@ -815,8 +1711,8 @@ declare const logger: {
|
|
|
815
1711
|
* ></script>
|
|
816
1712
|
*
|
|
817
1713
|
* <script>
|
|
818
|
-
* // SDK auto-initializes. Use JavaScript API:
|
|
819
|
-
* SparkVault.identity.attach('.login-btn', {
|
|
1714
|
+
* // SDK auto-initializes. Use the JavaScript API:
|
|
1715
|
+
* SparkVault.products.identity.attach('.login-btn', {
|
|
820
1716
|
* onSuccess: (result) => console.log('Verified:', result.identity)
|
|
821
1717
|
* });
|
|
822
1718
|
* </script>
|
|
@@ -828,17 +1724,25 @@ declare const logger: {
|
|
|
828
1724
|
*
|
|
829
1725
|
* const sv = SparkVault.init({ accountId: 'acc_your_account' });
|
|
830
1726
|
*
|
|
831
|
-
* const result = await sv.identity.verify();
|
|
1727
|
+
* const result = await sv.products.identity.verify();
|
|
832
1728
|
* console.log(result.identity, result.identityType);
|
|
833
1729
|
* ```
|
|
834
1730
|
*/
|
|
835
1731
|
|
|
836
1732
|
declare class SparkVault {
|
|
837
|
-
/** Identity verification
|
|
838
|
-
readonly
|
|
839
|
-
/**
|
|
1733
|
+
/** First-party products (Identity verification). */
|
|
1734
|
+
readonly products: ProductsModule;
|
|
1735
|
+
/** Encrypted vault control plane (create, unseal, sharing, upload config). */
|
|
840
1736
|
readonly vaults: VaultsModule;
|
|
841
|
-
/**
|
|
1737
|
+
/** Ingot data plane (upload, download, list, share) on an unsealed vault. */
|
|
1738
|
+
readonly ingots: IngotsModule;
|
|
1739
|
+
/** Folder organization within an unsealed vault. */
|
|
1740
|
+
readonly folders: FoldersModule;
|
|
1741
|
+
/** Read-once ephemeral encrypted secrets. */
|
|
1742
|
+
readonly sparks: SparksModule;
|
|
1743
|
+
/** Hardware-backed random generation. */
|
|
1744
|
+
readonly entropy: EntropyModule;
|
|
1745
|
+
/** API availability checks. */
|
|
842
1746
|
readonly health: HealthModule;
|
|
843
1747
|
private readonly config;
|
|
844
1748
|
private constructor();
|
|
@@ -864,5 +1768,5 @@ declare global {
|
|
|
864
1768
|
}
|
|
865
1769
|
}
|
|
866
1770
|
|
|
867
|
-
export { AuthenticationError, AuthorizationError, NetworkError, PlanRequiredError, PopupBlockedError, QuotaExceededError, SparkVault, SparkVaultError, TimeoutError, UserCancelledError, ValidationError, SparkVault as default, logger, setDebugMode };
|
|
868
|
-
export type { ApiResponse, AuthMethod, BandwidthPool, CreateVaultOptions, CreatedIngot, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, PoolState, PoolsMeta, QuotaResource, ResponseMeta, SparkVaultConfig, StoragePool, Theme, TokenClaims, UnsealedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultSummary, VaultUploadConfig, VerifyOptions, VerifyResult };
|
|
1771
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NetworkError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, SparkVault as default, logger, setDebugMode };
|
|
1772
|
+
export type { AccessLogRetention, AccessLogsOptions, ApiResponse, AuthMethod, BandwidthPool, CreateFolderOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, Folder, FolderBreadcrumbItem, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListSparksOptions, PoolState, PoolsMeta, QuotaResource, ReplaceIngotOptions, ResponseMeta, SearchIngotsOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StoragePool, Theme, TokenClaims, UnsealedVault, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultDetail, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult };
|