@sparkvault/sdk-js 16.10.1 → 16.12.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 +1 -0
- package/dist/errors.d.ts +8 -6
- package/dist/index.cjs +506 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +58 -8
- package/dist/index.mjs +506 -59
- package/dist/index.mjs.map +1 -1
- package/dist/products/identity/api.d.ts +24 -11
- package/dist/products/identity/index.d.ts +16 -8
- package/dist/products/identity/pending-signin.d.ts +19 -6
- package/dist/products/identity/renderer.d.ts +35 -4
- package/dist/products/identity/state.d.ts +5 -1
- package/dist/products/identity/types.d.ts +29 -0
- package/dist/products/identity/utils.d.ts +28 -1
- package/dist/products/identity/views/error.d.ts +12 -0
- package/dist/products/index.d.ts +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { ResolvedConfig } from '../../config';
|
|
8
8
|
import { SparkVaultApi } from '../../api-base';
|
|
9
9
|
import { SparkVaultError } from '../../errors';
|
|
10
|
-
import type { SdkConfig, OtpSendResponse, OtpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SecondFactorVerifyResponse, SparkLinkSendResponse, SparkLinkOutcome, BackupSendResponse, BackupVerifyResponse, Recommendation, RecommendationKey, AuthContext, RedeemHandoffResponse } from './types';
|
|
10
|
+
import type { SdkConfig, OtpSendResponse, OtpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SecondFactorVerifyResponse, SparkLinkSendResponse, SparkLinkOutcome, BackupSendResponse, BackupVerifyResponse, Recommendation, RecommendationKey, AuthContext, SigninIdentityType, RedeemHandoffResponse } from './types';
|
|
11
11
|
export declare class IdentityApi extends SparkVaultApi {
|
|
12
12
|
private readonly config;
|
|
13
13
|
/** Cached config promise - allows preloading and deduplication */
|
|
@@ -80,12 +80,15 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
80
80
|
*/
|
|
81
81
|
private buildAuthContextParams;
|
|
82
82
|
/**
|
|
83
|
-
* Send OTP code to email or phone
|
|
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.
|
|
84
86
|
*/
|
|
85
87
|
sendOtp(params: {
|
|
86
88
|
recipient: string;
|
|
87
89
|
method: 'email' | 'sms' | 'voice';
|
|
88
90
|
authContext?: AuthContext;
|
|
91
|
+
identityTypes?: readonly SigninIdentityType[] | null;
|
|
89
92
|
}): Promise<OtpSendResponse>;
|
|
90
93
|
/**
|
|
91
94
|
* Verify OTP code
|
|
@@ -112,9 +115,11 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
112
115
|
* optional identifier scopes the ceremony to that person's credentials
|
|
113
116
|
* (`allowCredentials`) so the authenticator offers only the matching passkey;
|
|
114
117
|
* omit it for a discoverable ceremony. Completion always routes via the
|
|
115
|
-
* credential userHandle, so scoping is purely a hint.
|
|
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.
|
|
116
121
|
*/
|
|
117
|
-
startPasskeyVerify(identity?: string, identityType?: 'email' | 'phone', authContext?: AuthContext): Promise<PasskeyChallengeResponse>;
|
|
122
|
+
startPasskeyVerify(identity?: string, identityType?: 'email' | 'phone', authContext?: AuthContext, identityTypes?: readonly SigninIdentityType[] | null): Promise<PasskeyChallengeResponse>;
|
|
118
123
|
/**
|
|
119
124
|
* Complete passkey verification
|
|
120
125
|
*/
|
|
@@ -157,9 +162,13 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
157
162
|
/**
|
|
158
163
|
* Get OAuth redirect URL for social provider. The start carries the
|
|
159
164
|
* sign-in's reference, when it has one, so the hub session the provider's
|
|
160
|
-
* answer creates or chooses records it
|
|
165
|
+
* answer creates or chooses records it, and the sign-in's restriction, which
|
|
166
|
+
* Identity records in the round trip's state.
|
|
161
167
|
*/
|
|
162
|
-
getSocialAuthUrl(provider: string, redirectUri: string, state: string, authContext?: AuthContext,
|
|
168
|
+
getSocialAuthUrl(provider: string, redirectUri: string, state: string, authContext?: AuthContext, options?: {
|
|
169
|
+
signinRef?: string | null;
|
|
170
|
+
identityTypes?: readonly SigninIdentityType[] | null;
|
|
171
|
+
}): string;
|
|
163
172
|
/**
|
|
164
173
|
* The start of a sign-in with the account's own identity provider: the same
|
|
165
174
|
* return as a social start (the page `redirectUri` names, answered with
|
|
@@ -168,19 +177,23 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
168
177
|
* showing anything. The start carries the sign-in's reference, when it has
|
|
169
178
|
* one: such a sign-in opens no hub session, so Identity releases that
|
|
170
179
|
* reference from the browser's hub sessions on its completion, and a
|
|
171
|
-
* recovery naming it mints none of them.
|
|
172
|
-
*
|
|
173
|
-
* session never
|
|
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.
|
|
174
184
|
*/
|
|
175
185
|
getFederationAuthUrl(redirectUri: string, state: string, authContext?: AuthContext, options?: {
|
|
176
186
|
silent?: boolean;
|
|
177
187
|
signinRef?: string | null;
|
|
188
|
+
identityTypes?: readonly SigninIdentityType[] | null;
|
|
178
189
|
}): string;
|
|
179
190
|
/**
|
|
180
191
|
* Send SparkLink email for identity verification.
|
|
181
|
-
* Includes connectionId for WebSocket push notification of 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.
|
|
182
195
|
*/
|
|
183
|
-
sendSparkLink(email: string, connectionId: string, authContext?: AuthContext, signinRef?: string | null): Promise<SparkLinkSendResponse>;
|
|
196
|
+
sendSparkLink(email: string, connectionId: string, authContext?: AuthContext, signinRef?: string | null, identityTypes?: readonly SigninIdentityType[] | null): Promise<SparkLinkSendResponse>;
|
|
184
197
|
/**
|
|
185
198
|
* Claim the SparkLink click's result by kindling — the WebSocket-loss
|
|
186
199
|
* fallback. The SDK calls this when its socket was suspended with the tab and
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* sv.products.identity.attach('.login-btn');
|
|
13
13
|
*/
|
|
14
14
|
import type { ResolvedConfig } from '../../config';
|
|
15
|
-
import type {
|
|
15
|
+
import type { VerifyResult, SignInOptions, SignInResult, SigninIdentityType, TokenClaims, AttachOptions, PortalUrlOptions, RedirectResultOptions, RenderOptions } from './types';
|
|
16
16
|
/**
|
|
17
17
|
* Whether `handleRedirectResult()` has anything to do on this load — a returned
|
|
18
18
|
* sign-in fragment to consume, or a pending sign-in to self-heal. Public + side
|
|
@@ -61,7 +61,11 @@ export declare class IdentityModule {
|
|
|
61
61
|
* the chooser, or the browser had no SparkVault account to offer (the
|
|
62
62
|
* browser reports both alike). Throws `IdentityProviderError`, carrying
|
|
63
63
|
* SparkVault's own error code, when SparkVault answered the sign-in with an
|
|
64
|
-
* error
|
|
64
|
+
* error (`IDENTITY_TYPE_NOT_ALLOWED` for an account of a type
|
|
65
|
+
* `identityTypes` does not name).
|
|
66
|
+
*
|
|
67
|
+
* `identityTypes` restricts the sign-in as `SignInOptions.identityTypes`
|
|
68
|
+
* does; a bad value is a ValidationError before anything is asked.
|
|
65
69
|
*
|
|
66
70
|
* @example
|
|
67
71
|
* const result = IdentityModule.isFedcmAvailable()
|
|
@@ -71,6 +75,7 @@ export declare class IdentityModule {
|
|
|
71
75
|
signInWithFedcm(options?: {
|
|
72
76
|
mediation?: 'optional' | 'required' | 'silent';
|
|
73
77
|
nonce?: string;
|
|
78
|
+
identityTypes?: SigninIdentityType[];
|
|
74
79
|
}): Promise<VerifyResult | null>;
|
|
75
80
|
/** Whether this browser exposes the FedCM API (`navigator.credentials` + IdentityCredential). */
|
|
76
81
|
static isFedcmAvailable(): boolean;
|
|
@@ -105,8 +110,10 @@ export declare class IdentityModule {
|
|
|
105
110
|
* 'redirect'` navigates the tab instead; local mode (`renderMode: 'local'` /
|
|
106
111
|
* `target`) renders into the current document and powers the
|
|
107
112
|
* SparkVault-hosted sign-in surfaces (see the internal `render`), which
|
|
108
|
-
* hands it
|
|
109
|
-
* returned
|
|
113
|
+
* hands it its restriction as its page's URL spelled it (`identityTypes`)
|
|
114
|
+
* and what a round trip to the account's own identity provider returned
|
|
115
|
+
* (`federationReturn`). The popup and the redirect carry the restriction
|
|
116
|
+
* `options.identityTypes` names, which signIn() validated.
|
|
110
117
|
*/
|
|
111
118
|
private runFlow;
|
|
112
119
|
/**
|
|
@@ -277,12 +284,13 @@ export declare class IdentityModule {
|
|
|
277
284
|
* account's own identity provider is handed to the flow it starts (see
|
|
278
285
|
* `consumeFederationReturn`).
|
|
279
286
|
*
|
|
287
|
+
* The page hands its restriction as its URL spelled it (`identityTypes`),
|
|
288
|
+
* which the flow reads here: a spelling it cannot read shows as an error.
|
|
289
|
+
*
|
|
280
290
|
* @internal Used only by the SparkVault-hosted sign-in popup and hosted login
|
|
281
291
|
* page (which own their chrome and pass `renderMode: 'local'`). Customer
|
|
282
292
|
* integrations have no inline mode — use `signIn()` / `attach()`.
|
|
283
293
|
*/
|
|
284
|
-
render(options:
|
|
285
|
-
target: string | HTMLElement;
|
|
286
|
-
}): Promise<VerifyResult>;
|
|
294
|
+
render(options: RenderOptions): Promise<VerifyResult>;
|
|
287
295
|
}
|
|
288
|
-
export type { SignInOptions, SignInResult, AttachOptions, VerifyResult, VerifyOptions, TokenClaims, } from './types';
|
|
296
|
+
export type { SignInOptions, SignInResult, SigninIdentityType, AttachOptions, VerifyResult, VerifyOptions, TokenClaims, } from './types';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* message listener but not sessionStorage) recover it on its next load, for
|
|
5
5
|
* at most SIGNIN_RECOVERY.pendingTtlMs.
|
|
6
6
|
*
|
|
7
|
-
* `sv_signin_pending` holds JSON `{ at, hint, ref }`:
|
|
7
|
+
* `sv_signin_pending` holds JSON `{ at, hint, ref, identity_types }`:
|
|
8
8
|
* - `at`: when the current popup opened, on this browser's clock; the
|
|
9
9
|
* marker's TTL.
|
|
10
10
|
* - `hint`: the email or phone the sign-in started with, or null when the
|
|
@@ -13,19 +13,27 @@
|
|
|
13
13
|
* once drawn and written; the recovery bounce names it, and `/sso` then
|
|
14
14
|
* mints only when the hub session it would mint from carries it. A marker
|
|
15
15
|
* without one bounces with no reference.
|
|
16
|
+
* - `identity_types` (SIGNIN_IDENTITY_TYPES.param): the sign-in's restriction
|
|
17
|
+
* on the identity types it may produce, in its one spelling, present only
|
|
18
|
+
* when the sign-in named one; the recovery bounce names it, so `/sso` mints
|
|
19
|
+
* only a type the sign-in accepts.
|
|
16
20
|
*/
|
|
17
21
|
/** A parsed pending marker. */
|
|
18
22
|
export interface PendingMarker {
|
|
19
23
|
at: number;
|
|
20
24
|
hint: string | null;
|
|
21
25
|
ref: string | null;
|
|
26
|
+
/** The sign-in's restriction in its one spelling, or null for none. */
|
|
27
|
+
identityTypes: string | null;
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* Read and parse the pending marker. Anything unreadable yields null: a value
|
|
25
|
-
* that is not a JSON object, an `at` that is no finite number,
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
31
|
+
* that is not a JSON object, an `at` that is no finite number, a `ref` that
|
|
32
|
+
* is present but no sign-in reference, or a restriction that is present but
|
|
33
|
+
* not in its spelling. A recovery that cannot name the reference its marker
|
|
34
|
+
* records could mint any hub session in this browser, and one that cannot
|
|
35
|
+
* name its restriction could mint a type its sign-in refuses, so such a
|
|
36
|
+
* marker recovers nothing.
|
|
29
37
|
*/
|
|
30
38
|
export declare function readPendingMarker(): PendingMarker | null;
|
|
31
39
|
/** True while a marker is within the recovery TTL. */
|
|
@@ -45,12 +53,17 @@ export declare function removePendingMarker(): void;
|
|
|
45
53
|
*/
|
|
46
54
|
export declare class PendingSignIn {
|
|
47
55
|
private readonly hint;
|
|
56
|
+
private readonly identityTypes;
|
|
48
57
|
private at;
|
|
49
58
|
private ended;
|
|
50
59
|
private opens;
|
|
51
60
|
private current;
|
|
52
61
|
private decided;
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
* @param hint - The identifier the sign-in started with, or null
|
|
64
|
+
* @param identityTypes - The sign-in's restriction in its one spelling, or null for none
|
|
65
|
+
*/
|
|
66
|
+
constructor(hint: string | null, identityTypes: string | null);
|
|
54
67
|
/**
|
|
55
68
|
* The current popup's reference: undefined while its draw is out, null
|
|
56
69
|
* when it has none (its draw failed or missed the deadline, the marker
|
|
@@ -8,6 +8,7 @@ import type { VerifyOptions, VerifyResult } from './types';
|
|
|
8
8
|
import { IdentityApi } from './api';
|
|
9
9
|
import type { Container } from './container';
|
|
10
10
|
import { type FederationReturn } from './federation-flow';
|
|
11
|
+
import { type SigninIdentityTypesRead } from './utils';
|
|
11
12
|
interface RendererCallbacks {
|
|
12
13
|
onSuccess: (result: VerifyResult) => void;
|
|
13
14
|
onError: (error: Error) => void;
|
|
@@ -42,8 +43,9 @@ export declare class IdentityRenderer {
|
|
|
42
43
|
private referenceAsks;
|
|
43
44
|
private readonly offeredWithoutReference;
|
|
44
45
|
private untouchedStep;
|
|
46
|
+
private readonly identityTypesUnreadable;
|
|
45
47
|
private statusRegion;
|
|
46
|
-
constructor(container: Container, api: IdentityApi, options: VerifyOptions, callbacks: RendererCallbacks, federationReturn?: FederationReturn | null);
|
|
48
|
+
constructor(container: Container, api: IdentityApi, options: VerifyOptions, callbacks: RendererCallbacks, federationReturn?: FederationReturn | null, identityTypes?: SigninIdentityTypesRead);
|
|
47
49
|
/**
|
|
48
50
|
* Seed the verification identity from the render options, deriving the
|
|
49
51
|
* channel (email vs phone) from the value itself rather than trusting which
|
|
@@ -247,11 +249,37 @@ export declare class IdentityRenderer {
|
|
|
247
249
|
* - the page's ask for its reference is still out: the step waits for it;
|
|
248
250
|
* - the ask found none for now: the person is told to try again, which
|
|
249
251
|
* asks again.
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
+
* A sign-in whose restriction on the identity types it may produce took
|
|
253
|
+
* away a way in it would otherwise offer is told which types it accepts and
|
|
254
|
+
* that none of the ways here gives one: only the site that asked for the
|
|
255
|
+
* restriction can change that. Any other verification with nothing to
|
|
256
|
+
* offer is a configuration fault, shown as one.
|
|
252
257
|
*/
|
|
253
258
|
private noMethodState;
|
|
259
|
+
/**
|
|
260
|
+
* The methods the sign-in's restriction admits (app-sdk
|
|
261
|
+
* signinMethodAdmitted): every method for a sign-in with none, else those
|
|
262
|
+
* that can produce a type it names.
|
|
263
|
+
*/
|
|
264
|
+
private admittedMethods;
|
|
265
|
+
/**
|
|
266
|
+
* After Identity refused a sign-in of a type the restriction does not name:
|
|
267
|
+
* the ways in for this identifier, with nothing starting on its own, or the
|
|
268
|
+
* identifier field when the person has typed none.
|
|
269
|
+
*/
|
|
270
|
+
private chooseAnotherWay;
|
|
271
|
+
/**
|
|
272
|
+
* Identity refused the sign-in for a type its restriction does not name
|
|
273
|
+
* (SIGNIN_IDENTITY_TYPES.refusalCode): show Identity's own words, which say
|
|
274
|
+
* what this sign-in accepts, and return true. False for any other code.
|
|
275
|
+
*/
|
|
276
|
+
private renderIdentityTypeRefusal;
|
|
254
277
|
private handleIdentitySubmit;
|
|
278
|
+
/**
|
|
279
|
+
* The identifier types the identifier field takes: the verification's,
|
|
280
|
+
* less any its restriction does not name, whose codes and links could only
|
|
281
|
+
* produce a sign-in it refuses.
|
|
282
|
+
*/
|
|
255
283
|
private getAllowedIdentityTypes;
|
|
256
284
|
/**
|
|
257
285
|
* @param userInitiated True when called from a live click on the picker, so
|
|
@@ -325,7 +353,10 @@ export declare class IdentityRenderer {
|
|
|
325
353
|
* when it completes in its own window.
|
|
326
354
|
*/
|
|
327
355
|
private get federationOffered();
|
|
328
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* The account's own identity provider while `/config` describes it, the
|
|
358
|
+
* verification's methods list it, and the sign-in's restriction admits it.
|
|
359
|
+
*/
|
|
329
360
|
private get accountFederation();
|
|
330
361
|
/**
|
|
331
362
|
* Whether a list of methods offers the account's own identity provider
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Easier debugging and testing
|
|
7
7
|
* - Clear data ownership
|
|
8
8
|
*/
|
|
9
|
-
import type { SdkConfig, VerifyResult, IdentityViewState, AuthContext, MethodId } from './types';
|
|
9
|
+
import type { SdkConfig, VerifyResult, IdentityViewState, AuthContext, MethodId, SigninIdentityType } from './types';
|
|
10
10
|
import type { IdentityType } from './views';
|
|
11
11
|
/**
|
|
12
12
|
* Passkey-specific state
|
|
@@ -38,6 +38,7 @@ export declare class VerificationState {
|
|
|
38
38
|
private _identityType;
|
|
39
39
|
private _authContext;
|
|
40
40
|
private _signinRef;
|
|
41
|
+
private _identityTypes;
|
|
41
42
|
private readonly _passkey;
|
|
42
43
|
private readonly _otp;
|
|
43
44
|
get sdkConfig(): SdkConfig | null;
|
|
@@ -69,6 +70,9 @@ export declare class VerificationState {
|
|
|
69
70
|
/** The reference every call that completes this sign-in carries, else null. */
|
|
70
71
|
get signinRef(): string | null;
|
|
71
72
|
setSigninRef(signinRef: string | null): void;
|
|
73
|
+
/** The restriction every call that starts a ceremony carries, else null. */
|
|
74
|
+
get identityTypes(): SigninIdentityType[] | null;
|
|
75
|
+
setIdentityTypes(identityTypes: SigninIdentityType[] | null): void;
|
|
72
76
|
get passkey(): Readonly<PasskeyState>;
|
|
73
77
|
setPasskeyStatus(hasPasskey: boolean | null): void;
|
|
74
78
|
enablePasskeyFallback(): void;
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* directory alone, never a global identity.
|
|
8
8
|
*/
|
|
9
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;
|
|
10
16
|
/**
|
|
11
17
|
* Auth context for OIDC or simple redirect flows.
|
|
12
18
|
* Used by hosted login pages to complete authorization flows.
|
|
@@ -93,6 +99,16 @@ export interface VerifyOptions {
|
|
|
93
99
|
* serialization.
|
|
94
100
|
*/
|
|
95
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[];
|
|
96
112
|
/**
|
|
97
113
|
* Rendering strategy (internal). `'local'` renders the flow directly in this
|
|
98
114
|
* document — used inside the popup that runs the flow, and forced for inline
|
|
@@ -159,6 +175,8 @@ export interface AttachOptions {
|
|
|
159
175
|
prompt?: 'select_account';
|
|
160
176
|
/** `'federation'` starts with the account's own identity provider (see `VerifyOptions.method`) */
|
|
161
177
|
method?: 'federation';
|
|
178
|
+
/** The identity types the sign-in may produce (see `VerifyOptions.identityTypes`) */
|
|
179
|
+
identityTypes?: SigninIdentityType[];
|
|
162
180
|
/** Called when user cancels */
|
|
163
181
|
onCancel?: () => void;
|
|
164
182
|
/** Called when verification completes */
|
|
@@ -216,6 +234,17 @@ export interface VerifyResult {
|
|
|
216
234
|
* sign-in surfaces.
|
|
217
235
|
*/
|
|
218
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
|
+
};
|
|
219
248
|
/** The verified identity returned by `signIn()`. */
|
|
220
249
|
export type SignInResult = VerifyResult;
|
|
221
250
|
/**
|
|
@@ -6,9 +6,36 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { CooldownTimer, ExpirationTimer } from './utils/cooldown-timer';
|
|
8
8
|
import type { ResolvedConfig } from '../../config';
|
|
9
|
-
import type { VerifyOptions } from './types';
|
|
9
|
+
import type { SigninIdentityType, VerifyOptions } from './types';
|
|
10
10
|
/** base64url of an ArrayBuffer: the shape WebAuthn and WebCrypto hand back. */
|
|
11
11
|
export declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
|
|
12
|
+
/**
|
|
13
|
+
* A sign-in's restriction on the identity types it may produce, as its flow
|
|
14
|
+
* holds it: read (`types`, null for none), or a spelling the sign-in page's
|
|
15
|
+
* URL carried that cannot be read, which the flow refuses to run under rather
|
|
16
|
+
* than run unrestricted.
|
|
17
|
+
*/
|
|
18
|
+
export type SigninIdentityTypesRead = {
|
|
19
|
+
ok: true;
|
|
20
|
+
types: SigninIdentityType[] | null;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The restriction a caller's `identityTypes` option names, in the contract's
|
|
26
|
+
* one order, or null when it names none. Synchronous, so a sign-in refuses a
|
|
27
|
+
* bad value before it opens anything.
|
|
28
|
+
*
|
|
29
|
+
* @throws {ValidationError} For a value that is no list of at least one
|
|
30
|
+
* SigninIdentityType
|
|
31
|
+
*/
|
|
32
|
+
export declare function callerIdentityTypes(identityTypes: SigninIdentityType[] | undefined): SigninIdentityType[] | null;
|
|
33
|
+
/**
|
|
34
|
+
* The restriction as the wire carries it, `{ identity_types: <spelling> }`,
|
|
35
|
+
* or nothing for none: a sign-in that names no restriction sends no field,
|
|
36
|
+
* and Identity applies none.
|
|
37
|
+
*/
|
|
38
|
+
export declare function identityTypesParam(types: readonly SigninIdentityType[] | null): Record<string, string>;
|
|
12
39
|
/**
|
|
13
40
|
* This page as a navigation return target: origin, path, and query — the query
|
|
14
41
|
* carries the page's own state (app routing, or the sign-in page's validated
|
|
@@ -32,6 +32,18 @@ export declare const FEDERATION_UNAVAILABLE_CODE = "federation_unavailable";
|
|
|
32
32
|
* a genuine error, which the person's Try Again asks for again.
|
|
33
33
|
*/
|
|
34
34
|
export declare const SIGNIN_REFERENCE_UNAVAILABLE_CODE = "signin_reference_unavailable";
|
|
35
|
+
/**
|
|
36
|
+
* The code of a sign-in whose restriction on the identity types it may
|
|
37
|
+
* produce (SignInOptions.identityTypes) admits none of the account's ways in:
|
|
38
|
+
* only the site that asked for the restriction can change that.
|
|
39
|
+
*/
|
|
40
|
+
export declare const IDENTITY_TYPES_UNAVAILABLE_CODE = "identity_types_unavailable";
|
|
41
|
+
/**
|
|
42
|
+
* The code of a sign-in page whose URL names a restriction it cannot read:
|
|
43
|
+
* the page runs no sign-in under it rather than one wider than the site
|
|
44
|
+
* asked for, and only a sign-in the site opens afresh clears it.
|
|
45
|
+
*/
|
|
46
|
+
export declare const IDENTITY_TYPES_UNREADABLE_CODE = "identity_types_unreadable";
|
|
35
47
|
export interface ErrorViewProps {
|
|
36
48
|
message: string;
|
|
37
49
|
code: string;
|
package/dist/products/index.d.ts
CHANGED
|
@@ -46,6 +46,6 @@ export type * from './help-desk/form-types';
|
|
|
46
46
|
export type * from './help-desk/support-types';
|
|
47
47
|
export type { HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentitySession } from './help-desk/widget-identity';
|
|
48
48
|
export type { HelpDeskMountFormOptions, HelpDeskOpenFormOptions } from './help-desk';
|
|
49
|
-
export type { SignInOptions, SignInResult, VerifyOptions, AttachOptions, VerifyResult, TokenClaims, } from './identity';
|
|
49
|
+
export type { SignInOptions, SignInResult, SigninIdentityType, VerifyOptions, AttachOptions, VerifyResult, TokenClaims, } from './identity';
|
|
50
50
|
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifyRecipientState, NotifySuppressionReason, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReportableVerificationLevel, NotifyReceiptEventType, NotifySendReceipt, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigHistory, NotifyConfigSecurity, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigPatch, NotifyConfigOverrides, NotifyConfigResponse, NotifyDestinationKind, NotifyDestinationState, NotifyDestinationSkipReason, NotifyDestinationFailureReason, NotifyDestinationReason, NotifyDestinationTransportReason, NotifyConfigRefusalReason, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifySlackDestinationRead, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './notify';
|
|
51
51
|
export type * from './notify/project-types';
|