@sparkvault/sdk-js 1.24.4 → 1.24.6

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { ResolvedConfig } from '../config';
8
8
  import { HttpClient } from '../http';
9
- import type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, Ingot, UploadIngotOptions } from './types';
9
+ import type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, Ingot, CreatedIngot, UploadIngotOptions } from './types';
10
10
  import { type UploadOptions, type UploadAttachOptions, type UploadResult } from './upload';
11
11
  /**
12
12
  * Callable upload interface with methods.
@@ -18,6 +18,7 @@ export interface UploadCallable {
18
18
  close(): void;
19
19
  }
20
20
  export declare class VaultsModule {
21
+ private readonly config;
21
22
  private readonly http;
22
23
  private readonly uploadModule;
23
24
  /**
@@ -77,7 +78,7 @@ export declare class VaultsModule {
77
78
  * name: 'document.pdf'
78
79
  * });
79
80
  */
80
- uploadIngot(vault: UnsealedVault, options: UploadIngotOptions): Promise<Ingot>;
81
+ uploadIngot(vault: UnsealedVault, options: UploadIngotOptions): Promise<CreatedIngot>;
81
82
  /**
82
83
  * Download an ingot from an unsealed vault.
83
84
  *
@@ -103,7 +104,8 @@ export declare class VaultsModule {
103
104
  deleteIngot(vault: UnsealedVault, ingotId: string): Promise<void>;
104
105
  private validateCreateOptions;
105
106
  private validateUploadOptions;
107
+ private validateDownloadUrl;
106
108
  }
107
- export type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, Ingot, UploadIngotOptions, } from './types';
109
+ export type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, Ingot, CreatedIngot, UploadIngotOptions, } from './types';
108
110
  export type { UploadOptions, UploadAttachOptions, UploadResult, UploadProgress, VaultUploadConfig, UploadBranding, } from './upload';
109
111
  export { VaultUploadModule, UploadApiError } from './upload';
@@ -28,16 +28,14 @@ export interface UnsealVaultOptions {
28
28
  export interface UnsealedVault {
29
29
  /** Vault ID */
30
30
  id: string;
31
- /** Vault name */
32
- name: string;
33
- /** Vault Access Token (short-lived session) */
31
+ /** Vault Access Token (short-lived session, required for all ingot operations) */
34
32
  vatToken: string;
33
+ /** VAT issued-at timestamp (Unix seconds) */
34
+ issuedAt: number;
35
35
  /** VAT expiry timestamp (Unix seconds) */
36
36
  expiresAt: number;
37
- /** Number of ingots in vault */
38
- ingotCount: number;
39
- /** Total storage used in bytes */
40
- storageBytes: number;
37
+ /** VAT lifetime in seconds */
38
+ ttlSeconds: number;
41
39
  }
