@sparkvault/sdk-js 2.2.4 → 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 +994 -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 +40 -4
  11. package/dist/{identity → products/identity}/embedder.d.ts +1 -1
  12. package/dist/{identity → products/identity}/handlers/totp-handler.d.ts +1 -1
  13. package/dist/{identity → products/identity}/index.d.ts +7 -7
  14. package/dist/{identity → products/identity}/renderer.d.ts +49 -3
  15. package/dist/{identity → products/identity}/state.d.ts +0 -17
  16. package/dist/{identity → products/identity}/types.d.ts +53 -0
  17. package/dist/{identity → products/identity}/utils.d.ts +1 -1
  18. package/dist/products/identity/views/backup-verify.d.ts +41 -0
  19. package/dist/{identity → products/identity}/views/index.d.ts +1 -0
  20. package/dist/products/index.d.ts +18 -0
  21. package/dist/sparks/index.d.ts +65 -0
  22. package/dist/sparks/types.d.ts +174 -0
  23. package/dist/sparkvault.cjs.js +1573 -366
  24. package/dist/sparkvault.cjs.js.map +1 -1
  25. package/dist/sparkvault.esm.js +1567 -367
  26. package/dist/sparkvault.esm.js.map +1 -1
  27. package/dist/sparkvault.js +1 -1
  28. package/dist/sparkvault.js.map +1 -1
  29. package/dist/vaults/index.d.ts +102 -34
  30. package/dist/vaults/types.d.ts +121 -57
  31. package/dist/vaults/upload/api.d.ts +1 -1
  32. package/package.json +1 -1
  33. /package/dist/{identity → products/identity}/container.d.ts +0 -0
  34. /package/dist/{identity → products/identity}/handlers/index.d.ts +0 -0
  35. /package/dist/{identity → products/identity}/handlers/passkey-handler.d.ts +0 -0
  36. /package/dist/{identity → products/identity}/handlers/sparklink-handler.d.ts +0 -0
  37. /package/dist/{identity → products/identity}/inline-container.d.ts +0 -0
  38. /package/dist/{identity → products/identity}/methods.d.ts +0 -0
  39. /package/dist/{identity → products/identity}/modal.d.ts +0 -0
  40. /package/dist/{identity → products/identity}/styles.d.ts +0 -0
  41. /package/dist/{identity → products/identity}/utils/cooldown-timer.d.ts +0 -0
  42. /package/dist/{identity → products/identity}/utils/index.d.ts +0 -0
  43. /package/dist/{identity → products/identity}/views/base.d.ts +0 -0
  44. /package/dist/{identity → products/identity}/views/error.d.ts +0 -0
  45. /package/dist/{identity → products/identity}/views/icons.d.ts +0 -0
  46. /package/dist/{identity → products/identity}/views/identity-input.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,10 +4,10 @@
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';
10
- import type { SdkConfig, TotpSendResponse, TotpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SecondFactorVerifyResponse, SparkLinkSendResponse, AuthContext, VerifyResult } from './types';
7
+ import type { ResolvedConfig } from '../../config';
8
+ import { SparkVaultApi } from '../../api-base';
9
+ import { SparkVaultError } from '../../errors';
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
13
  /** Cached config promise - allows preloading and deduplication */
@@ -104,6 +104,36 @@ export declare class IdentityApi extends SparkVaultApi {
104
104
  credential: PublicKeyCredential;
105
105
  authContext?: AuthContext;
106
106
  }): Promise<PasskeyVerifyResponse>;
107
+ /**
108
+ * Send a one-time code to a new backup identifier (the inverse of the
109
+ * identifier just logged in with). Authorized by the login's verification
110
+ * token. Returns a pending-attach `session_id`, or `already_verified` when
111
+ * the identifier is already on the identity.
112
+ */
113
+ sendBackupVerification(params: {
114
+ verificationToken: string;
115
+ type: 'email' | 'phone';
116
+ value: string;
117
+ method?: 'email' | 'sms' | 'voice';
118
+ }): Promise<BackupSendResponse>;
119
+ /**
120
+ * Confirm the backup-identifier code and attach it to the identity. A 409
121
+ * `backup_conflict` (identifier owned by another identity) surfaces as a
122
+ * thrown IdentityApiError with code `backup_conflict`.
123
+ */
124
+ verifyBackupVerification(params: {
125
+ sessionId: string;
126
+ code: string;
127
+ }): Promise<BackupVerifyResponse>;
128
+ /**
129
+ * Skip a post-login recommendation, suppressing it server-side for 30 days.
130
+ * Authorized by the login's verification token. Best-effort — a failure here
131
+ * must not block completing the login.
132
+ */
133
+ dismissRecommendation(params: {
134
+ verificationToken: string;
135
+ key: RecommendationKey;
136
+ }): Promise<void>;
107
137
  /**
108
138
  * Get OAuth redirect URL for social provider
109
139
  */
