@sparkvault/sdk-js 19.0.0 → 19.1.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/README.md +26 -4
- package/dist/npm/chunks/index-BnP-2w0t.cjs +13025 -0
- package/dist/npm/chunks/index-BnP-2w0t.cjs.map +1 -0
- package/dist/npm/chunks/index-CgR08uMG.mjs +12960 -0
- package/dist/npm/chunks/index-CgR08uMG.mjs.map +1 -0
- package/dist/npm/identity.cjs +23 -0
- package/dist/npm/identity.cjs.map +1 -0
- package/dist/npm/identity.mjs +12 -0
- package/dist/npm/identity.mjs.map +1 -0
- package/dist/{index.cjs → npm/index.cjs} +799 -13755
- package/dist/npm/index.cjs.map +1 -0
- package/dist/{index.mjs → npm/index.mjs} +200 -13155
- package/dist/npm/index.mjs.map +1 -0
- package/dist/sparkvault-identity.js +2 -0
- package/dist/sparkvault-identity.js.map +1 -0
- package/dist/sparkvault.js +1 -1
- package/dist/types/identity.d.ts +8 -0
- package/dist/{index.d.ts → types/index.d.ts} +4 -790
- package/dist/types/shared/errors-C-gjmGBs.d.ts +800 -0
- package/package.json +20 -9
- package/dist/api-base.d.ts +0 -116
- package/dist/auto-init.d.ts +0 -32
- package/dist/config.d.ts +0 -79
- package/dist/entropy/index.d.ts +0 -35
- package/dist/entropy/types.d.ts +0 -32
- package/dist/errors.d.ts +0 -146
- package/dist/folders/index.d.ts +0 -102
- package/dist/folders/types.d.ts +0 -91
- package/dist/health.d.ts +0 -18
- package/dist/http.d.ts +0 -46
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/ingots/fetch-download.d.ts +0 -78
- package/dist/ingots/history.d.ts +0 -4
- package/dist/ingots/index.d.ts +0 -388
- package/dist/ingots/revision.d.ts +0 -4
- package/dist/ingots/types.d.ts +0 -556
- package/dist/logger.d.ts +0 -32
- package/dist/notify/index.d.ts +0 -154
- package/dist/notify/types.d.ts +0 -232
- package/dist/products/help-desk/client.d.ts +0 -198
- package/dist/products/help-desk/desk-id.d.ts +0 -2
- package/dist/products/help-desk/form-draft.d.ts +0 -37
- package/dist/products/help-desk/form-types.d.ts +0 -123
- package/dist/products/help-desk/form.d.ts +0 -83
- package/dist/products/help-desk/index.d.ts +0 -47
- package/dist/products/help-desk/kb-client.d.ts +0 -48
- package/dist/products/help-desk/kb-types.d.ts +0 -59
- package/dist/products/help-desk/modal.d.ts +0 -8
- package/dist/products/help-desk/styles.d.ts +0 -9
- package/dist/products/help-desk/support-analytics-types.d.ts +0 -32
- package/dist/products/help-desk/support-analytics.d.ts +0 -3
- package/dist/products/help-desk/support-brand.d.ts +0 -49
- package/dist/products/help-desk/support-controller.d.ts +0 -4
- package/dist/products/help-desk/support-history.d.ts +0 -38
- package/dist/products/help-desk/support-launcher.d.ts +0 -12
- package/dist/products/help-desk/support-styles.d.ts +0 -14
- package/dist/products/help-desk/support-types.d.ts +0 -66
- package/dist/products/help-desk/support-view.d.ts +0 -173
- package/dist/products/help-desk/types.d.ts +0 -285
- package/dist/products/help-desk/widget-identity.d.ts +0 -32
- package/dist/products/identity/api.d.ts +0 -237
- package/dist/products/identity/container.d.ts +0 -44
- package/dist/products/identity/dialog-launcher.d.ts +0 -133
- package/dist/products/identity/federation-flow.d.ts +0 -31
- package/dist/products/identity/handlers/otp-handler.d.ts +0 -69
- package/dist/products/identity/handlers/passkey-handler.d.ts +0 -105
- package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -34
- package/dist/products/identity/index.d.ts +0 -296
- package/dist/products/identity/inline-container.d.ts +0 -53
- package/dist/products/identity/methods.d.ts +0 -19
- package/dist/products/identity/modal.d.ts +0 -51
- package/dist/products/identity/pending-signin.d.ts +0 -102
- package/dist/products/identity/popup-launcher.d.ts +0 -73
- package/dist/products/identity/renderer.d.ts +0 -525
- package/dist/products/identity/state.d.ts +0 -84
- package/dist/products/identity/styles.d.ts +0 -31
- package/dist/products/identity/types.d.ts +0 -561
- package/dist/products/identity/utils/cooldown-timer.d.ts +0 -73
- package/dist/products/identity/utils.d.ts +0 -85
- package/dist/products/identity/views/backup-verify.d.ts +0 -42
- package/dist/products/identity/views/base.d.ts +0 -51
- package/dist/products/identity/views/error.d.ts +0 -65
- package/dist/products/identity/views/icons.d.ts +0 -41
- package/dist/products/identity/views/identity-input.d.ts +0 -80
- package/dist/products/identity/views/index.d.ts +0 -20
- package/dist/products/identity/views/loading.d.ts +0 -23
- package/dist/products/identity/views/method-button.d.ts +0 -14
- package/dist/products/identity/views/method-select.d.ts +0 -42
- package/dist/products/identity/views/origin-not-allowed.d.ts +0 -25
- package/dist/products/identity/views/otp-verify.d.ts +0 -58
- package/dist/products/identity/views/passkey-auto.d.ts +0 -22
- package/dist/products/identity/views/passkey-prompt.d.ts +0 -25
- package/dist/products/identity/views/passkey.d.ts +0 -38
- package/dist/products/identity/views/product-not-configured.d.ts +0 -21
- package/dist/products/identity/views/service-unavailable.d.ts +0 -21
- package/dist/products/identity/views/sms-consent.d.ts +0 -16
- package/dist/products/identity/views/sparklink-waiting.d.ts +0 -40
- package/dist/products/identity/views/two-factor.d.ts +0 -37
- package/dist/products/index.d.ts +0 -51
- package/dist/products/messaging/index.d.ts +0 -38
- package/dist/products/messaging/types.d.ts +0 -162
- package/dist/products/notify/index.d.ts +0 -436
- package/dist/products/notify/project-types.d.ts +0 -44
- package/dist/products/notify/projects.d.ts +0 -15
- package/dist/products/notify/types.d.ts +0 -1327
- package/dist/products/structured-ingots/index.d.ts +0 -31
- package/dist/products/structured-ingots/types-client.d.ts +0 -19
- package/dist/products/structured-ingots/types.d.ts +0 -293
- package/dist/products/structured-ingots/validation.d.ts +0 -25
- package/dist/request-path.d.ts +0 -44
- package/dist/sparks/index.d.ts +0 -91
- package/dist/sparks/types.d.ts +0 -304
- package/dist/ui/chrome.d.ts +0 -16
- package/dist/ui/ds-tokens.d.ts +0 -59
- package/dist/ui/inline-shell.d.ts +0 -19
- package/dist/ui/live-region.d.ts +0 -15
- package/dist/ui/modal-shell.d.ts +0 -67
- package/dist/ui/target.d.ts +0 -6
- package/dist/utils/dom.d.ts +0 -26
- package/dist/vault-session.d.ts +0 -2
- package/dist/vaults/index.d.ts +0 -254
- package/dist/vaults/types.d.ts +0 -368
- package/dist/vaults/upload/api.d.ts +0 -310
- package/dist/vaults/upload/chrome.d.ts +0 -21
- package/dist/vaults/upload/container.d.ts +0 -37
- package/dist/vaults/upload/index.d.ts +0 -76
- package/dist/vaults/upload/inline-container.d.ts +0 -41
- package/dist/vaults/upload/modal.d.ts +0 -55
- package/dist/vaults/upload/renderer.d.ts +0 -150
- package/dist/vaults/upload/styles.d.ts +0 -14
- package/dist/vaults/upload/types.d.ts +0 -220
|
@@ -1,561 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Identity Module Types
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The kind of identifier a sign-in verified. `federated` is a person the
|
|
6
|
-
* account's own identity provider signed in: one person of that account's
|
|
7
|
-
* directory alone, never a global identity.
|
|
8
|
-
*/
|
|
9
|
-
export type VerifiedIdentityType = 'email' | 'phone' | 'social' | 'federated';
|
|
10
|
-
/**
|
|
11
|
-
* An identity type a sign-in may be restricted to (`SignInOptions.identityTypes`):
|
|
12
|
-
* the kinds a token's `identity_type` carries, as the sign-in contract
|
|
13
|
-
* (app-sdk identity-signin-contract SIGNIN_IDENTITY_TYPES) names them.
|
|
14
|
-
*/
|
|
15
|
-
export type SigninIdentityType = VerifiedIdentityType;
|
|
16
|
-
/**
|
|
17
|
-
* Auth context for OIDC or simple redirect flows.
|
|
18
|
-
* Used by hosted login pages to complete authorization flows.
|
|
19
|
-
*/
|
|
20
|
-
export interface AuthContext {
|
|
21
|
-
/** OIDC auth request ID for authorization code flow */
|
|
22
|
-
authRequestId?: string;
|
|
23
|
-
/**
|
|
24
|
-
* A verification against a verify session, as the SparkVault-hosted page
|
|
25
|
-
* that serves it describes it. Every request of the verification names the
|
|
26
|
-
* session, and the server reads its destination, state and purpose from it.
|
|
27
|
-
* `methods` and `allowedIdentityTypes` are what the session admits, decided
|
|
28
|
-
* by the server from the session, and the page offers them in place of the
|
|
29
|
-
* account's sign-in methods: a Notify recipient's proof of address admits a
|
|
30
|
-
* code emailed to the address it was sent to and a passkey, whatever the
|
|
31
|
-
* account's sign-in switches on, and the passkey alone for a request its
|
|
32
|
-
* sender held to a passkey; no verify session admits a SparkLink or a social
|
|
33
|
-
* sign-in, neither of which can complete one.
|
|
34
|
-
*/
|
|
35
|
-
simpleMode?: {
|
|
36
|
-
/** Opaque server-side verify session the verification completes against */
|
|
37
|
-
sessionId: string;
|
|
38
|
-
/** The methods the session admits */
|
|
39
|
-
methods: MethodId[];
|
|
40
|
-
/** The identifier types the session's methods deliver to */
|
|
41
|
-
allowedIdentityTypes: ('email' | 'phone')[];
|
|
42
|
-
/**
|
|
43
|
-
* True when the session proves a request its sender held to a passkey: it
|
|
44
|
-
* admits the passkey alone, so a person who holds no passkey registered
|
|
45
|
-
* with SparkVault is told that only the sender can resend the request at a
|
|
46
|
-
* level they can clear, never offered a way that cannot complete it.
|
|
47
|
-
* Absent reads as false.
|
|
48
|
-
*/
|
|
49
|
-
passkeyRequired?: boolean;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export interface VerifyOptions {
|
|
53
|
-
/** Pre-fill email address (mutually exclusive with phone) */
|
|
54
|
-
email?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Pre-fill phone number in E.164 format, e.g. "+14155551234" (mutually
|
|
57
|
-
* exclusive with email). The sign-in texts or calls it only once the person
|
|
58
|
-
* picks a text or call method, under the SMS and voice consent.
|
|
59
|
-
*/
|
|
60
|
-
phone?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Target element for inline rendering. Can be:
|
|
63
|
-
* - A CSS selector string (e.g., "#auth-container")
|
|
64
|
-
* - An HTMLElement reference
|
|
65
|
-
* - Omitted for dialog mode (default)
|
|
66
|
-
*/
|
|
67
|
-
target?: string | HTMLElement;
|
|
68
|
-
/** Override backdrop blur for this dialog (uses global config if omitted) */
|
|
69
|
-
backdropBlur?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Container chrome for inline (`target`) rendering. `'card'` (default) wraps
|
|
72
|
-
* the flow in a bordered, rounded surface with the SparkVault footer. `'bare'`
|
|
73
|
-
* drops the surface and footer so a host page (e.g. the SparkVault sign-in
|
|
74
|
-
* page) can supply its own full-window chrome: logo, background, footer.
|
|
75
|
-
* Ignored in dialog mode.
|
|
76
|
-
*/
|
|
77
|
-
chrome?: 'card' | 'bare';
|
|
78
|
-
/** Auth context for OIDC/simple mode flows (used by hosted login) */
|
|
79
|
-
authContext?: AuthContext;
|
|
80
|
-
/**
|
|
81
|
-
* How sign-in leaves this page. `'auto'` (default) and `'popup'` open the
|
|
82
|
-
* first-party popup; `'redirect'` navigates this tab to the sign-in page
|
|
83
|
-
* instead (its return leg is `handleRedirectResult()`), the opt-out for
|
|
84
|
-
* hosts that prefer a full-page redirect over a popup on mobile.
|
|
85
|
-
*/
|
|
86
|
-
flow?: 'auto' | 'popup' | 'redirect';
|
|
87
|
-
/**
|
|
88
|
-
* `'select_account'` always shows the sign-in page's account chooser instead
|
|
89
|
-
* of silently continuing as the current account, even when only one saved
|
|
90
|
-
* account exists. Any other value is dropped at URL serialization.
|
|
91
|
-
*/
|
|
92
|
-
prompt?: 'select_account';
|
|
93
|
-
/**
|
|
94
|
-
* `'federation'` starts sign-in with the account's own identity provider
|
|
95
|
-
* at once: the sign-in page skips its account chooser and the method list
|
|
96
|
-
* and leaves for the provider. Honoured only while the account has its
|
|
97
|
-
* identity provider switched on; otherwise the page starts as usual,
|
|
98
|
-
* account chooser included. Any other value is dropped at URL
|
|
99
|
-
* serialization.
|
|
100
|
-
*/
|
|
101
|
-
method?: 'federation';
|
|
102
|
-
/**
|
|
103
|
-
* The identity types this sign-in may produce (the token's `identity_type`),
|
|
104
|
-
* for a caller that accepts only some: the sign-in page offers only the ways
|
|
105
|
-
* in that can produce one, and Identity refuses a sign-in of any other type
|
|
106
|
-
* before it is counted, billed or minted. At least one type; a value that
|
|
107
|
-
* names none, or a type outside `SigninIdentityType`, is a ValidationError
|
|
108
|
-
* before anything opens. Omitted: any type, as without it. The caller's own
|
|
109
|
-
* check of the token's `identity_type` stays its final gate.
|
|
110
|
-
*/
|
|
111
|
-
identityTypes?: SigninIdentityType[];
|
|
112
|
-
/**
|
|
113
|
-
* Rendering strategy (internal). `'local'` renders the flow directly in this
|
|
114
|
-
* document: used inside the popup that runs the flow, and forced for inline
|
|
115
|
-
* (`target`) rendering. Dialog mode (omitted) renders a thin launcher and
|
|
116
|
-
* opens the popup.
|
|
117
|
-
*/
|
|
118
|
-
renderMode?: 'local';
|
|
119
|
-
/**
|
|
120
|
-
* The sign-in's reference (internal): set by the SparkVault sign-in page
|
|
121
|
-
* that runs the flow, never by a site. Every call that completes the
|
|
122
|
-
* sign-in from the page carries the reference the flow holds at that
|
|
123
|
-
* moment, and so does a start through the account's own identity
|
|
124
|
-
* provider, so Identity records it on the hub session the sign-in creates
|
|
125
|
-
* or chooses (or, for the provider, which opens none, releases it from the
|
|
126
|
-
* browser's hub sessions), and a lost popup result recovers that sign-in
|
|
127
|
-
* only. The flow offers the provider only on an explicit signal: a
|
|
128
|
-
* reference held, or `completesInWindow`. The reference never holds up the
|
|
129
|
-
* sign-in: a call made before it arrives carries none.
|
|
130
|
-
* - A reference: held from the start. The provider is offered. A value
|
|
131
|
-
* that is no reference is `null`.
|
|
132
|
-
* - A function: the reference arrives after the flow renders. The flow
|
|
133
|
-
* calls it once as it starts, and again only on the person's Try Again;
|
|
134
|
-
* each call asks afresh, and resolves to a reference, or to null when
|
|
135
|
-
* none could be had for now (a rejection, or a value that is no
|
|
136
|
-
* reference, is null too). The provider is offered once a reference
|
|
137
|
-
* arrives. Until then an account with other methods shows those; one
|
|
138
|
-
* whose only way in is the provider waits for it, and is told to try
|
|
139
|
-
* again when none could be had.
|
|
140
|
-
* - `null`: the page can never hold one (an SDK that predates the
|
|
141
|
-
* reference opened it), so the provider is never offered: such a
|
|
142
|
-
* sign-in opens no hub session, and its lost result could recover
|
|
143
|
-
* another person's.
|
|
144
|
-
* - Omitted: the provider is offered only when the page says it completes
|
|
145
|
-
* in its own window (`completesInWindow`); never for a page that predates
|
|
146
|
-
* the reference, whatever its window.
|
|
147
|
-
*/
|
|
148
|
-
signinRef?: string | null | (() => Promise<string | null>);
|
|
149
|
-
/**
|
|
150
|
-
* The sign-in completes in this window (internal): set by the SparkVault
|
|
151
|
-
* hosted sign-in page, which finishes an authorization request where it
|
|
152
|
-
* runs (an authorization code to the relying party, or a simple-mode
|
|
153
|
-
* redirect) and never hands its result to an opener. No recovery ever
|
|
154
|
-
* stands in for that result, so the page offers the account's own identity
|
|
155
|
-
* provider without a reference, in a popup too. Ignored when `signinRef`
|
|
156
|
-
* is given.
|
|
157
|
-
*/
|
|
158
|
-
completesInWindow?: boolean;
|
|
159
|
-
/** Called when user cancels (if omitted, uses server-configured redirect) */
|
|
160
|
-
onCancel?: () => void;
|
|
161
|
-
/** Called when verification completes (if omitted, uses server-configured redirect) */
|
|
162
|
-
onSuccess?: (result: VerifyResult) => void;
|
|
163
|
-
/** Called on error (if omitted, uses server-configured redirect) */
|
|
164
|
-
onError?: (error: Error) => void;
|
|
165
|
-
}
|
|
166
|
-
/** Options for attach() - binds verification to element clicks */
|
|
167
|
-
export interface AttachOptions {
|
|
168
|
-
/** Pre-fill email address */
|
|
169
|
-
email?: string;
|
|
170
|
-
/** Pre-fill phone number in E.164 format (see `VerifyOptions.phone`) */
|
|
171
|
-
phone?: string;
|
|
172
|
-
/** Auth context for OIDC/simple mode flows */
|
|
173
|
-
authContext?: AuthContext;
|
|
174
|
-
/** `'select_account'` always shows the account chooser (see `VerifyOptions.prompt`) */
|
|
175
|
-
prompt?: 'select_account';
|
|
176
|
-
/** `'federation'` starts with the account's own identity provider (see `VerifyOptions.method`) */
|
|
177
|
-
method?: 'federation';
|
|
178
|
-
/** The identity types the sign-in may produce (see `VerifyOptions.identityTypes`) */
|
|
179
|
-
identityTypes?: SigninIdentityType[];
|
|
180
|
-
/** Called when user cancels */
|
|
181
|
-
onCancel?: () => void;
|
|
182
|
-
/** Called when verification completes */
|
|
183
|
-
onSuccess?: (result: VerifyResult) => void;
|
|
184
|
-
/** Called on error */
|
|
185
|
-
onError?: (error: Error) => void;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* A server-decided post-login nudge. Computed once per login (default mode);
|
|
189
|
-
* clients render the steps they support, in order, before completing.
|
|
190
|
-
*/
|
|
191
|
-
export type Recommendation = {
|
|
192
|
-
type: 'passkey';
|
|
193
|
-
} | {
|
|
194
|
-
type: 'backup_identifier';
|
|
195
|
-
missingType: 'email' | 'phone';
|
|
196
|
-
};
|
|
197
|
-
/** Canonical dismiss key for a recommendation (suppresses it server-side 30d). */
|
|
198
|
-
export type RecommendationKey = 'passkey' | 'backup_email' | 'backup_phone';
|
|
199
|
-
/** A self-service screen in the auth.sv Identity portal. */
|
|
200
|
-
export type PortalSection = 'home' | 'identity' | 'security' | 'sessions' | 'sites';
|
|
201
|
-
/** Options for building an auth.sv portal deep link (`portalUrl()`). */
|
|
202
|
-
export interface PortalUrlOptions {
|
|
203
|
-
/** Which portal screen to open. Defaults to `'home'`. */
|
|
204
|
-
section?: PortalSection;
|
|
205
|
-
/**
|
|
206
|
-
* Focus a specific connected site on the Sites screen (an `acc_…` account ID).
|
|
207
|
-
* When `section` is `'sites'` and `site` is omitted, defaults to this SDK's
|
|
208
|
-
* own `accountId` (i.e. "manage this site"). Ignored for other sections.
|
|
209
|
-
*/
|
|
210
|
-
site?: string;
|
|
211
|
-
}
|
|
212
|
-
export interface VerifyResult {
|
|
213
|
-
/** Signed JWT token */
|
|
214
|
-
token: string;
|
|
215
|
-
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
216
|
-
identity: string;
|
|
217
|
-
/** Type of identifier returned with the verification result. */
|
|
218
|
-
identityType: VerifiedIdentityType;
|
|
219
|
-
/** Canonical SparkVault ID */
|
|
220
|
-
svid?: string;
|
|
221
|
-
/** Managed SparkVault Identity session ID */
|
|
222
|
-
sessionId?: string;
|
|
223
|
-
/** Managed-session refresh token, when the flow returns one */
|
|
224
|
-
refreshToken?: string;
|
|
225
|
-
/** Redirect URL (only present for OIDC/simple mode flows) */
|
|
226
|
-
redirect?: string;
|
|
227
|
-
/** Ordered post-login nudges (default-mode logins only). */
|
|
228
|
-
recommendations?: Recommendation[];
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Options for `signIn()`: the customer-facing popup sign-in. The popup owns its
|
|
232
|
-
* rendering, so there is no inline `target`/`renderMode`/`chrome`/`signinRef`/
|
|
233
|
-
* `completesInWindow` here; those are internal to the SparkVault-hosted
|
|
234
|
-
* sign-in surfaces.
|
|
235
|
-
*/
|
|
236
|
-
export type SignInOptions = Omit<VerifyOptions, 'target' | 'renderMode' | 'chrome' | 'signinRef' | 'completesInWindow'>;
|
|
237
|
-
/**
|
|
238
|
-
* Options for the SparkVault sign-in page's own render (internal): the flow's
|
|
239
|
-
* options, with the page's restriction as its URL's `identity_types` spells
|
|
240
|
-
* it, unread. The flow reads it (app-sdk readSigninIdentityTypes): absent is
|
|
241
|
-
* no restriction, and a spelling it cannot read shows as an error, never as
|
|
242
|
-
* no restriction.
|
|
243
|
-
*/
|
|
244
|
-
export type RenderOptions = Omit<VerifyOptions, 'identityTypes'> & {
|
|
245
|
-
target: string | HTMLElement;
|
|
246
|
-
identityTypes?: string | null;
|
|
247
|
-
};
|
|
248
|
-
/** The verified identity returned by `signIn()`. */
|
|
249
|
-
export type SignInResult = VerifyResult;
|
|
250
|
-
/**
|
|
251
|
-
* Options for `handleRedirectResult()`. Call once on every page load. It
|
|
252
|
-
* redeems a returned sign-in code (from `flow: 'redirect'` or the silent SSO
|
|
253
|
-
* self-heal) and, when a popup result was lost, triggers that self-heal. It
|
|
254
|
-
* no-ops otherwise.
|
|
255
|
-
*/
|
|
256
|
-
export interface RedirectResultOptions {
|
|
257
|
-
/** Called with the verified result when a returned sign-in code is redeemed */
|
|
258
|
-
onSuccess?: (result: VerifyResult) => void;
|
|
259
|
-
/** Called when redeeming a returned sign-in code failed */
|
|
260
|
-
onError?: (error: Error) => void;
|
|
261
|
-
/** Called when the person cancelled sign-in on the hosted page */
|
|
262
|
-
onCancel?: () => void;
|
|
263
|
-
}
|
|
264
|
-
/** Raw wire shape of POST /signin/redeem (snake_case, mirrors /sso/continue). */
|
|
265
|
-
export interface RedeemHandoffResponse {
|
|
266
|
-
token: string;
|
|
267
|
-
identity: string;
|
|
268
|
-
identity_type: VerifiedIdentityType;
|
|
269
|
-
svid?: string | null;
|
|
270
|
-
session_id?: string | null;
|
|
271
|
-
refresh_token?: string | null;
|
|
272
|
-
}
|
|
273
|
-
/** Raw recommendation as the API returns it (snake_case). */
|
|
274
|
-
export interface RawRecommendation {
|
|
275
|
-
type: string;
|
|
276
|
-
missing_type?: 'email' | 'phone' | null;
|
|
277
|
-
}
|
|
278
|
-
export interface TokenClaims {
|
|
279
|
-
/** Issuer */
|
|
280
|
-
iss: string;
|
|
281
|
-
/** Subject. Managed Identity tokens use the SVID. */
|
|
282
|
-
sub: string;
|
|
283
|
-
/** Audience (account ID for simple tokens, client ID for OIDC) */
|
|
284
|
-
aud: string;
|
|
285
|
-
/** Expiry (Unix seconds) */
|
|
286
|
-
exp: number;
|
|
287
|
-
/** Issued at (Unix seconds) */
|
|
288
|
-
iat: number;
|
|
289
|
-
/** Unique token ID for replay protection */
|
|
290
|
-
jti?: string;
|
|
291
|
-
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
292
|
-
identity: string;
|
|
293
|
-
/** Identifier type */
|
|
294
|
-
identity_type: VerifiedIdentityType;
|
|
295
|
-
/** Canonical SparkVault ID */
|
|
296
|
-
svid?: string;
|
|
297
|
-
/** Managed SparkVault Identity session ID */
|
|
298
|
-
session_id?: string;
|
|
299
|
-
/** Verification timestamp (Unix seconds) */
|
|
300
|
-
verified_at: number;
|
|
301
|
-
/** Authentication method used */
|
|
302
|
-
method: string;
|
|
303
|
-
/**
|
|
304
|
-
* Only on a `federated` sign-in whose provider asserted an email: the
|
|
305
|
-
* address as the provider sent it. The provider may assert an address it
|
|
306
|
-
* never verified, so it is no identifier: key people by `sub`.
|
|
307
|
-
*/
|
|
308
|
-
email?: string;
|
|
309
|
-
/** Only beside `email`: true only when the provider said it verified the address. */
|
|
310
|
-
email_verified?: boolean;
|
|
311
|
-
/**
|
|
312
|
-
* The person's public avatar URL (my.auth.sv), present only when they have a visible
|
|
313
|
-
* avatar. The URL always renders an image: their photo, or a neutral placeholder.
|
|
314
|
-
*/
|
|
315
|
-
picture?: string;
|
|
316
|
-
}
|
|
317
|
-
export interface SdkConfigBranding {
|
|
318
|
-
companyName: string;
|
|
319
|
-
logoLight: string | null;
|
|
320
|
-
logoDark: string | null;
|
|
321
|
-
/** Theme mode from server config */
|
|
322
|
-
themeMode?: 'light' | 'dark';
|
|
323
|
-
}
|
|
324
|
-
/** Method ID returned by config endpoint */
|
|
325
|
-
export type MethodId = 'otp_email' | 'otp_sms' | 'otp_voice' | 'passkey' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin' | 'federation';
|
|
326
|
-
/**
|
|
327
|
-
* The account's own identity provider, as `/config` describes it while it is
|
|
328
|
-
* switched on: the name its button shows ("Continue with {display_name}"),
|
|
329
|
-
* and whether the sign-in page tries it silently first.
|
|
330
|
-
*/
|
|
331
|
-
export interface SdkConfigFederation {
|
|
332
|
-
display_name: string;
|
|
333
|
-
silent: boolean;
|
|
334
|
-
}
|
|
335
|
-
export interface SdkConfig {
|
|
336
|
-
accountId: string;
|
|
337
|
-
/** Branding configuration (optional in v1 - uses defaults if not provided) */
|
|
338
|
-
branding?: SdkConfigBranding;
|
|
339
|
-
/** Email/phone input types derived from enabled delivery methods */
|
|
340
|
-
allowedIdentityTypes?: ('email' | 'phone')[];
|
|
341
|
-
/** Enabled method IDs */
|
|
342
|
-
methods: MethodId[];
|
|
343
|
-
/** WebSocket domain for SparkLink push notifications (e.g., 'ws.sparkvault.com') */
|
|
344
|
-
wsDomain?: string;
|
|
345
|
-
/** Cross-domain SSO posture. `enabled`: this account participates in silent
|
|
346
|
-
* SSO. Informational: the server enforces it on its SSO endpoints, and the
|
|
347
|
-
* SDK does not branch on it. */
|
|
348
|
-
sso?: {
|
|
349
|
-
enabled: boolean;
|
|
350
|
-
};
|
|
351
|
-
/** The account's own identity provider; present only while `methods` lists `federation`. */
|
|
352
|
-
federation?: SdkConfigFederation;
|
|
353
|
-
}
|
|
354
|
-
/** Method metadata for SDK rendering (static lookup) */
|
|
355
|
-
export interface MethodMetadata {
|
|
356
|
-
id: MethodId;
|
|
357
|
-
type: 'otp' | 'passkey' | 'sparklink' | 'social' | 'federation';
|
|
358
|
-
/** Which identifier type this method requires. Passkeys are SVID-scoped and do not require one. */
|
|
359
|
-
identityType?: 'email' | 'phone';
|
|
360
|
-
name: string;
|
|
361
|
-
description: string;
|
|
362
|
-
icon: string;
|
|
363
|
-
/** Provider name for social methods */
|
|
364
|
-
provider?: string;
|
|
365
|
-
}
|
|
366
|
-
export interface OtpSendResponse {
|
|
367
|
-
success: boolean;
|
|
368
|
-
kindling: string;
|
|
369
|
-
expires_at: number;
|
|
370
|
-
method: string;
|
|
371
|
-
}
|
|
372
|
-
export interface OtpVerifyResponse {
|
|
373
|
-
verified: boolean;
|
|
374
|
-
token?: string;
|
|
375
|
-
/** Identity (email or phone) - returned on success */
|
|
376
|
-
identity?: string;
|
|
377
|
-
/** Identity type - 'email' or 'phone' */
|
|
378
|
-
identity_type?: 'email' | 'phone';
|
|
379
|
-
/** Redirect URL for OIDC/simple mode flows */
|
|
380
|
-
redirect?: string;
|
|
381
|
-
/** Canonical SparkVault ID */
|
|
382
|
-
svid?: string;
|
|
383
|
-
/** Managed SparkVault Identity session ID */
|
|
384
|
-
session_id?: string;
|
|
385
|
-
/** Managed-session refresh token */
|
|
386
|
-
refresh_token?: string;
|
|
387
|
-
/** Returned on failure - new kindling for next attempt */
|
|
388
|
-
kindling?: string;
|
|
389
|
-
/** Returned on failure - seconds until next attempt allowed */
|
|
390
|
-
retry_after?: number;
|
|
391
|
-
/** Returned on failure - when the backoff expires */
|
|
392
|
-
expires_at?: number;
|
|
393
|
-
/** Set when the primary factor succeeded but 2FA is still owed */
|
|
394
|
-
second_factor_required?: boolean;
|
|
395
|
-
/** Opaque pending-login handle to submit the second factor against */
|
|
396
|
-
ticket?: string;
|
|
397
|
-
/** Second-factor methods the user can use, e.g. ['authenticator','recovery_code'] */
|
|
398
|
-
methods?: string[];
|
|
399
|
-
/** Backup-identifier nudge hint (snake_case from the API). */
|
|
400
|
-
recommendations?: RawRecommendation[];
|
|
401
|
-
}
|
|
402
|
-
/** Response to POST /backup-verification/send. */
|
|
403
|
-
export interface BackupSendResponse {
|
|
404
|
-
/** Opaque pending-attach session id (present when a code was sent). */
|
|
405
|
-
session_id?: string;
|
|
406
|
-
/** Delivery channel actually used. */
|
|
407
|
-
method?: 'email' | 'sms' | 'voice';
|
|
408
|
-
/** Code expiry (Unix seconds). */
|
|
409
|
-
expires_at?: number;
|
|
410
|
-
/** True when the identifier is already on the identity; no code was sent. */
|
|
411
|
-
already_verified?: boolean;
|
|
412
|
-
}
|
|
413
|
-
/** Response to POST /backup-verification/verify. */
|
|
414
|
-
export interface BackupVerifyResponse {
|
|
415
|
-
verified: boolean;
|
|
416
|
-
type: 'email' | 'phone';
|
|
417
|
-
value: string;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* WebAuthn credential descriptor. Scopes an authentication ceremony to a
|
|
421
|
-
* specific person's passkeys (`allowCredentials`) so the authenticator offers
|
|
422
|
-
* only the matching credential. `id` is base64url-encoded. The server names
|
|
423
|
-
* no `transports`: scoping runs before authentication, and a transport list
|
|
424
|
-
* would hand an unauthenticated probe a device fingerprint.
|
|
425
|
-
*/
|
|
426
|
-
export interface PasskeyCredentialDescriptor {
|
|
427
|
-
type: 'public-key';
|
|
428
|
-
id: string;
|
|
429
|
-
}
|
|
430
|
-
export interface PasskeyChallengeResponse {
|
|
431
|
-
challenge: string;
|
|
432
|
-
rpId: string;
|
|
433
|
-
timeout: number;
|
|
434
|
-
/**
|
|
435
|
-
* Present only for an identifier-scoped ceremony: restricts the authenticator
|
|
436
|
-
* to this person's credentials. Absent for a discoverable ceremony.
|
|
437
|
-
*/
|
|
438
|
-
allowCredentials?: PasskeyCredentialDescriptor[];
|
|
439
|
-
/** Session object to pass back in complete request */
|
|
440
|
-
session: Record<string, unknown>;
|
|
441
|
-
}
|
|
442
|
-
export interface PasskeyVerifyResponse {
|
|
443
|
-
token: string;
|
|
444
|
-
identity: string;
|
|
445
|
-
identity_type: VerifiedIdentityType;
|
|
446
|
-
/** Canonical SparkVault ID */
|
|
447
|
-
svid?: string;
|
|
448
|
-
/** Managed SparkVault Identity session ID */
|
|
449
|
-
session_id?: string;
|
|
450
|
-
/** Managed-session refresh token */
|
|
451
|
-
refresh_token?: string;
|
|
452
|
-
/** Redirect URL for OIDC/simple mode flows */
|
|
453
|
-
redirect?: string;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Result of completing a login via the second factor. On success this is the
|
|
457
|
-
* same shape as any verified login; a wrong code surfaces as a thrown error.
|
|
458
|
-
*/
|
|
459
|
-
export interface SecondFactorVerifyResponse {
|
|
460
|
-
verified?: boolean;
|
|
461
|
-
token?: string;
|
|
462
|
-
identity?: string;
|
|
463
|
-
identity_type?: VerifiedIdentityType;
|
|
464
|
-
svid?: string;
|
|
465
|
-
session_id?: string;
|
|
466
|
-
refresh_token?: string;
|
|
467
|
-
/** Redirect URL the caller should navigate to. */
|
|
468
|
-
redirect?: string;
|
|
469
|
-
/** Backup-identifier nudge hint (snake_case from the API). */
|
|
470
|
-
recommendations?: RawRecommendation[];
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* What a SparkLink click produced for the sign-in waiting on it, pushed over
|
|
474
|
-
* the WebSocket, or reclaimed by kindling when the socket was lost. Either the
|
|
475
|
-
* login completed, or it is held at the second-factor gate and the SDK
|
|
476
|
-
* collects the code in its two-factor view.
|
|
477
|
-
*/
|
|
478
|
-
export type SparkLinkOutcome = {
|
|
479
|
-
kind: 'verified';
|
|
480
|
-
result: VerifyResult;
|
|
481
|
-
} | {
|
|
482
|
-
kind: 'second_factor';
|
|
483
|
-
ticket: string;
|
|
484
|
-
methods: string[];
|
|
485
|
-
};
|
|
486
|
-
/** The send's answer: never the link itself, which only the email carries. */
|
|
487
|
-
export interface SparkLinkSendResponse {
|
|
488
|
-
expiresAt: number;
|
|
489
|
-
/** Login-ceremony handle for the WebSocket-loss fallback claim (see api.consumeSparkLinkResult). */
|
|
490
|
-
kindling?: string;
|
|
491
|
-
}
|
|
492
|
-
export type IdentityViewState = {
|
|
493
|
-
view: 'loading';
|
|
494
|
-
} | {
|
|
495
|
-
view: 'awaiting-reference';
|
|
496
|
-
} | {
|
|
497
|
-
view: 'identity-input';
|
|
498
|
-
error?: string;
|
|
499
|
-
} | {
|
|
500
|
-
view: 'method-select';
|
|
501
|
-
email: string;
|
|
502
|
-
methods: MethodMetadata[];
|
|
503
|
-
} | {
|
|
504
|
-
view: 'otp-verify';
|
|
505
|
-
email: string;
|
|
506
|
-
method: 'email' | 'sms' | 'voice';
|
|
507
|
-
kindling: string;
|
|
508
|
-
error?: string;
|
|
509
|
-
backoffExpires?: number;
|
|
510
|
-
} | {
|
|
511
|
-
view: 'two-factor';
|
|
512
|
-
ticket: string;
|
|
513
|
-
methods: string[];
|
|
514
|
-
error?: string;
|
|
515
|
-
} | {
|
|
516
|
-
view: 'passkey';
|
|
517
|
-
recipient: string;
|
|
518
|
-
mode: 'register' | 'verify';
|
|
519
|
-
error?: string;
|
|
520
|
-
} | {
|
|
521
|
-
view: 'passkey-auto';
|
|
522
|
-
} | {
|
|
523
|
-
view: 'passkey-prompt';
|
|
524
|
-
recipient: string;
|
|
525
|
-
pendingResult: VerifyResult;
|
|
526
|
-
error?: string;
|
|
527
|
-
} | {
|
|
528
|
-
view: 'backup-verify';
|
|
529
|
-
missingType: 'email' | 'phone';
|
|
530
|
-
pendingResult: VerifyResult;
|
|
531
|
-
error?: string;
|
|
532
|
-
} | {
|
|
533
|
-
view: 'backup-code';
|
|
534
|
-
missingType: 'email' | 'phone';
|
|
535
|
-
value: string;
|
|
536
|
-
method: 'email' | 'sms' | 'voice';
|
|
537
|
-
sessionId: string;
|
|
538
|
-
pendingResult: VerifyResult;
|
|
539
|
-
error?: string;
|
|
540
|
-
} | {
|
|
541
|
-
view: 'sparklink-waiting';
|
|
542
|
-
email: string;
|
|
543
|
-
expiresAt: number;
|
|
544
|
-
} | {
|
|
545
|
-
view: 'oauth-pending';
|
|
546
|
-
provider: string;
|
|
547
|
-
} | {
|
|
548
|
-
view: 'federation-checking';
|
|
549
|
-
displayName: string;
|
|
550
|
-
} | {
|
|
551
|
-
view: 'error';
|
|
552
|
-
message: string;
|
|
553
|
-
code: string;
|
|
554
|
-
} | {
|
|
555
|
-
view: 'service-unavailable';
|
|
556
|
-
} | {
|
|
557
|
-
view: 'product-not-configured';
|
|
558
|
-
} | {
|
|
559
|
-
view: 'origin-not-allowed';
|
|
560
|
-
origin?: string;
|
|
561
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CooldownTimer - Reusable countdown utility for resend buttons and rate limiting
|
|
3
|
-
*
|
|
4
|
-
* Manages interval-based countdowns with callbacks for tick and completion events.
|
|
5
|
-
* Properly cleans up intervals to prevent memory leaks.
|
|
6
|
-
*/
|
|
7
|
-
export interface CooldownTimerConfig {
|
|
8
|
-
/** Duration in seconds */
|
|
9
|
-
duration: number;
|
|
10
|
-
/** Called every second with remaining seconds */
|
|
11
|
-
onTick: (secondsRemaining: number) => void;
|
|
12
|
-
/** Called when countdown reaches zero */
|
|
13
|
-
onComplete: () => void;
|
|
14
|
-
}
|
|
15
|
-
export declare class CooldownTimer {
|
|
16
|
-
private intervalId;
|
|
17
|
-
private secondsRemaining;
|
|
18
|
-
private readonly onTick;
|
|
19
|
-
private readonly onComplete;
|
|
20
|
-
constructor(config: CooldownTimerConfig);
|
|
21
|
-
/**
|
|
22
|
-
* Start the countdown timer
|
|
23
|
-
* Immediately calls onTick with initial value, then updates every second
|
|
24
|
-
*/
|
|
25
|
-
start(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Stop and clean up the timer
|
|
28
|
-
*/
|
|
29
|
-
stop(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Check if timer is currently running
|
|
32
|
-
*/
|
|
33
|
-
isRunning(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Get current remaining seconds
|
|
36
|
-
*/
|
|
37
|
-
getRemainingSeconds(): number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* ExpirationTimer - Countdown based on an absolute expiration timestamp
|
|
41
|
-
*
|
|
42
|
-
* Unlike CooldownTimer which counts down from a fixed duration,
|
|
43
|
-
* this calculates remaining time from a UTC timestamp, making it
|
|
44
|
-
* accurate even if the page was loaded after the timer started.
|
|
45
|
-
*/
|
|
46
|
-
export interface ExpirationTimerConfig {
|
|
47
|
-
/** UTC timestamp (seconds) when the countdown expires */
|
|
48
|
-
expiresAt: number;
|
|
49
|
-
/** Called every second with remaining seconds */
|
|
50
|
-
onTick: (secondsRemaining: number) => void;
|
|
51
|
-
/** Called when countdown reaches zero */
|
|
52
|
-
onExpired: () => void;
|
|
53
|
-
}
|
|
54
|
-
export declare class ExpirationTimer {
|
|
55
|
-
private intervalId;
|
|
56
|
-
private readonly expiresAt;
|
|
57
|
-
private readonly onTick;
|
|
58
|
-
private readonly onExpired;
|
|
59
|
-
constructor(config: ExpirationTimerConfig);
|
|
60
|
-
private calculateRemaining;
|
|
61
|
-
/**
|
|
62
|
-
* Start the countdown timer
|
|
63
|
-
*/
|
|
64
|
-
start(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Stop and clean up the timer
|
|
67
|
-
*/
|
|
68
|
-
stop(): void;
|
|
69
|
-
/**
|
|
70
|
-
* Check if timer is currently running
|
|
71
|
-
*/
|
|
72
|
-
isRunning(): boolean;
|
|
73
|
-
}
|