@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.
Files changed (56) hide show
  1. package/dist/auto-init.d.ts +1 -1
  2. package/dist/entropy/index.d.ts +28 -0
  3. package/dist/entropy/types.d.ts +32 -0
  4. package/dist/folders/index.d.ts +77 -0
  5. package/dist/folders/types.d.ts +64 -0
  6. package/dist/http.d.ts +3 -1
  7. package/dist/index.d.ts +982 -78
  8. package/dist/ingots/index.d.ts +183 -0
  9. package/dist/ingots/types.d.ts +286 -0
  10. package/dist/{identity → products/identity}/api.d.ts +3 -3
  11. package/dist/{identity → products/identity}/embedder.d.ts +1 -1
  12. package/dist/{identity → products/identity}/index.d.ts +7 -7
  13. package/dist/{identity → products/identity}/utils.d.ts +1 -1
  14. package/dist/products/index.d.ts +18 -0
  15. package/dist/sparks/index.d.ts +65 -0
  16. package/dist/sparks/types.d.ts +174 -0
  17. package/dist/sparkvault.cjs.js +1077 -101
  18. package/dist/sparkvault.cjs.js.map +1 -1
  19. package/dist/sparkvault.esm.js +1071 -102
  20. package/dist/sparkvault.esm.js.map +1 -1
  21. package/dist/sparkvault.js +1 -1
  22. package/dist/sparkvault.js.map +1 -1
  23. package/dist/vaults/index.d.ts +102 -34
  24. package/dist/vaults/types.d.ts +121 -57
  25. package/dist/vaults/upload/api.d.ts +1 -1
  26. package/package.json +1 -1
  27. /package/dist/{identity → products/identity}/container.d.ts +0 -0
  28. /package/dist/{identity → products/identity}/handlers/index.d.ts +0 -0
  29. /package/dist/{identity → products/identity}/handlers/passkey-handler.d.ts +0 -0
  30. /package/dist/{identity → products/identity}/handlers/sparklink-handler.d.ts +0 -0
  31. /package/dist/{identity → products/identity}/handlers/totp-handler.d.ts +0 -0
  32. /package/dist/{identity → products/identity}/inline-container.d.ts +0 -0
  33. /package/dist/{identity → products/identity}/methods.d.ts +0 -0
  34. /package/dist/{identity → products/identity}/modal.d.ts +0 -0
  35. /package/dist/{identity → products/identity}/renderer.d.ts +0 -0
  36. /package/dist/{identity → products/identity}/state.d.ts +0 -0
  37. /package/dist/{identity → products/identity}/styles.d.ts +0 -0
  38. /package/dist/{identity → products/identity}/types.d.ts +0 -0
  39. /package/dist/{identity → products/identity}/utils/cooldown-timer.d.ts +0 -0
  40. /package/dist/{identity → products/identity}/utils/index.d.ts +0 -0
  41. /package/dist/{identity → products/identity}/views/backup-verify.d.ts +0 -0
  42. /package/dist/{identity → products/identity}/views/base.d.ts +0 -0
  43. /package/dist/{identity → products/identity}/views/error.d.ts +0 -0
  44. /package/dist/{identity → products/identity}/views/icons.d.ts +0 -0
  45. /package/dist/{identity → products/identity}/views/identity-input.d.ts +0 -0
  46. /package/dist/{identity → products/identity}/views/index.d.ts +0 -0
  47. /package/dist/{identity → products/identity}/views/loading.d.ts +0 -0
  48. /package/dist/{identity → products/identity}/views/method-select.d.ts +0 -0
  49. /package/dist/{identity → products/identity}/views/origin-not-allowed.d.ts +0 -0
  50. /package/dist/{identity → products/identity}/views/passkey-prompt.d.ts +0 -0
  51. /package/dist/{identity → products/identity}/views/passkey.d.ts +0 -0
  52. /package/dist/{identity → products/identity}/views/product-not-configured.d.ts +0 -0
  53. /package/dist/{identity → products/identity}/views/service-unavailable.d.ts +0 -0
  54. /package/dist/{identity → products/identity}/views/sparklink-waiting.d.ts +0 -0
  55. /package/dist/{identity → products/identity}/views/totp-verify.d.ts +0 -0
  56. /package/dist/{identity → products/identity}/views/two-factor.d.ts +0 -0
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Ingots Module
3
+ *
4
+ * Data-plane operations on the contents of an *unsealed* vault. Every method
5
+ * takes the {@link UnsealedVault} returned by `sv.vaults.unseal(...)` and
6
+ * authenticates with its short-lived Vault Access Token (VAT).
7
+ *
8
+ * Uploads and downloads run over the single canonical Forge TUS transfer path
9
+ * (shared with the public upload widget), with server-side finalization and
10
+ * download-host allowlisting enforced — no per-size branching.
11
+ */
12
+ import type { ResolvedConfig } from '../config';
13
+ import { HttpClient } from '../http';
14
+ import type { UnsealedVault, Ingot, IngotUpload, CreatedIngot, IngotDownloadLink, CreateUploadOptions, UploadIngotOptions, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvite, AddInviteOptions, IngotAccessLogPage, AccessLogsOptions } from './types';
15
+ export declare class IngotsModule {
16
+ private readonly config;
17
+ private readonly http;
18
+ /**
19
+ * Forge transfer client for authenticated ingot uploads. A dedicated
20
+ * instance: the widget's own client is session-scoped (reset/aborted with
21
+ * the widget lifecycle), and sharing it would let a widget close() abort an
22
+ * unrelated upload() transfer.
23
+ */
24
+ private readonly uploadApi;
25
+ constructor(config: ResolvedConfig, http: HttpClient);
26
+ /**
27
+ * Create an ingot upload session (discrete primitive).
28
+ *
29
+ * Reserves the ingot record and returns the Forge upload URL (carrying the
30
+ * ISTK upload session token). Use this when you want to drive the TUS
31
+ * transfer yourself; otherwise prefer {@link upload}.
32
+ *
33
+ * @example
34
+ * const session = await sv.ingots.createUpload({
35
+ * vault: unsealed, name: 'report.pdf',
36
+ * contentType: 'application/pdf', sizeBytes: file.size,
37
+ * });
38
+ * console.log(session.uploadUrl);
39
+ */
40
+ createUpload(options: CreateUploadOptions): Promise<IngotUpload>;
41
+ /**
42
+ * Upload a file as a new ingot (high-level flow).
43
+ *
44
+ * Creates the upload session, streams the file to Forge over TUS, then
45
+ * confirms the server finalized the upload before resolving.
46
+ *
47
+ * @example
48
+ * const ingot = await sv.ingots.upload(unsealed, {
49
+ * file: myFile, name: 'document.pdf'
50
+ * });
51
+ */
52
+ upload(vault: UnsealedVault, options: UploadIngotOptions): Promise<CreatedIngot>;
53
+ /**
54
+ * Replace an existing ingot's content (high-level flow).
55
+ *
56
+ * @example
57
+ * await sv.ingots.replace(unsealed, 'ing_abc', { file: updatedFile });
58
+ */
59
+ replace(vault: UnsealedVault, ingotId: string, options: ReplaceIngotOptions): Promise<CreatedIngot>;
60
+ /**
61
+ * Rename an ingot.
62
+ *
63
+ * @example
64
+ * await sv.ingots.rename(unsealed, 'ing_abc', 'new-name.pdf');
65
+ */
66
+ rename(vault: UnsealedVault, ingotId: string, name: string): Promise<Ingot>;
67
+ /**
68
+ * Move an ingot to a folder, or to the vault root with `null`.
69
+ *
70
+ * @example
71
+ * await sv.ingots.move(unsealed, 'ing_abc', 'fld_xyz');
72
+ * await sv.ingots.move(unsealed, 'ing_abc', null); // root
73
+ */
74
+ move(vault: UnsealedVault, ingotId: string, folderId: string | null): Promise<Ingot>;
75
+ /**
76
+ * Delete an ingot.
77
+ *
78
+ * @example
79
+ * await sv.ingots.delete(unsealed, 'ing_abc');
80
+ */
81
+ delete(vault: UnsealedVault, ingotId: string): Promise<void>;
82
+ /**
83
+ * Get ingot metadata.
84
+ *
85
+ * @example
86
+ * const ingot = await sv.ingots.get(unsealed, 'ing_abc');
87
+ */
88
+ get(vault: UnsealedVault, ingotId: string): Promise<Ingot>;
89
+ /**
90
+ * List ingots in an unsealed vault.
91
+ *
92
+ * @example
93
+ * const { ingots } = await sv.ingots.list(unsealed);
94
+ */
95
+ list(vault: UnsealedVault, options?: ListIngotsOptions): Promise<IngotPage>;
96
+ /**
97
+ * Search ingots in an unsealed vault.
98
+ *
99
+ * @example
100
+ * const { ingots } = await sv.ingots.search(unsealed, { q: 'invoice' });
101
+ */
102
+ search(vault: UnsealedVault, options?: SearchIngotsOptions): Promise<IngotPage>;
103
+ /**
104
+ * List the contents (ingots) of a folder, or the vault root.
105
+ *
106
+ * @example
107
+ * const { ingots } = await sv.ingots.listContents(unsealed, { folderId: 'fld_x' });
108
+ */
109
+ listContents(vault: UnsealedVault, options?: ListContentsOptions): Promise<IngotPage>;
110
+ /**
111
+ * Create a signed download link for an ingot (discrete primitive).
112
+ *
113
+ * Validates the returned URL against the download-host allowlist. Use this
114
+ * when you want the URL itself; otherwise prefer {@link download}.
115
+ *
116
+ * @example
117
+ * const link = await sv.ingots.createDownloadLink(unsealed, 'ing_abc');
118
+ * window.location.href = link.downloadUrl;
119
+ */
120
+ createDownloadLink(vault: UnsealedVault, ingotId: string): Promise<IngotDownloadLink>;
121
+ /**
122
+ * Download an ingot as a Blob (high-level flow).
123
+ *
124
+ * Requests a fresh signed link on every attempt (server URLs are
125
+ * short-lived) and retries transient transport failures with exponential
126
+ * backoff. Validation failures (bad host, non-HTTPS) are never retried.
127
+ *
128
+ * @example
129
+ * const blob = await sv.ingots.download(unsealed, 'ing_abc');
130
+ * const url = URL.createObjectURL(blob);
131
+ */
132
+ download(vault: UnsealedVault, ingotId: string): Promise<Blob>;
133
+ /**
134
+ * Get an ingot's sharing configuration.
135
+ *
136
+ * @example
137
+ * const sharing = await sv.ingots.getSharingConfig(unsealed, 'ing_abc');
138
+ */
139
+ getSharingConfig(vault: UnsealedVault, ingotId: string): Promise<IngotSharingConfig>;
140
+ /**
141
+ * Update an ingot's sharing configuration.
142
+ *
143
+ * @example
144
+ * await sv.ingots.updateSharingConfig(unsealed, 'ing_abc', { shared: true });
145
+ */
146
+ updateSharingConfig(vault: UnsealedVault, ingotId: string, config: UpdateIngotSharingOptions): Promise<IngotSharingConfig>;
147
+ /**
148
+ * Invite an identity to a shared ingot. The identity type (email or phone)
149
+ * is inferred server-side from the identity value.
150
+ *
151
+ * @example
152
+ * await sv.ingots.addInvite(unsealed, 'ing_abc', 'user@example.com');
153
+ * await sv.ingots.addInvite(unsealed, 'ing_abc', 'user@example.com', { expiresInSeconds: 86400 });
154
+ */
155
+ addInvite(vault: UnsealedVault, ingotId: string, identity: string, options?: AddInviteOptions): Promise<IngotInvite>;
156
+ /**
157
+ * Revoke an ingot sharing invite.
158
+ *
159
+ * @example
160
+ * await sv.ingots.revokeInvite(unsealed, 'ing_abc', 'inv_123');
161
+ */
162
+ revokeInvite(vault: UnsealedVault, ingotId: string, inviteId: string): Promise<void>;
163
+ /**
164
+ * Get an ingot's access logs.
165
+ *
166
+ * @example
167
+ * const { logs } = await sv.ingots.getAccessLogs(unsealed, 'ing_abc');
168
+ */
169
+ getAccessLogs(vault: UnsealedVault, ingotId: string, options?: AccessLogsOptions): Promise<IngotAccessLogPage>;
170
+ /**
171
+ * Request a Forge upload session for a new ingot.
172
+ * Shared by createUpload and upload — the single ingot-create path.
173
+ */
174
+ private requestUploadSession;
175
+ /**
176
+ * Run the canonical TUS transfer for a created/replaced ingot, then confirm
177
+ * the server finalized the upload before reporting success.
178
+ */
179
+ private transferAndFinalize;
180
+ private validateFile;
181
+ private validateDownloadUrl;
182
+ }
183
+ export type { UnsealedVault, Ingot, IngotUpload, CreatedIngot, IngotDownloadLink, CreateUploadOptions, UploadIngotOptions, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvite, AddInviteOptions, IngotAccessLog, IngotAccessLogPage, AccessLogsOptions, } from './types';
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Ingots Module Types
3
+ *
4
+ * Ingot operations run against an unsealed vault: every call carries the
5
+ * vault's short-lived Vault Access Token (VAT) via the `X-Vault-Access-Token`
6
+ * header. Public domain objects are camelCase; wire shapes (snake_case) stay
7
+ * private to the module.
8
+ */
9
+ import type { UnsealedVault } from '../vaults/types';
10
+ export type { UnsealedVault };
11
+ /** Ingot metadata as returned by list/get/contents. */
12
+ export interface Ingot {
13
+ /** Ingot ID */
14
+ id: string;
15
+ /** Ingot name */
16
+ name: string;
17
+ /** Content type (MIME) */
18
+ contentType: string;
19
+ /** Size in bytes */
20
+ size: number;
21
+ /** Lifecycle status (uploading | active | failed) */
22
+ status: string;
23
+ /** Creation timestamp (Unix seconds) */
24
+ createdAt: number;
25
+ /** Containing folder ID, or null at the vault root */
26
+ folderId: string | null;
27
+ }
28
+ /** The discrete primitive returned by createUpload — a Forge TUS session. */
29
+ export interface IngotUpload {
30
+ /** Ingot ID */
31
+ id: string;
32
+ /** Ingot name */
33
+ name: string;
34
+ /** Content type (MIME) */
35
+ contentType: string;
36
+ /** Size in bytes */
37
+ size: number;
38
+ /** Forge upload URL carrying the ISTK (upload session token) */
39
+ uploadUrl: string;
40
+ /** Upload session expiry (Unix seconds) */
41
+ expiresAt: number;
42
+ }
43
+ /** A finalized ingot, returned by the high-level upload/replace flows. */
44
+ export interface CreatedIngot {
45
+ /** Ingot ID */
46
+ id: string;
47
+ /** Ingot name */
48
+ name: string;
49
+ /** Content type (MIME) */
50
+ contentType: string;
51
+ /** Size in bytes */
52
+ size: number;
53
+ }
54
+ /** The discrete primitive returned by createDownloadLink. */
55
+ export interface IngotDownloadLink {
56
+ /** Short-lived signed Forge download URL */
57
+ downloadUrl: string;
58
+ /** Ingot ID */
59
+ id: string;
60
+ /** Ingot name */
61
+ name: string;
62
+ /** Size in bytes */
63
+ size: number;
64
+ /** Content type (MIME) */
65
+ contentType: string;
66
+ }
67
+ /** Options for the createUpload primitive. */
68
+ export interface CreateUploadOptions {
69
+ /** Unsealed vault the ingot belongs to */
70
+ vault: UnsealedVault;
71
+ /** Ingot name */
72
+ name: string;
73
+ /** Content type (MIME) */
74
+ contentType: string;
75
+ /** Declared upload size in bytes */
76
+ sizeBytes: number;
77
+ /** Slash-delimited folder path (find-or-created from root). */
78
+ folder?: string;
79
+ /** Existing folder ID to upload into. Mutually exclusive with `folder`. */
80
+ folderId?: string;
81
+ }
82
+ /** Options for the high-level upload flow. */
83
+ export interface UploadIngotOptions {
84
+ /** File or Blob to upload */
85
+ file: File | Blob;
86
+ /** Optional name (defaults to file name) */
87
+ name?: string;
88
+ /** Content type (auto-detected from the file if not provided) */
89
+ contentType?: string;
90
+ /** Slash-delimited folder path (find-or-created from root). */
91
+ folder?: string;
92
+ /** Existing folder ID to upload into. Mutually exclusive with `folder`. */
93
+ folderId?: string;
94
+ /** Progress callback for the Forge/TUS transfer */
95
+ onProgress?: (bytesUploaded: number, bytesTotal: number) => void;
96
+ }
97
+ /** Options for replacing an existing ingot's content. */
98
+ export interface ReplaceIngotOptions {
99
+ /** File or Blob to upload as the new content */
100
+ file: File | Blob;
101
+ /** Optional new name (defaults to file name) */
102
+ name?: string;
103
+ /** Content type (auto-detected from the file if not provided) */
104
+ contentType?: string;
105
+ /** Progress callback for the Forge/TUS transfer */
106
+ onProgress?: (bytesUploaded: number, bytesTotal: number) => void;
107
+ }
108
+ /** Options for list. */
109
+ export interface ListIngotsOptions {
110
+ /** Page size */
111
+ limit?: number;
112
+ /** Pagination cursor */
113
+ cursor?: string;
114
+ /** Sort field (name | size | content_type | created | access_count) */
115
+ sortBy?: string;
116
+ /** Sort direction */
117
+ sortOrder?: 'asc' | 'desc';
118
+ }
119
+ /** Options for listContents. */
120
+ export interface ListContentsOptions {
121
+ /** Folder to list (null/omitted lists the vault root) */
122
+ folderId?: string | null;
123
+ /** Page size */
124
+ limit?: number;
125
+ /** Pagination cursor */
126
+ cursor?: string;
127
+ /** Sort field */
128
+ sortBy?: string;
129
+ /** Sort direction */
130
+ sortOrder?: 'asc' | 'desc';
131
+ /** Filter by item type */
132
+ type?: string;
133
+ }
134
+ /** Options for search. */
135
+ export interface SearchIngotsOptions {
136
+ /** Free-text query */
137
+ q?: string;
138
+ /** File type filter */
139
+ fileType?: string;
140
+ /** Minimum size in bytes */
141
+ minSize?: number;
142
+ /** Maximum size in bytes */
143
+ maxSize?: number;
144
+ /** Page size */
145
+ limit?: number;
146
+ /** Pagination cursor */
147
+ cursor?: string;
148
+ /** Sort direction */
149
+ sortOrder?: 'asc' | 'desc';
150
+ }
151
+ /** A page of ingots. */
152
+ export interface IngotPage {
153
+ /** Ingots on this page */
154
+ ingots: Ingot[];
155
+ /** Cursor for the next page, when more results exist */
156
+ nextCursor?: string;
157
+ }
158
+ /** Ingot sharing configuration. */
159
+ export interface IngotSharingConfig {
160
+ /** Whether the ingot is shared */
161
+ shared: boolean;
162
+ /** Visibility mode */
163
+ visibility?: 'invite_only' | 'authenticated' | 'public';
164
+ /** Active invites */
165
+ invites?: IngotInvite[];
166
+ }
167
+ /** Options for updateSharingConfig. */
168
+ export interface UpdateIngotSharingOptions {
169
+ /** Whether the ingot is shared */
170
+ shared?: boolean;
171
+ /** Visibility mode */
172
+ visibility?: 'invite_only' | 'authenticated' | 'public';
173
+ }
174
+ /** Options for addInvite. */
175
+ export interface AddInviteOptions {
176
+ /** Invite lifetime in seconds. Omit to inherit the link's existing expiry. */
177
+ expiresInSeconds?: number;
178
+ }
179
+ /** A sharing invite on an ingot. */
180
+ export interface IngotInvite {
181
+ /** Invite ID */
182
+ id: string;
183
+ /** Invited identity (email/phone) */
184
+ identity: string;
185
+ /** Identity type */
186
+ identityType: string;
187
+ }
188
+ /** An ingot access-log entry. */
189
+ export interface IngotAccessLog {
190
+ /** Log entry ID */
191
+ id: string;
192
+ /** Action performed (download | view) */
193
+ action: string;
194
+ /** Acting identity */
195
+ identity: string;
196
+ /** Source IP address */
197
+ ipAddress: string;
198
+ /** Client user agent */
199
+ userAgent: string;
200
+ /** Event timestamp (Unix seconds) */
201
+ timestamp: number;
202
+ }
203
+ /** A page of access logs. */
204
+ export interface IngotAccessLogPage {
205
+ /** Log entries on this page */
206
+ logs: IngotAccessLog[];
207
+ /** Cursor for the next page, when more results exist */
208
+ nextCursor?: string;
209
+ }
210
+ /** Options for getAccessLogs. */
211
+ export interface AccessLogsOptions {
212
+ /** Page size */
213
+ limit?: number;
214
+ /** Pagination cursor */
215
+ cursor?: string;
216
+ }
217
+ export interface IngotWire {
218
+ ingot_id: string;
219
+ name: string;
220
+ content_type: string;
221
+ size_bytes: number;
222
+ status?: string;
223
+ created_at?: number;
224
+ folder_id?: string | null;
225
+ }
226
+ export interface CreateIngotResponse {
227
+ ingot_id: string;
228
+ name: string;
229
+ content_type: string;
230
+ size_bytes: number;
231
+ status: 'uploading';
232
+ forge_url: string;
233
+ expires_at: number;
234
+ }
235
+ export interface ListIngotsResponse {
236
+ ingots: IngotWire[];
237
+ count?: number;
238
+ next_cursor?: string;
239
+ }
240
+ export interface DownloadIngotResponse {
241
+ download_url: string;
242
+ ingot_id: string;
243
+ name: string;
244
+ size_bytes: number;
245
+ content_type: string;
246
+ }
247
+ export interface IngotSharingConfigResponse {
248
+ shared: boolean;
249
+ visibility?: 'invite_only' | 'authenticated' | 'public';
250
+ invites?: {
251
+ id?: string;
252
+ invite_id?: string;
253
+ identity: string;
254
+ identity_type?: string;
255
+ }[];
256
+ }
257
+ export interface IngotInviteResponse {
258
+ id?: string;
259
+ invite_id?: string;
260
+ identity: string;
261
+ identity_type?: string;
262
+ }
263
+ export interface IngotAuditLogEntry {
264
+ id?: string;
265
+ log_id?: string;
266
+ event_id?: string;
267
+ event_type?: string;
268
+ action?: string;
269
+ actor?: {
270
+ email?: string;
271
+ id?: string;
272
+ user_id?: string;
273
+ api_key_id?: string;
274
+ };
275
+ actor_email?: string;
276
+ actor_id?: string;
277
+ identity?: string;
278
+ ip_address?: string;
279
+ user_agent?: string;
280
+ timestamp?: number;
281
+ created_at?: number;
282
+ }
283
+ export interface IngotAuditLogsResponse {
284
+ entries?: IngotAuditLogEntry[];
285
+ next_cursor?: string;
286
+ }
@@ -4,9 +4,9 @@
4
4
  * Handles all HTTP communication with the Identity Product endpoints.