42
40
  export interface VaultSummary {
43
41
  /** Vault ID */
@@ -64,8 +62,18 @@ export interface Ingot {
64
62
  size: number;
65
63
  /** Creation timestamp (Unix seconds) */
66
64
  createdAt: number;
67
- /** Ingot type: 'standard' or 'structured' */
68
- type: 'standard' | 'structured';
65
+ }
66
+ export interface CreatedIngot {
67
+ /** Ingot ID */
68
+ id: string;
69
+ /** Ingot name */
70
+ name: string;
71
+ /** Content type (MIME) */
72
+ contentType: string;
73
+ /** Size in bytes */
74
+ size: number;
75
+ /** Forge upload session expiry (Unix seconds) */
76
+ uploadExpiresAt: number;
69
77
  }
70
78
  export interface UploadIngotOptions {
71
79
  /** File to upload */
@@ -85,14 +93,11 @@ export interface CreateVaultResponse {
85
93
  hosted_vmk: boolean;
86
94
  }
87
95
  export interface UnsealVaultResponse {
96
+ vat: string;
88
97
  vault_id: string;
89
- name?: string;
90
- vat_token?: string;
91
- vat?: string;
98
+ issued_at: number;
92
99
  expires_at: number;
93
- ingot_count?: number;
94
- storage_bytes?: number;
95
- storage_used_bytes?: number;
100
+ ttl_seconds: number;
96
101
  }
97
102
  export interface ListVaultsResponse {
98
103
  vaults: {
@@ -111,17 +116,16 @@ export interface ListIngotsResponse {
111
116
  content_type: string;
112
117
  size_bytes: number;
113
118
  created_at: number;
114
- ingot_type: 'standard' | 'structured';
115
119
  }[];
116
120
  }
117
121
  export interface CreateIngotResponse {
118
122
  ingot_id: string;
119
- name?: string;
120
- content_type?: string;
121
- size_bytes?: number;
122
- created_at?: number;
123
- ingot_type?: 'standard' | 'structured';
124
- forge_url?: string;
123
+ name: string;
124
+ content_type: string;
125
+ size_bytes: number;
126
+ status: 'uploading';
127
+ forge_url: string;
128
+ expires_at: number;
125
129
  }
126
130
  export interface DownloadIngotResponse {
127
131
  download_url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-js",
3
- "version": "1.24.4",
3
+ "version": "1.24.6",
4
4
  "description": "SparkVault JavaScript SDK - Identity Verification and Encrypted Vaults",
5
5
  "type": "module",
6
6
  "main": "dist/sparkvault.cjs.js",
@@ -36,7 +36,7 @@
36
36
  "url": "git+https://github.com/Spark-Vault/platform.git",
37
37
  "directory": "packages/sdk-js"
38
38
  },
39
- "homepage": "https://sparkvault.com/api/docs/sdk",
39
+ "homepage": "https://app.sparkvault.com/api/docs/sdk-js",
40
40
  "devDependencies": {
41
41
  "@eslint/js": "^9.0.0",
42
42
  "@rollup/plugin-commonjs": "^28.0.0",
@@ -1,54 +0,0 @@
1
- /**
2
- * RNG Module
3
- *
4
- * Generate cryptographically secure random numbers.
5
- * Uses hybrid entropy from AWS KMS HSM + local CSPRNG.
6
- */
7
- import { HttpClient } from '../http';
8
- import type { GenerateOptions, RandomResult } from './types';
9
- export declare class RNGModule {
10
- private readonly http;
11
- constructor(http: HttpClient);
12
- /**
13
- * Generate cryptographically secure random bytes.
14
- *
15
- * @example
16
- * const result = await sv.rng.generate({ bytes: 32, format: 'hex' });
17
- * console.log(result.value);
18
- */
19
- generate(options: GenerateOptions): Promise<RandomResult>;
20
- /**
21
- * Generate a random UUID v4.
22
- *
23
- * @example
24
- * const uuid = await sv.rng.uuid();
25
- * console.log(uuid); // 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
26
- */
27
- uuid(): Promise<string>;
28
- /**
29
- * Generate a random hex string.
30
- *
31
- * @example
32
- * const hex = await sv.rng.hex(16);
33
- * console.log(hex); // '1a2b3c4d5e6f7890...'
34
- */
35
- hex(bytes: number): Promise<string>;
36
- /**
37
- * Generate a random alphanumeric string.
38
- *
39
- * @example
40
- * const code = await sv.rng.alphanumeric(8);
41
- * console.log(code); // 'A1B2C3D4'
42
- */
43
- alphanumeric(bytes: number): Promise<string>;
44
- /**
45
- * Generate a random password with special characters.
46
- *
47
- * @example
48
- * const password = await sv.rng.password(16);
49
- * console.log(password); // 'aB3$xY7!mN9@pQ2#'
50
- */
51
- password(bytes: number): Promise<string>;
52
- private validateOptions;
53
- }
54
- export type { GenerateOptions, RandomResult, RNGFormat } from './types';
@@ -1,26 +0,0 @@
1
- /**
2
- * RNG Module Types
3
- */
4
- export type RNGFormat = 'hex' | 'base64' | 'base64url' | 'alphanumeric' | 'alphanumeric-mixed' | 'password' | 'numeric' | 'uuid' | 'bytes';
5
- export interface GenerateOptions {
6
- /** Number of bytes to generate (1-1024) */
7
- bytes: number;
8
- /** Output format (default: 'base64url') */
9
- format?: RNGFormat;
10
- }
11
- export interface RandomResult {
12
- /** Generated random value */
13
- value: string | number[];
14
- /** Number of bytes generated */
15
- bytes: number;
16
- /** Format used */
17
- format: RNGFormat;
18
- /** Reference ID for billing/audit */
19
- referenceId: string;
20
- }
21
- export interface GenerateResponse {
22
- random_bytes_b64: string;
23
- num_bytes: number;
24
- format: string;
25
- reference_id: string;
26
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Sparks Module
3
- *
4
- * Create and read ephemeral encrypted secrets.
5
- * Sparks are destroyed after being read (burn-on-read).
6
- */
7
- import { HttpClient } from '../http';
8
- import type { CreateSparkOptions, Spark, SparkPayload } from './types';
9
- export declare class SparksModule {
10
- private readonly http;
11
- constructor(http: HttpClient);
12
- /**
13
- * Create an ephemeral encrypted secret.
14
- *
15
- * @example
16
- * const spark = await sv.sparks.create({
17
- * payload: 'my secret data',
18
- * ttl: 3600,
19
- * maxReads: 1
20
- * });
21
- * console.log(spark.url);
22
- */
23
- create(options: CreateSparkOptions): Promise<Spark>;
24
- /**
25
- * Read and burn a spark.
26
- * The spark is destroyed after the configured number of reads.
27
- *
28
- * @example
29
- * const payload = await sv.sparks.read('spk_abc123');
30
- * console.log(payload.data);
31
- */
32
- read(id: string, password?: string): Promise<SparkPayload>;
33
- private validateCreateOptions;
34
- private encodePayload;
35
- private decodePayload;
36
- }
37
- export type { CreateSparkOptions, Spark, SparkPayload, } from './types';
@@ -1,56 +0,0 @@
1
- /**
2
- * Sparks Module Types
3
- */
4
- export interface CreateSparkOptions {
5
- /** Secret payload to encrypt */
6
- payload: string | Uint8Array;
7
- /** Time-to-live in seconds (default: 3600) */
8
- ttl?: number;
9
- /** Maximum number of reads before destruction (default: 1) */
10
- maxReads?: number;
11
- /** Optional password protection */
12
- password?: string;
13
- /** Optional name/label for the spark */
14
- name?: string;
15
- }
16
- export interface Spark {
17
- /** Spark ID */
18
- id: string;
19
- /** Direct URL to read the spark */
20
- url: string;
21
- /** Expiry timestamp (Unix seconds) */
22
- expiresAt: number;
23
- /** Maximum reads remaining */
24
- maxReads: number;
25
- /** Name/label if provided */
26
- name?: string;
27
- }
28
- export interface ReadSparkOptions {
29
- /** Spark ID */
30
- id: string;
31
- /** Password if the spark is password-protected */
32
- password?: string;
33
- }
34
- export interface SparkPayload {
35
- /** Decrypted data */
36
- data: string | Uint8Array;
37
- /** When the spark was read (Unix seconds) */
38
- readAt: number;
39
- /** Whether the spark was destroyed after reading */
40
- burned: boolean;
41
- /** Reads remaining (0 if burned) */
42
- readsRemaining: number;
43
- }
44
- export interface CreateSparkResponse {
45
- spark_id: string;
46
- url: string;
47
- expires_at: number;
48
- max_reads: number;
49
- name?: string;
50
- }
51
- export interface ReadSparkResponse {
52
- payload: string;
53
- read_at: number;
54
- burned: boolean;
55
- reads_remaining: number;
56
- }