@@ -122,6 +152,12 @@ export declare class IdentityApi extends SparkVaultApi {
122
152
  */
123
153
  consumeSparkLinkResult(kindling: string): Promise<VerifyResult | null>;
124
154
  }
155
+ /**
156
+ * Map the API's snake_case recommendation list to the SDK's typed shape,
157
+ * dropping any entries the SDK does not understand. Returns undefined when
158
+ * absent so callers treat it as "no nudges".
159
+ */
160
+ export declare function mapRecommendations(raw: unknown): Recommendation[] | undefined;
125
161
  export declare class IdentityApiError extends SparkVaultError {
126
162
  constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown>);
127
163
  }
@@ -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;
@@ -4,7 +4,7 @@
4
4
  * Single responsibility: TOTP code sending and verification.
5
5
  * Extracts TOTP logic from IdentityRenderer for better separation of concerns.
6
6
  */
7
- import type { IdentityApi } from '../api';
7
+ import { type IdentityApi } from '../api';
8
8
  import type { VerifyResult } from '../types';
9
9
  import type { VerificationState } from '../state';
10
10
  /**
@@ -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
  *
@@ -23,6 +23,8 @@ export declare class IdentityRenderer {
23
23
  private readonly sparkLinkHandler;
24
24
  private currentView;
25
25
  private focusTimeoutId;
26
+ private postLoginResult;
27
+ private postLoginQueue;
26
28
  private sparkLinkWs;
27
29
  private sparkLinkKindling;
28
30
  private sparkLinkVisibilityHandler;
@@ -135,16 +137,60 @@ export declare class IdentityRenderer {
135
137
  */
136
138
  private handleErrorWithRecovery;
137
139
  /**
138
- * Check if we should show the passkey registration prompt after PIN verification.
140
+ * Run the post-login step pipeline for a completed primary login.
141
+ *
142
+ * The server returns an ordered `recommendations` list (passkey upsell,
143
+ * backup verification, …); this walks it, rendering the step views the SDK
144
+ * supports and finalizing when the queue drains. A redirect target skips the
145
+ * pipeline. A future nudge is one new recommendation type + view case — no
146
+ * primary-login handler changes.
147
+ */
148
+ private runPostLogin;
149
+ /**
150
+ * Show the next supported recommendation, or finalize when the queue is
151
+ * empty. The single hand-off from each step back into the pipeline.
152
+ */
153
+ private advancePostLogin;
154
+ /**
155
+ * Best-effort: tell the server the person skipped a recommendation so it is
156
+ * suppressed for 30 days. Never blocks completing the login.
157
+ */
158
+ private dismissRecommendation;
159
+ /**
160
+ * Complete the login: hand the result to the host before tearing down the
161
+ * modal (so its onSuccess can act while the browsing context is alive), then
162
+ * navigate any redirect the flow returned.
163
+ */
164
+ private finalizeLogin;
165
+ /**
166
+ * Send a code to the new backup identifier the person entered. Already-attached
167
+ * identifiers short-circuit straight to completion; otherwise advance to code
168
+ * entry.
169
+ */
170
+ private handleBackupSubmit;
171
+ /**
172
+ * Verify the backup code and attach the identifier, then finish the original
173
+ * login. An identifier owned by another account (409 backup_conflict) bounces
174
+ * back to the input so the person can try a different one.
175
+ */
176
+ private handleBackupCodeSubmit;
177
+ /**
178
+ * Resend the backup code, refreshing the pending-attach session.
179
+ */
180
+ private handleBackupResend;
181
+ /**
182
+ * "Not now" on the backup prompt: suppress this identifier type for 30 days
183
+ * (server-side) and advance to the next step.
139
184
  */
140
- private shouldShowPasskeyPrompt;
185
+ private handleBackupSkip;
141
186
  /**
142
187
  * Handle user clicking "Add Passkey" in the prompt.
143
188
  * Directly triggers browser passkey creation without intermediate screen.
144
189
  */
145
190
  private handlePasskeyPromptAdd;
146
191
  /**
147
- * Handle user clicking "Not now" / "Skip" in the prompt.
192
+ * Handle user clicking "Not now" / "Skip" in the passkey prompt: suppress it
193
+ * for 30 days (server-side) and advance to the next step.
148
194
  */
149
195
  private handlePasskeyPromptSkip;
150
196
  /**