5
5
  * Single responsibility: API calls only.
6
6
  */
7
- import type { ResolvedConfig } from '../config';
8
- import { SparkVaultApi } from '../api-base';
9
- import { SparkVaultError } from '../errors';
7
+ import type { ResolvedConfig } from '../../config';
8
+ import { SparkVaultApi } from '../../api-base';
9
+ import { SparkVaultError } from '../../errors';
10
10
  import type { SdkConfig, TotpSendResponse, TotpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SecondFactorVerifyResponse, SparkLinkSendResponse, BackupSendResponse, BackupVerifyResponse, Recommendation, RecommendationKey, AuthContext, VerifyResult } from './types';
11
11
  export declare class IdentityApi extends SparkVaultApi {
12
12
  private readonly config;
@@ -13,7 +13,7 @@
13
13
  * iframe, so the page sees only a transparent full-viewport frame: no border,
14
14
  * no seam, visually identical to the in-page modal.
15
15
  */
16
- import type { ResolvedConfig } from '../config';
16
+ import type { ResolvedConfig } from '../../config';
17
17
  import type { VerifyOptions, VerifyResult } from './types';
18
18
  interface EmbedderCallbacks {
19
19
  onSuccess: (result: VerifyResult) => void;
@@ -5,15 +5,15 @@
5
5
  * Supports passkey, TOTP, SparkLink, and social authentication.
6
6
  *
7
7
  * @example Dialog mode (immediate)
8
- * const result = await sv.identity.verify();
8
+ * const result = await sv.products.identity.verify();
9
9
  *
10
10
  * @example Dialog mode (attached to clicks)
11
- * sv.identity.attach('.login-btn');
11
+ * sv.products.identity.attach('.login-btn');
12
12
  *
13
13
  * @example Inline mode
14
- * const result = await sv.identity.verify({ target: '#auth-container' });
14
+ * const result = await sv.products.identity.verify({ target: '#auth-container' });
15
15
  */
16
- import type { ResolvedConfig } from '../config';
16
+ import type { ResolvedConfig } from '../../config';
17
17
  import type { VerifyOptions, VerifyResult, TokenClaims, AttachOptions } from './types';
18
18
  export declare class IdentityModule {
19
19
  private readonly config;
@@ -28,11 +28,11 @@ export declare class IdentityModule {
28
28
  * - With `target`: Renders inline into the specified element
29
29
  *
30
30
  * @example Dialog mode
31
- * const result = await sv.identity.verify();
31
+ * const result = await sv.products.identity.verify();
32
32
  * console.log(result.token, result.identity);
33
33
  *
34
34
  * @example Inline mode
35
- * const result = await sv.identity.verify({
35
+ * const result = await sv.products.identity.verify({
36
36
  * target: '#auth-container',
37
37
  * email: 'user@example.com'
38
38
  * });
@@ -47,7 +47,7 @@ export declare class IdentityModule {
47
47
  * @returns Cleanup function to remove event listeners
48
48
  *
49
49
  * @example
50
- * const cleanup = sv.identity.attach('.login-btn', {
50
+ * const cleanup = sv.products.identity.attach('.login-btn', {
51
51
  * onSuccess: (result) => console.log('Verified:', result.identity)
52
52
  * });
53
53
  *
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export { CooldownTimer, ExpirationTimer } from './utils/cooldown-timer';
8
8
  export type { CooldownTimerConfig, ExpirationTimerConfig } from './utils/cooldown-timer';
9
- export { arrayBufferToBase64url, base64urlToArrayBuffer, base64urlToString, } from '../utils/base64url';
9
+ export { arrayBufferToBase64url, base64urlToArrayBuffer, base64urlToString, } from '../../utils/base64url';
10
10
  /**
11
11
  * Extract the root (registrable) domain from a hostname for cross-subdomain cookies.
12
12
  * Returns the domain prefixed with a dot (e.g., ".client.com") or null when
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Products Module
3
+ *
4
+ * Namespace for SparkVault first-party products. Each product is a
5
+ * self-contained surface (UI + API) the account can enable independently.
6
+ * Currently exposes `identity`; future products attach here alongside it.
7
+ */
8
+ import type { ResolvedConfig } from '../config';
9
+ import { IdentityModule } from './identity';
10
+ export declare class ProductsModule {
11
+ /** Identity verification product (passkey, TOTP, SparkLink, social). */
12
+ readonly identity: IdentityModule;
13
+ constructor(config: ResolvedConfig);
14
+ }
15
+ export { IdentityModule } from './identity';
16
+ export type { VerifyOptions, AttachOptions, VerifyResult, TokenClaims, AuthMethod, AuthContext, Theme, SdkConfig, SdkConfigBranding, MethodId, MethodMetadata, } from './identity';
17
+ export { METHOD_REGISTRY, getMethodMetadata, enrichMethods } from './identity';
18
+ export { IdentityApi, IdentityApiError } from './identity';
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Sparks Module
3
+ *
4
+ * Create, read, share, and delete end-to-end encrypted, read-once ephemeral
5
+ * secrets. Sparks are account-scoped — no vault or VAT is involved.
6
+ */
7
+ import { HttpClient } from '../http';
8
+ import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare } from './types';
9
+ export declare class SparksModule {
10
+ private readonly http;
11
+ constructor(http: HttpClient);
12
+ /**
13
+ * List sparks for the account.
14
+ *
15
+ * @example
16
+ * const { sparks } = await sv.sparks.list();
17
+ */
18
+ list(options?: ListSparksOptions): Promise<SparkPage>;
19
+ /**
20
+ * Read (and burn) a spark. Reading is destructive — the spark can be read
21
+ * exactly once.
22
+ *
23
+ * @example
24
+ * const spark = await sv.sparks.get('spk_abc');
25
+ * console.log(spark.payload);
26
+ */
27
+ get(sparkId: string): Promise<Spark>;
28
+ /**
29
+ * Create a spark.
30
+ *
31
+ * @example
32
+ * const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
33
+ */
34
+ create(options: CreateSparkOptions): Promise<CreatedSpark>;
35
+ /**
36
+ * Delete a spark.
37
+ *
38
+ * @example
39
+ * await sv.sparks.delete('spk_abc');
40
+ */
41
+ delete(sparkId: string): Promise<void>;
42
+ /**
43
+ * Share a spark via a public SparkLink (x.sv URL).
44
+ *
45
+ * @example
46
+ * const share = await sv.sparks.share('spk_abc', { visibility: 'public' });
47
+ * console.log(share.shareUrl);
48
+ */
49
+ share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
50
+ /**
51
+ * Get a spark's sharing status.
52
+ *
53
+ * @example
54
+ * const share = await sv.sparks.getShare('spk_abc');
55
+ */
56
+ getShare(sparkId: string): Promise<SparkShare>;
57
+ /**
58
+ * Unshare a spark (delete its SparkLink).
59
+ *
60
+ * @example
61
+ * await sv.sparks.unshare('spk_abc');
62
+ */
63
+ unshare(sparkId: string): Promise<SparkShare>;
64
+ }
65
+ export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkVisibility, } from './types';