@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,237 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Identity API Client
|
|
3
|
-
*
|
|
4
|
-
* Handles all HTTP communication with the Identity Product endpoints.
|
|
5
|
-
* Single responsibility: API calls only.
|
|
6
|
-
*/
|
|
7
|
-
import type { ResolvedConfig } from '../../config';
|
|
8
|
-
import { SparkVaultApi } from '../../api-base';
|
|
9
|
-
import { SparkVaultError } from '../../errors';
|
|
10
|
-
import type { SdkConfig, OtpSendResponse, OtpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SecondFactorVerifyResponse, SparkLinkSendResponse, SparkLinkOutcome, BackupSendResponse, BackupVerifyResponse, Recommendation, RecommendationKey, AuthContext, SigninIdentityType, RedeemHandoffResponse } from './types';
|
|
11
|
-
export declare class IdentityApi extends SparkVaultApi {
|
|
12
|
-
private readonly config;
|
|
13
|
-
/** Cached config promise - allows preloading and deduplication */
|
|
14
|
-
private configCache;
|
|
15
|
-
constructor(config: ResolvedConfig, timeoutMs?: number);
|
|
16
|
-
/** The account this API signs people in to. */
|
|
17
|
-
get accountId(): string;
|
|
18
|
-
private get baseUrl();
|
|
19
|
-
protected makeError(message: string, code: string, statusCode: number, details?: Record<string, unknown>, retryAfterMs?: number | null): IdentityApiError;
|
|
20
|
-
private request;
|
|
21
|
-
/**
|
|
22
|
-
* Fetch SDK configuration (branding, enabled methods).
|
|
23
|
-
* Uses caching to avoid redundant requests - safe to call multiple times.
|
|
24
|
-
* If a cached request failed (e.g., transient network error during preload),
|
|
25
|
-
* clears the cache and retries to avoid permanently caching a rejected promise.
|
|
26
|
-
*/
|
|
27
|
-
getConfig(): Promise<SdkConfig>;
|
|
28
|
-
/**
|
|
29
|
-
* Preload the SDK configuration in the background.
|
|
30
|
-
* Called on SDK init when preloadConfig is enabled.
|
|
31
|
-
* The result is cached and used when verify() is called.
|
|
32
|
-
* If preload fails, getConfig() will clear the cache and retry.
|
|
33
|
-
*/
|
|
34
|
-
preloadConfig(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Check if config has been preloaded and is ready.
|
|
37
|
-
*/
|
|
38
|
-
isConfigPreloaded(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* An authorization request's PKCE verifier, state and nonce, each spelled
|
|
41
|
-
* from its own slice of one Entropy service draw taken through the Identity
|
|
42
|
-
* origin (POST /{account}/entropy). The page signing in holds no SparkVault
|
|
43
|
-
* credential, and already reaches the Identity origin, so its CSP needs no
|
|
44
|
-
* other origin for the draw.
|
|
45
|
-
*/
|
|
46
|
-
drawAuthorizationValues(): Promise<{
|
|
47
|
-
codeVerifier: string;
|
|
48
|
-
state: string;
|
|
49
|
-
nonce: string;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* A sign-in's reference (app-sdk SIGNIN_REFERENCE): its own draw through
|
|
53
|
-
* the Identity origin, like drawAuthorizationValues, spelled unpadded
|
|
54
|
-
* base64url. The draw names its purpose, so the origin counts it against a
|
|
55
|
-
* budget of its own and a network's reference draws never spend the draws
|
|
56
|
-
* its sign-ins need to complete. Rejects on a draw that fails (a spent
|
|
57
|
-
* budget among them) or answers malformed.
|
|
58
|
-
*/
|
|
59
|
-
drawSigninReference(): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Check whether the SVID resolved from an email or phone has registered
|
|
62
|
-
* passkeys (`has_passkey`; cross-tenant, single global RP), for a
|
|
63
|
-
* verification that admits passkeys.
|
|
64
|
-
*/
|
|
65
|
-
checkPasskey(identity: string, identityType?: 'email' | 'phone', authContext?: AuthContext): Promise<{
|
|
66
|
-
has_passkey: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Redeem a one-time sign-in code (with its PKCE verifier) for the sign-in
|
|
70
|
-
* result: the shared return leg for `flow: 'redirect'` and the silent SSO
|
|
71
|
-
* self-heal. The code arrives in the URL fragment after the hosted page
|
|
72
|
-
* navigates back; it is single-use, 60s-lived, and bound to this page's
|
|
73
|
-
* origin server-side.
|
|
74
|
-
*/
|
|
75
|
-
redeemHandoffCode(code: string, codeVerifier: string): Promise<RedeemHandoffResponse>;
|
|
76
|
-
/**
|
|
77
|
-
* The auth context a send or a completion carries: its OIDC
|
|
78
|
-
* `auth_request_id` (a send keeps the auth request alive as long as what it
|
|
79
|
-
* sent), and the verify session it belongs to.
|
|
80
|
-
*/
|
|
81
|
-
private buildAuthContextParams;
|
|
82
|
-
/**
|
|
83
|
-
* Send OTP code to email or phone. The send starts the ceremony, so it
|
|
84
|
-
* carries the sign-in's restriction, which Identity records on the code and
|
|
85
|
-
* reads again at /otp/verify: the verify never names it.
|
|
86
|
-
*/
|
|
87
|
-
sendOtp(params: {
|
|
88
|
-
recipient: string;
|
|
89
|
-
method: 'email' | 'sms' | 'voice';
|
|
90
|
-
authContext?: AuthContext;
|
|
91
|
-
identityTypes?: readonly SigninIdentityType[] | null;
|
|
92
|
-
}): Promise<OtpSendResponse>;
|
|
93
|
-
/**
|
|
94
|
-
* Verify OTP code
|
|
95
|
-
*/
|
|
96
|
-
verifyOtp(params: {
|
|
97
|
-
kindling: string;
|
|
98
|
-
pin: string;
|
|
99
|
-
recipient: string;
|
|
100
|
-
authContext?: AuthContext;
|
|
101
|
-
signinRef?: string | null;
|
|
102
|
-
}): Promise<OtpVerifyResponse>;
|
|
103
|
-
/**
|
|
104
|
-
* Submit a second factor (authenticator-app code or recovery code) to finish
|
|
105
|
-
* a login that the primary factor left in a `second_factor_required` state.
|
|
106
|
-
* The ticket is the opaque pending-login handle returned by the primary
|
|
107
|
-
* verify call.
|
|
108
|
-
*/
|
|
109
|
-
submitSecondFactor(params: {
|
|
110
|
-
ticket: string;
|
|
111
|
-
code: string;
|
|
112
|
-
}): Promise<SecondFactorVerifyResponse>;
|
|
113
|
-
/**
|
|
114
|
-
* Start passkey verification, for a verification that admits passkeys. An
|
|
115
|
-
* optional identifier scopes the ceremony to that person's credentials
|
|
116
|
-
* (`allowCredentials`) so the authenticator offers only the matching passkey;
|
|
117
|
-
* omit it for a discoverable ceremony. Completion always routes via the
|
|
118
|
-
* credential userHandle, so scoping is purely a hint. The start carries the
|
|
119
|
-
* sign-in's restriction, which Identity records on the challenge's session
|
|
120
|
-
* and reads again at completion.
|
|
121
|
-
*/
|
|
122
|
-
startPasskeyVerify(identity?: string, identityType?: 'email' | 'phone', authContext?: AuthContext, identityTypes?: readonly SigninIdentityType[] | null): Promise<PasskeyChallengeResponse>;
|
|
123
|
-
/**
|
|
124
|
-
* Complete passkey verification
|
|
125
|
-
*/
|
|
126
|
-
completePasskeyVerify(params: {
|
|
127
|
-
session: Record<string, unknown>;
|
|
128
|
-
credential: PublicKeyCredential;
|
|
129
|
-
authContext?: AuthContext;
|
|
130
|
-
signinRef?: string | null;
|
|
131
|
-
}): Promise<PasskeyVerifyResponse>;
|
|
132
|
-
/**
|
|
133
|
-
* Send a one-time code to a new backup identifier (the inverse of the
|
|
134
|
-
* identifier just logged in with). Authorized by the login's verification
|
|
135
|
-
* token. Returns a pending-attach `session_id`, or `already_verified` when
|
|
136
|
-
* the identifier is already on the identity.
|
|
137
|
-
*/
|
|
138
|
-
sendBackupVerification(params: {
|
|
139
|
-
verificationToken: string;
|
|
140
|
-
type: 'email' | 'phone';
|
|
141
|
-
value: string;
|
|
142
|
-
method?: 'email' | 'sms' | 'voice';
|
|
143
|
-
}): Promise<BackupSendResponse>;
|
|
144
|
-
/**
|
|
145
|
-
* Confirm the backup-identifier code and attach it to the identity. A 409
|
|
146
|
-
* `backup_conflict` (identifier owned by another identity) surfaces as a
|
|
147
|
-
* thrown IdentityApiError with code `backup_conflict`.
|
|
148
|
-
*/
|
|
149
|
-
verifyBackupVerification(params: {
|
|
150
|
-
sessionId: string;
|
|
151
|
-
code: string;
|
|
152
|
-
}): Promise<BackupVerifyResponse>;
|
|
153
|
-
/**
|
|
154
|
-
* Skip a post-login recommendation, suppressing it server-side for 30 days.
|
|
155
|
-
* Authorized by the login's verification token. Best-effort: a failure here
|
|
156
|
-
* must not block completing the login.
|
|
157
|
-
*/
|
|
158
|
-
dismissRecommendation(params: {
|
|
159
|
-
verificationToken: string;
|
|
160
|
-
key: RecommendationKey;
|
|
161
|
-
}): Promise<void>;
|
|
162
|
-
/**
|
|
163
|
-
* Get OAuth redirect URL for social provider. The start carries the
|
|
164
|
-
* sign-in's reference, when it has one, so the hub session the provider's
|
|
165
|
-
* answer creates or chooses records it, and the sign-in's restriction, which
|
|
166
|
-
* Identity records in the round trip's state.
|
|
167
|
-
*/
|
|
168
|
-
getSocialAuthUrl(provider: string, redirectUri: string, state: string, authContext?: AuthContext, options?: {
|
|
169
|
-
signinRef?: string | null;
|
|
170
|
-
identityTypes?: readonly SigninIdentityType[] | null;
|
|
171
|
-
}): string;
|
|
172
|
-
/**
|
|
173
|
-
* The start of a sign-in with the account's own identity provider: the same
|
|
174
|
-
* return as a social start (the page `redirectUri` names, answered with
|
|
175
|
-
* `#token` and the `state` sent, or the OIDC auth request it continues), and
|
|
176
|
-
* `prompt=none` for a silent attempt, which the provider answers without
|
|
177
|
-
* showing anything. The start carries the sign-in's reference, when it has
|
|
178
|
-
* one: such a sign-in opens no hub session, so Identity releases that
|
|
179
|
-
* reference from the browser's hub sessions on its completion, and a
|
|
180
|
-
* recovery naming it mints none of them. It carries the sign-in's
|
|
181
|
-
* restriction too, which Identity records in the round trip's state. A
|
|
182
|
-
* verify session is never named: such a sign-in cannot complete one, so its
|
|
183
|
-
* start refuses it, and a verify session never admits the method.
|
|
184
|
-
*/
|
|
185
|
-
getFederationAuthUrl(redirectUri: string, state: string, authContext?: AuthContext, options?: {
|
|
186
|
-
silent?: boolean;
|
|
187
|
-
signinRef?: string | null;
|
|
188
|
-
identityTypes?: readonly SigninIdentityType[] | null;
|
|
189
|
-
}): string;
|
|
190
|
-
/**
|
|
191
|
-
* Send SparkLink email for identity verification.
|
|
192
|
-
* Includes connectionId for WebSocket push notification of verification
|
|
193
|
-
* result. The send starts the ceremony, so it carries the sign-in's
|
|
194
|
-
* restriction, which Identity records for the link's click.
|
|
195
|
-
*/
|
|
196
|
-
sendSparkLink(email: string, connectionId: string, authContext?: AuthContext, signinRef?: string | null, identityTypes?: readonly SigninIdentityType[] | null): Promise<SparkLinkSendResponse>;
|
|
197
|
-
/**
|
|
198
|
-
* Claim the SparkLink click's result by kindling, the WebSocket-loss
|
|
199
|
-
* fallback. The SDK calls this when its socket was suspended with the tab and
|
|
200
|
-
* it refocuses. Returns what the click produced (a completed login, or its
|
|
201
|
-
* second-factor challenge), or null while still pending (not yet clicked) or
|
|
202
|
-
* already consumed. The read burns the server-side spark, so the result can
|
|
203
|
-
* be claimed exactly once.
|
|
204
|
-
*/
|
|
205
|
-
consumeSparkLinkResult(kindling: string): Promise<SparkLinkOutcome | null>;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* The verify session a request of a verification against one names, as
|
|
209
|
-
* `simple_mode: { session_id }`: the one field of it the server reads, the
|
|
210
|
-
* session's row holding the rest. Every request of the verification carries
|
|
211
|
-
* it (its sends, its passkey check and start, its completion, in a body or a
|
|
212
|
-
* popup's query), so the server holds each to what the session admits; a
|
|
213
|
-
* request that named none would be judged as a sign-in to the account instead.
|
|
214
|
-
*/
|
|
215
|
-
export declare function verifySessionParam(authContext?: AuthContext): {
|
|
216
|
-
simple_mode?: {
|
|
217
|
-
session_id: string;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Read a SparkLink result event. The WebSocket push and the kindling reclaim
|
|
222
|
-
* carry the same server-built event, so this is the one reader for both.
|
|
223
|
-
* Returns null for anything that is not a usable result: a still-pending
|
|
224
|
-
* reclaim, or an event missing what its type requires, such as a challenge without a
|
|
225
|
-
* ticket, or a completed login with neither a token (default flow) nor the
|
|
226
|
-
* redirect that continues it (OIDC hosted login).
|
|
227
|
-
*/
|
|
228
|
-
export declare function parseSparkLinkEvent(raw: unknown): SparkLinkOutcome | null;
|
|
229
|
-
/**
|
|
230
|
-
* Map the API's snake_case recommendation list to the SDK's typed shape,
|
|
231
|
-
* dropping any entries the SDK does not understand. Returns undefined when
|
|
232
|
-
* absent so callers treat it as "no nudges".
|
|
233
|
-
*/
|
|
234
|
-
export declare function mapRecommendations(raw: unknown): Recommendation[] | undefined;
|
|
235
|
-
export declare class IdentityApiError extends SparkVaultError {
|
|
236
|
-
constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
237
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Container Interface
|
|
3
|
-
*
|
|
4
|
-
* Abstract interface for identity UI containers.
|
|
5
|
-
* Allows switching between modal (popup) and inline rendering modes
|
|
6
|
-
* while reusing all view logic, state management, and handlers.
|
|
7
|
-
*/
|
|
8
|
-
import type { SdkConfigBranding } from './types';
|
|
9
|
-
/**
|
|
10
|
-
* Container interface that both ModalContainer and InlineContainer implement.
|
|
11
|
-
* The renderer interacts with containers through this interface.
|
|
12
|
-
*/
|
|
13
|
-
export interface Container {
|
|
14
|
-
/**
|
|
15
|
-
* Create the container with loading state.
|
|
16
|
-
* Called immediately when verification starts.
|
|
17
|
-
*/
|
|
18
|
-
createLoading(options: {
|
|
19
|
-
backdropBlur?: boolean;
|
|
20
|
-
}, onClose: () => void): void;
|
|
21
|
-
/**
|
|
22
|
-
* Update branding after SDK config loads.
|
|
23
|
-
*/
|
|
24
|
-
updateBranding(branding: SdkConfigBranding): void;
|
|
25
|
-
/**
|
|
26
|
-
* Switch to minimal chrome mode for full-bleed views (e.g. terminal error
|
|
27
|
-
* screens). Hides the header (so customer branding doesn't appear on
|
|
28
|
-
* SparkVault-owned messaging) and exposes a floating close affordance.
|
|
29
|
-
* No-op for containers that don't have chrome to hide.
|
|
30
|
-
*/
|
|
31
|
-
setMinimalChrome(enabled: boolean): void;
|
|
32
|
-
/**
|
|
33
|
-
* Get the body element where views are rendered.
|
|
34
|
-
*/
|
|
35
|
-
getBody(): HTMLDivElement | null;
|
|
36
|
-
/**
|
|
37
|
-
* Check if the container is currently active.
|
|
38
|
-
*/
|
|
39
|
-
isOpen(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Destroy the container and clean up event listeners.
|
|
42
|
-
*/
|
|
43
|
-
destroy(): void;
|
|
44
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dialog Launcher
|
|
3
|
-
*
|
|
4
|
-
* Host-side half of the popup login flow. Dialog-mode `verify()` opens a
|
|
5
|
-
* TOP-LEVEL popup on the Identity origin **directly inside the triggering user
|
|
6
|
-
* gesture** and, on the host page, shades it with a small branded **bridge
|
|
7
|
-
* modal** ("continue in the secure window"). The popup (the `chrome: 'bare'`
|
|
8
|
-
* sign-in page) collects the identifier and runs the whole flow first-party, so
|
|
9
|
-
* login's `__Host-authsv_sso` cookie persists. Any `email`/`phone` passed to
|
|
10
|
-
* `verify()` is forwarded as a prefill.
|
|
11
|
-
*
|
|
12
|
-
* The popup must open synchronously in the gesture or the browser blocks it as
|
|
13
|
-
* programmatic. `verify()` reaches `start()` through microtask-only awaits (the
|
|
14
|
-
* redirect-result check does no I/O; the preloaded config resolves from cache),
|
|
15
|
-
* so transient activation survives. Each popup's reference (app-sdk
|
|
16
|
-
* SIGNIN_REFERENCE) is therefore drawn only after that popup opens, by the
|
|
17
|
-
* owner (`drawSigninReference`). Once the owner has decided it (its pending
|
|
18
|
-
* marker holds the drawn reference, or the popup has none), the launcher
|
|
19
|
-
* posts it to the popup in answer to each "ready" ping: the reference, or
|
|
20
|
-
* null. A popup told null may ask again (`SIGNIN_REFERENCE.retryMessage`),
|
|
21
|
-
* and the owner then draws afresh for it.
|
|
22
|
-
*
|
|
23
|
-
* It is one dialog. The happy path is clean: logo, a subtle animation, and
|
|
24
|
-
* "continue in the secure window". A single warning appears under the logo only
|
|
25
|
-
* when the popup can't be confirmed: it was blocked, it closed, or it never
|
|
26
|
-
* posted a "ready" ping within `OPEN_TIMEOUT_MS` (so the open/load failed). Its
|
|
27
|
-
* "Try again" reopens the popup. The header's close ✕ (or backdrop/Escape)
|
|
28
|
-
* aborts and closes the popup.
|
|
29
|
-
*/
|
|
30
|
-
import type { ResolvedConfig } from '../../config';
|
|
31
|
-
import type { VerifyOptions, VerifyResult } from './types';
|
|
32
|
-
import type { IdentityApi } from './api';
|
|
33
|
-
interface LauncherCallbacks {
|
|
34
|
-
onSuccess: (result: VerifyResult) => void;
|
|
35
|
-
onError: (error: Error) => void;
|
|
36
|
-
onCancel: () => void;
|
|
37
|
-
/**
|
|
38
|
-
* The opener OBSERVED the popup end with no result (window closed, or it
|
|
39
|
-
* never opened) while the retry alert keeps the flow alive. There is no lost
|
|
40
|
-
* result to self-heal, so the owner retires its pending sign-in marker;
|
|
41
|
-
* without this, a reload while the alert is up fires a spurious recovery
|
|
42
|
-
* bounce. Deliberately NOT onCancel: the flow is unsettled, retry may follow.
|
|
43
|
-
*/
|
|
44
|
-
onPopupClosedUnresolved?: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* The current popup needs a reference of its own: it was just opened, the
|
|
47
|
-
* first or by "Try again", or it has none and asked again. The owner arms
|
|
48
|
-
* its marker holding none, draws one, and calls `signinReferenceDecided()`
|
|
49
|
-
* once it has decided what this popup is told.
|
|
50
|
-
*/
|
|
51
|
-
drawSigninReference: () => void;
|
|
52
|
-
/**
|
|
53
|
-
* The popup's handle was severed (COOP): postMessage can never deliver, so
|
|
54
|
-
* a retry popup is futile. The owner should switch this tab to the redirect
|
|
55
|
-
* flow; resolve `true` when the navigation started (this page is unloading),
|
|
56
|
-
* `false` when it did not: the return leg could not be armed (e.g. no
|
|
57
|
-
* session storage), and the launcher falls back to the retry alert, or the
|
|
58
|
-
* sign-in ended meanwhile (settled, or this launcher closed), and there is
|
|
59
|
-
* no alert left to show.
|
|
60
|
-
*/
|
|
61
|
-
onPopupSevered?: () => Promise<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* The current popup's reference as the owner decided it: undefined while
|
|
64
|
-
* undecided, null when the popup has none, else the reference the owner's
|
|
65
|
-
* pending marker holds. The popup is told only this, so it can never hold
|
|
66
|
-
* a reference the marker does not.
|
|
67
|
-
*/
|
|
68
|
-
signinReference: () => string | null | undefined;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Opens the sign-in popup for dialog-mode `verify()` and bridges its result
|
|
72
|
-
* back, behind a single branded host-page modal.
|
|
73
|
-
*/
|
|
74
|
-
export declare class DialogLauncher {
|
|
75
|
-
private readonly config;
|
|
76
|
-
private readonly api;
|
|
77
|
-
private readonly options;
|
|
78
|
-
private readonly callbacks;
|
|
79
|
-
private readonly trustedOrigin;
|
|
80
|
-
private readonly popupLauncher;
|
|
81
|
-
private modal;
|
|
82
|
-
private alertEl;
|
|
83
|
-
private popupWindow;
|
|
84
|
-
private popupReady;
|
|
85
|
-
private openTimer;
|
|
86
|
-
private settled;
|
|
87
|
-
private generation;
|
|
88
|
-
constructor(config: ResolvedConfig, api: IdentityApi, options: VerifyOptions, callbacks: LauncherCallbacks);
|
|
89
|
-
/** Shade the host with the bridge and open the popup in the caller's gesture. */
|
|
90
|
-
start(): void;
|
|
91
|
-
/** Tear down the bridge modal and close any popup it opened. */
|
|
92
|
-
close(): void;
|
|
93
|
-
/**
|
|
94
|
-
* The owner decided the current popup's reference: tell the popup if it
|
|
95
|
-
* already pinged. A popup that loads later is told in answer to its ping.
|
|
96
|
-
*/
|
|
97
|
-
signinReferenceDecided(): void;
|
|
98
|
-
private openPopup;
|
|
99
|
-
/**
|
|
100
|
-
* The current popup asked again for its reference. A popup that has none
|
|
101
|
-
* gets a fresh draw (the owner re-arms the marker, then decides), one that
|
|
102
|
-
* holds a reference is told it again, and one whose draw is still out is
|
|
103
|
-
* told once that draw is decided.
|
|
104
|
-
*/
|
|
105
|
-
private answerSigninReferenceRetry;
|
|
106
|
-
/**
|
|
107
|
-
* Post the current popup's reference, once the owner decided it, to this
|
|
108
|
-
* launcher's own popup: the reference the marker holds, or null for a
|
|
109
|
-
* popup with none, so the page knows at once that it has none for now
|
|
110
|
-
* instead of waiting it out. Only a document there on the trusted Identity
|
|
111
|
-
* origin receives it: the browser drops it while the popup shows any other
|
|
112
|
-
* origin (a provider's page).
|
|
113
|
-
*/
|
|
114
|
-
private postSigninReference;
|
|
115
|
-
private handleResult;
|
|
116
|
-
private handleError;
|
|
117
|
-
/** Create the bridge modal (once) and render its single happy-path body. */
|
|
118
|
-
private showBridge;
|
|
119
|
-
private showAlert;
|
|
120
|
-
private hideAlert;
|
|
121
|
-
private scheduleOpenWarning;
|
|
122
|
-
private clearOpenTimer;
|
|
123
|
-
/** "Try again": close any current popup and open a fresh one, as the first opened. */
|
|
124
|
-
private retry;
|
|
125
|
-
/** Fetch branding once and drop the tenant logo into the modal header. */
|
|
126
|
-
private loadBranding;
|
|
127
|
-
private closePopup;
|
|
128
|
-
/** Explicit abort (close ✕, backdrop, Escape): close the popup and cancel. */
|
|
129
|
-
private abort;
|
|
130
|
-
private finish;
|
|
131
|
-
private finishCancel;
|
|
132
|
-
}
|
|
133
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The browser side of a sign-in with the account's own identity provider, on
|
|
3
|
-
* the Identity origin's sign-in pages: what the provider's round trip returned
|
|
4
|
-
* in the fragment, and whether this tab already left for the provider without
|
|
5
|
-
* the person's click.
|
|
6
|
-
*
|
|
7
|
-
* The Identity callback returns a sign-in the way it returns a social one
|
|
8
|
-
* (`#token=…&state=…`, completed by `IdentityModule.render`), and its two
|
|
9
|
-
* refusals as fragments of their own (app-sdk identity-signin-contract:
|
|
10
|
-
* federationRefusalFragment writes them, federationRefusalIn reads them),
|
|
11
|
-
* each with the `state` the start sent, read by `IdentityModule.render`
|
|
12
|
-
* before the flow starts:
|
|
13
|
-
* - `interaction_required`: a silent attempt the provider could not answer
|
|
14
|
-
* without the person. The page offers the account's methods, this one
|
|
15
|
-
* first, and never tries silently again.
|
|
16
|
-
* - `failed`: the attempt failed. The page says so in fixed words, never
|
|
17
|
-
* the provider's.
|
|
18
|
-
*/
|
|
19
|
-
import type { FederationRefusal } from '@sparkvault/app-sdk/identity-signin-contract';
|
|
20
|
-
/** The error view's code for a failed sign-in through the account's own identity provider. */
|
|
21
|
-
export declare const FEDERATION_FAILED = "federation_failed";
|
|
22
|
-
/** What a provider round trip this page started returned other than a sign-in. */
|
|
23
|
-
export type FederationReturn = FederationRefusal;
|
|
24
|
-
/** Record that this tab is leaving for the account's provider without the person's click. */
|
|
25
|
-
export declare function markFederationAutoStart(accountId: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Whether this tab left for this account's provider on its own within the
|
|
28
|
-
* state's lifetime. The record is removed either way: whatever it said, the
|
|
29
|
-
* page's next sign-in has read it.
|
|
30
|
-
*/
|
|
31
|
-
export declare function takeFederationAutoStart(accountId: string): boolean;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OTP Handler
|
|
3
|
-
*
|
|
4
|
-
* Single responsibility: OTP code sending and verification.
|
|
5
|
-
* Extracts OTP logic from IdentityRenderer for better separation of concerns.
|
|
6
|
-
*/
|
|
7
|
-
import { type IdentityApi } from '../api';
|
|
8
|
-
import type { VerifyResult } from '../types';
|
|
9
|
-
import type { VerificationState } from '../state';
|
|
10
|
-
/**
|
|
11
|
-
* Result of OTP send operation
|
|
12
|
-
*/
|
|
13
|
-
export interface OtpSendResult {
|
|
14
|
-
success: boolean;
|
|
15
|
-
kindling?: string;
|
|
16
|
-
expiresAt?: number;
|
|
17
|
-
error?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Machine-readable API error code (e.g. 'identity_trial_exhausted'). Set when
|
|
20
|
-
* the send-boundary gate refuses to dispatch a code because the owner's
|
|
21
|
-
* Identity access is blocked, so the renderer can show the interstitial
|
|
22
|
-
* instead of a generic "failed to send" error.
|
|
23
|
-
*/
|
|
24
|
-
errorCode?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Result of OTP verify operation
|
|
28
|
-
*/
|
|
29
|
-
export interface OtpVerifyResult {
|
|
30
|
-
success: boolean;
|
|
31
|
-
result?: VerifyResult;
|
|
32
|
-
/** New kindling if verification failed (for retry) */
|
|
33
|
-
newKindling?: string;
|
|
34
|
-
/** Seconds until retry allowed (rate limiting) */
|
|
35
|
-
retryAfter?: number;
|
|
36
|
-
/** When backoff expires (Unix timestamp) */
|
|
37
|
-
backoffExpires?: number;
|
|
38
|
-
error?: string;
|
|
39
|
-
/** Machine-readable API error code (e.g. 'identity_locked'). */
|
|
40
|
-
errorCode?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Set when the code was correct but the account has 2FA enabled: the login
|
|
43
|
-
* is not complete until a second factor is submitted against this ticket.
|
|
44
|
-
*/
|
|
45
|
-
secondFactor?: {
|
|
46
|
-
ticket: string;
|
|
47
|
-
methods: string[];
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Handles OTP code sending and verification
|
|
52
|
-
*/
|
|
53
|
-
export declare class OtpHandler {
|
|
54
|
-
private readonly api;
|
|
55
|
-
private readonly state;
|
|
56
|
-
constructor(api: IdentityApi, state: VerificationState);
|
|
57
|
-
/**
|
|
58
|
-
* Send OTP code via email, SMS, or voice
|
|
59
|
-
*/
|
|
60
|
-
send(method: 'email' | 'sms' | 'voice'): Promise<OtpSendResult>;
|
|
61
|
-
/**
|
|
62
|
-
* Resend OTP code
|
|
63
|
-
*/
|
|
64
|
-
resend(): Promise<OtpSendResult>;
|
|
65
|
-
/**
|
|
66
|
-
* Verify OTP code
|
|
67
|
-
*/
|
|
68
|
-
verify(code: string): Promise<OtpVerifyResult>;
|
|
69
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passkey Handler
|
|
3
|
-
*
|
|
4
|
-
* Handles WebAuthn passkey registration and verification via popup.
|
|
5
|
-
* Uses a popup window on sparkvault.com domain to ensure WebAuthn works
|
|
6
|
-
* correctly when the SDK is embedded on third-party client domains.
|
|
7
|
-
*
|
|
8
|
-
* Flow:
|
|
9
|
-
* 1. SDK opens popup to sparkvault.com/passkey/popup
|
|
10
|
-
* 2. Popup executes WebAuthn (origin = sparkvault.com matches RP ID)
|
|
11
|
-
* 3. Popup sends result via postMessage
|
|
12
|
-
* 4. SDK receives result and returns to caller
|
|
13
|
-
*/
|
|
14
|
-
import type { IdentityApi } from '../api';
|
|
15
|
-
import type { VerifyResult } from '../types';
|
|
16
|
-
import type { VerificationState } from '../state';
|
|
17
|
-
/**
|
|
18
|
-
* Result of passkey operation
|
|
19
|
-
*/
|
|
20
|
-
export interface PasskeyResult {
|
|
21
|
-
success: boolean;
|
|
22
|
-
result?: VerifyResult;
|
|
23
|
-
error?: string;
|
|
24
|
-
errorType?: 'cancelled' | 'not_found' | 'popup_blocked' | 'unknown';
|
|
25
|
-
/**
|
|
26
|
-
* Machine-readable API error code (e.g. 'identity_locked',
|
|
27
|
-
* 'identity_trial_exhausted'). Forwarded unchanged from the inline ceremony
|
|
28
|
-
* and the popup so the renderer can route blocked-Identity codes to the
|
|
29
|
-
* dedicated interstitial.
|
|
30
|
-
*/
|
|
31
|
-
errorCode?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Handles WebAuthn passkey registration and verification via popup
|
|
35
|
-
*/
|
|
36
|
-
export declare class PasskeyHandler {
|
|
37
|
-
private readonly api;
|
|
38
|
-
private readonly state;
|
|
39
|
-
private readonly baseUrl;
|
|
40
|
-
private readonly accountId;
|
|
41
|
-
/**
|
|
42
|
-
* Exact origin the passkey popup must postMessage from. Derived from the
|
|
43
|
-
* configured identityBaseUrl so we never accept a result from an
|
|
44
|
-
* unrelated SparkVault subdomain (XSS or subdomain-takeover relay).
|
|
45
|
-
*/
|
|
46
|
-
private readonly trustedOrigin;
|
|
47
|
-
private readonly popupLauncher;
|
|
48
|
-
constructor(api: IdentityApi, state: VerificationState);
|
|
49
|
-
/**
|
|
50
|
-
* Resolve the current identifier (email or phone) to its SVID and record on
|
|
51
|
-
* the verification state whether that SVID has any registered passkeys
|
|
52
|
-
* (null when the check fails).
|
|
53
|
-
*/
|
|
54
|
-
checkPasskey(): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Register a new passkey for the user via popup
|
|
57
|
-
*/
|
|
58
|
-
register(registrationToken?: string): Promise<PasskeyResult>;
|
|
59
|
-
/**
|
|
60
|
-
* Verify user with an existing passkey.
|
|
61
|
-
*
|
|
62
|
-
* On the Identity origin (the hosted widget / hosted login) the ceremony runs
|
|
63
|
-
* inline: same-origin with the RP id, one tap, no popup. On a third-party
|
|
64
|
-
* origin the rpId would not match the document, so it falls back to the popup
|
|
65
|
-
* served from the Identity origin. (Verification, unlike registration, is
|
|
66
|
-
* supported in cross-origin iframes, so the embedded widget uses the inline
|
|
67
|
-
* path.)
|
|
68
|
-
*/
|
|
69
|
-
verify(signal?: AbortSignal): Promise<PasskeyResult>;
|
|
70
|
-
/**
|
|
71
|
-
* True when the SDK is running ON the Identity origin and the browser exposes
|
|
72
|
-
* WebAuthn, the only place an inline ceremony's rpId matches the document.
|
|
73
|
-
*/
|
|
74
|
-
private canRunCeremonyInline;
|
|
75
|
-
/**
|
|
76
|
-
* True when the discoverable ceremony may be fired WITHOUT a user gesture:
|
|
77
|
-
* the flow is running on the Identity origin (the inline ceremony needs no
|
|
78
|
-
* popup, so no gesture) AND this browser carries the passkey-hint cookie
|
|
79
|
-
* (a passkey login has completed here before). First visits never see an
|
|
80
|
-
* unprompted system sheet.
|
|
81
|
-
*/
|
|
82
|
-
canAutoVerify(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Run the discoverable verification ceremony directly in this document and
|
|
85
|
-
* map the outcome onto the same PasskeyResult shape the popup produces.
|
|
86
|
-
* An optional AbortSignal cancels the pending system sheet (the auto-started
|
|
87
|
-
* ceremony's "Use another method" escape hatch).
|
|
88
|
-
*/
|
|
89
|
-
private verifyInline;
|
|
90
|
-
/**
|
|
91
|
-
* Map a thrown inline-ceremony error onto PasskeyResult, mirroring the
|
|
92
|
-
* popup's error codes so the widget renders the same dedicated states
|
|
93
|
-
* (cancelled, identity locked, no passkey → registration).
|
|
94
|
-
*/
|
|
95
|
-
private mapInlineCeremonyError;
|
|
96
|
-
/**
|
|
97
|
-
* Open passkey popup (top-level on the Identity origin, so WebAuthn runs
|
|
98
|
-
* same-origin with the RP id) and wait for its result.
|
|
99
|
-
*/
|
|
100
|
-
private openPasskeyPopup;
|
|
101
|
-
/**
|
|
102
|
-
* Handle popup error response
|
|
103
|
-
*/
|
|
104
|
-
private handlePopupError;
|
|
105
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SparkLink Handler
|
|
3
|
-
*
|
|
4
|
-
* Single responsibility: SparkLink sending.
|
|
5
|
-
* Verification is handled via WebSocket push (no polling, no iframe).
|
|
6
|
-
*/
|
|
7
|
-
import type { IdentityApi } from '../api';
|
|
8
|
-
import type { VerificationState } from '../state';
|
|
9
|
-
/**
|
|
10
|
-
* Result of SparkLink send operation
|
|
11
|
-
*/
|
|
12
|
-
export interface SparkLinkSendResult {
|
|
13
|
-
success: boolean;
|
|
14
|
-
expiresAt?: number;
|
|
15
|
-
/** Login-ceremony handle used to reclaim the result if the WebSocket is lost. */
|
|
16
|
-
kindling?: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
/** Machine-readable API error code (e.g. 'identity_trial_exhausted'); routes a
|
|
19
|
-
* blocked Identity to the terminal interstitial instead of a retryable error. */
|
|
20
|
-
errorCode?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Handles SparkLink sending
|
|
24
|
-
*/
|
|
25
|
-
export declare class SparkLinkHandler {
|
|
26
|
-
private readonly api;
|
|
27
|
-
private readonly state;
|
|
28
|
-
constructor(api: IdentityApi, state: VerificationState);
|
|
29
|
-
/**
|
|
30
|
-
* Send SparkLink to the user's email
|
|
31
|
-
* @param connectionId - WebSocket connectionId for push notification
|
|
32
|
-
*/
|
|
33
|
-
send(connectionId: string): Promise<SparkLinkSendResult>;
|
|
34
|
-
}
|