@passflow/core 0.48.1 → 0.49.1
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 +51 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -20
- package/dist/index.d.ts +106 -20
- package/dist/index.mjs +335 -250
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -967,14 +967,15 @@ export declare const recoveryCodesFactor: UpgradeFactor;
|
|
|
967
967
|
* challenge id that binds it to this session.
|
|
968
968
|
*/
|
|
969
969
|
export declare const passkeyFactor: UpgradeFactor;
|
|
970
|
+
/** A code sent by email. */
|
|
971
|
+
export declare const emailOtpFactor: UpgradeFactor;
|
|
972
|
+
/** A code sent by text message. Texts cost money, so it sorts after email. */
|
|
973
|
+
export declare const smsOtpFactor: UpgradeFactor;
|
|
970
974
|
/**
|
|
971
|
-
* The factors this SDK can
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
975
|
-
* enrol them and `upgradeMethodRegistered` refuses the prepare round. Adding
|
|
976
|
-
* them later is one entry here plus a factor whose assert returns
|
|
977
|
-
* `{ challenge_id, code }` — no change to anything that consumes this registry.
|
|
975
|
+
* The factors this SDK can complete, in its default order: TOTP, passkey, an
|
|
976
|
+
* emailed code, a texted code, then recovery codes. The server sends emailed and
|
|
977
|
+
* texted codes at sign-in and at step-up. When the step-up answer lists
|
|
978
|
+
* `available_factors`, that list and its order decide what is offered.
|
|
978
979
|
*/
|
|
979
980
|
export declare const DEFAULT_UPGRADE_FACTORS: readonly UpgradeFactor[];
|
|
980
981
|
/** Indexes a factor list by type for lookup during a challenge. */
|
|
@@ -2207,7 +2208,10 @@ export type PassflowSessionDevice = {
|
|
|
2207
2208
|
user_agent?: string;
|
|
2208
2209
|
ip?: string;
|
|
2209
2210
|
location?: string;
|
|
2210
|
-
/**
|
|
2211
|
+
/**
|
|
2212
|
+
* RFC 3339 time of the last request from this device. The server reads it from the device, so
|
|
2213
|
+
* every session of the same device shows the same time.
|
|
2214
|
+
*/
|
|
2211
2215
|
last_seen?: string;
|
|
2212
2216
|
};
|
|
2213
2217
|
/** One signed-in session of the current user. */
|
|
@@ -2254,22 +2258,30 @@ export type PassflowInvitePayload = {
|
|
|
2254
2258
|
invite_token: string;
|
|
2255
2259
|
scopes: string[];
|
|
2256
2260
|
};
|
|
2261
|
+
/**
|
|
2262
|
+
* One member of a tenant group, as listed in `PassflowTenantResponse.users_in_groups`:
|
|
2263
|
+
* the user's profile fields plus the roles the user holds in that group.
|
|
2264
|
+
*/
|
|
2257
2265
|
export type PassflowUserWithRoles = {
|
|
2258
|
-
|
|
2259
|
-
username
|
|
2260
|
-
email
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
group_id: string;
|
|
2264
|
-
role_id: string;
|
|
2266
|
+
id: string;
|
|
2267
|
+
username?: string;
|
|
2268
|
+
email?: string;
|
|
2269
|
+
/** Always present; an empty string when the user has no phone number. */
|
|
2270
|
+
phone?: string;
|
|
2265
2271
|
preferred_username?: string;
|
|
2266
2272
|
given_name?: string;
|
|
2273
|
+
middle_name?: string;
|
|
2267
2274
|
family_name?: string;
|
|
2268
2275
|
nickname?: string;
|
|
2269
2276
|
picture?: string;
|
|
2270
|
-
|
|
2277
|
+
email_verified?: boolean;
|
|
2278
|
+
phone_verified?: boolean;
|
|
2279
|
+
/** Maps role id to role name. Absent when the user has no role in the group. */
|
|
2280
|
+
roles?: {
|
|
2271
2281
|
[role_id: string]: string;
|
|
2272
2282
|
};
|
|
2283
|
+
/** How the user entered the tenant, e.g. `owner`, `invite`, `auto_join`. Absent for older memberships. */
|
|
2284
|
+
joined_via?: string;
|
|
2273
2285
|
};
|
|
2274
2286
|
export type PassflowGroup = {
|
|
2275
2287
|
id: string;
|
|
@@ -2286,12 +2298,14 @@ export type PassflowRole = {
|
|
|
2286
2298
|
export type PassflowTenantResponse = {
|
|
2287
2299
|
tenant_id: string;
|
|
2288
2300
|
tenant_name: string;
|
|
2289
|
-
|
|
2301
|
+
/** Maps group id to the members of that group. Absent when the tenant has no members. */
|
|
2302
|
+
users_in_groups?: Record<string, PassflowUserWithRoles[]>;
|
|
2290
2303
|
groups?: PassflowGroup[];
|
|
2291
2304
|
roles?: PassflowRole[];
|
|
2292
2305
|
};
|
|
2293
2306
|
/**
|
|
2294
|
-
*
|
|
2307
|
+
* @deprecated The server never sends this shape: `users_in_groups` maps a group id to
|
|
2308
|
+
* `PassflowUserWithRoles[]`.
|
|
2295
2309
|
*/
|
|
2296
2310
|
export type PassflowUserInGroup = {
|
|
2297
2311
|
user: {
|
|
@@ -3877,6 +3891,8 @@ export declare class TwoFactorApiClient {
|
|
|
3877
3891
|
export type UpgradeStartPayload = {
|
|
3878
3892
|
method: string;
|
|
3879
3893
|
relying_party_id?: string;
|
|
3894
|
+
/** Asks for a new code (or push request) in place of the live one. */
|
|
3895
|
+
resend?: boolean;
|
|
3880
3896
|
};
|
|
3881
3897
|
export declare class UpgradeAPI {
|
|
3882
3898
|
protected axiosClient: AxiosClient;
|
|
@@ -5407,6 +5423,7 @@ export declare class InvitationService {
|
|
|
5407
5423
|
*/
|
|
5408
5424
|
export interface User {
|
|
5409
5425
|
id: string;
|
|
5426
|
+
/** Display name: preferred username, else given and family name, else nickname, else username. */
|
|
5410
5427
|
name: string | null;
|
|
5411
5428
|
email: string | null;
|
|
5412
5429
|
phone: string | null;
|
|
@@ -6179,6 +6196,42 @@ type UpgradePromptRequest = {
|
|
|
6179
6196
|
* no longer read. A prompt subscribes the same way as to `onRequirementRaised`.
|
|
6180
6197
|
*/
|
|
6181
6198
|
onClosed?: () => void;
|
|
6199
|
+
/**
|
|
6200
|
+
* Where the last code went, when the flight holds a sent code for an emailed
|
|
6201
|
+
* or texted factor. Set on a re-shown prompt, so it can keep saying "code sent
|
|
6202
|
+
* to j***@e***.com" after a wrong code.
|
|
6203
|
+
*/
|
|
6204
|
+
codeSent?: UpgradeCodeSent;
|
|
6205
|
+
/**
|
|
6206
|
+
* Called each time the server answers a code request: when the user picks an
|
|
6207
|
+
* emailed or texted factor, on `resend`, and when the server says the held
|
|
6208
|
+
* challenge is spent or expired. A prompt subscribes the same way as to
|
|
6209
|
+
* `onRequirementRaised`.
|
|
6210
|
+
*/
|
|
6211
|
+
onCodeSent?: (sent: UpgradeCodeSent) => void;
|
|
6212
|
+
/**
|
|
6213
|
+
* Asks the server for a new code for an emailed or texted factor, and resolves
|
|
6214
|
+
* with its answer, which the next submit uses. `resent` tells whether a new code
|
|
6215
|
+
* went out: a server that keeps the live code answers with it again and sends
|
|
6216
|
+
* nothing. Rejects for a factor that sends no code, once this prompt's step-up
|
|
6217
|
+
* has ended, and with the transport's error when the request fails; the code
|
|
6218
|
+
* held before then still works.
|
|
6219
|
+
*/
|
|
6220
|
+
resend: (factor: UpgradeFactorType) => Promise<UpgradeCodeSent>;
|
|
6221
|
+
};
|
|
6222
|
+
/** The server's answer to a code request for an emailed or texted factor. */
|
|
6223
|
+
type UpgradeCodeSent = {
|
|
6224
|
+
factor: UpgradeFactorType;
|
|
6225
|
+
/** Masked address the code went to, e.g. `j***@e***.com`. */
|
|
6226
|
+
codeSentTo?: string;
|
|
6227
|
+
/** RFC 3339 time the code stops working. */
|
|
6228
|
+
expiresAt: string;
|
|
6229
|
+
/**
|
|
6230
|
+
* True when this answer is a new code in place of one this step-up already
|
|
6231
|
+
* held. False on the first code, and when the server answered with the live
|
|
6232
|
+
* code again: the code already sent is still the one to type.
|
|
6233
|
+
*/
|
|
6234
|
+
resent: boolean;
|
|
6182
6235
|
};
|
|
6183
6236
|
/** The user's answer to an upgrade prompt. */
|
|
6184
6237
|
type UpgradePromptResult = {
|
|
@@ -6201,7 +6254,9 @@ type UpgradeTransport = {
|
|
|
6201
6254
|
* the factor differs from ours. Both are recoveries: the factor then asserts
|
|
6202
6255
|
* with no `prepared`, which is already the TOTP path.
|
|
6203
6256
|
*/
|
|
6204
|
-
prepare(method: UpgradeFactorType
|
|
6257
|
+
prepare(method: UpgradeFactorType, options?: {
|
|
6258
|
+
resend?: boolean;
|
|
6259
|
+
}): Promise<UpgradePrepared | undefined>;
|
|
6205
6260
|
/** `POST /auth/refresh` carrying `upgrade`. Resolves once elevated tokens are stored. */
|
|
6206
6261
|
commit(factor: UpgradeFactorType, assertion: UpgradeAssertion): Promise<void>;
|
|
6207
6262
|
};
|
|
@@ -6391,6 +6446,16 @@ export declare class UpgradeController {
|
|
|
6391
6446
|
private pruned;
|
|
6392
6447
|
/** The request handed to the open prompt. Its `onRequirementRaised` slot is branch 2's channel. */
|
|
6393
6448
|
private openPrompt;
|
|
6449
|
+
/**
|
|
6450
|
+
* The challenge of the code last sent for an emailed or texted factor. The next
|
|
6451
|
+
* submit for that factor uses it, so a wrong code is answered again on the same
|
|
6452
|
+
* challenge instead of sending a new code.
|
|
6453
|
+
*/
|
|
6454
|
+
private heldCode;
|
|
6455
|
+
/** Where the held code went, once its send has succeeded. */
|
|
6456
|
+
private codeSent;
|
|
6457
|
+
/** The challenge id of `codeSent`, to tell a new code from the live one answered again. */
|
|
6458
|
+
private codeSentChallenge;
|
|
6394
6459
|
/** Set while `awaitReports` is waiting; called by the reporting path. See H7. */
|
|
6395
6460
|
private reportsSettled?;
|
|
6396
6461
|
constructor(options: UpgradeControllerOptions);
|
|
@@ -6488,6 +6553,9 @@ export declare class UpgradeController {
|
|
|
6488
6553
|
* is single-use and the server consumes it atomically, so a failed attempt has
|
|
6489
6554
|
* already spent it. Reusing the id would fail with
|
|
6490
6555
|
* `ErrorUpgradeChallengeInvalid` and look like a bad code to the user.
|
|
6556
|
+
*
|
|
6557
|
+
* Emailed and texted codes are the exception: the server gives one code several
|
|
6558
|
+
* tries, so their challenge is held across attempts (see `proveSentCode`).
|
|
6491
6559
|
*/
|
|
6492
6560
|
private prove;
|
|
6493
6561
|
/** Opens (or re-opens) the prompt and wires the two prompt → controller edges. */
|
|
@@ -6496,6 +6564,24 @@ export declare class UpgradeController {
|
|
|
6496
6564
|
private classifyProofFailure;
|
|
6497
6565
|
/** Runs one full proof for a single factor. */
|
|
6498
6566
|
private proveAndCommit;
|
|
6567
|
+
/**
|
|
6568
|
+
* Proves an emailed or texted code against the held challenge.
|
|
6569
|
+
*
|
|
6570
|
+
* The server gives one code several tries, so a wrong code keeps the challenge
|
|
6571
|
+
* and the user answers again. A new code goes out only on `resend`, or here when
|
|
6572
|
+
* the server says the challenge is spent or expired. A prompt that never called
|
|
6573
|
+
* `onFactorSelected` reaches this with no code sent: the send happens now, the
|
|
6574
|
+
* empty answer fails, and the re-shown prompt takes the code.
|
|
6575
|
+
*/
|
|
6576
|
+
private proveSentCode;
|
|
6577
|
+
/**
|
|
6578
|
+
* Asks for a code for an emailed or texted factor and holds its challenge.
|
|
6579
|
+
*
|
|
6580
|
+
* A refused `resend` puts the previous hold back, so the code the user already
|
|
6581
|
+
* has still works. Any other failed send stays held as a rejection until the
|
|
6582
|
+
* submit reports it.
|
|
6583
|
+
*/
|
|
6584
|
+
private sendCode;
|
|
6499
6585
|
}
|
|
6500
6586
|
/** "You were challenged and you declined" — as opposed to "you were not authorised". */
|
|
6501
6587
|
export declare const isUpgradeCancelled: (response: object) => boolean;
|
|
@@ -8784,4 +8870,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8784
8870
|
* @returns true if valid username format, false otherwise
|
|
8785
8871
|
*/
|
|
8786
8872
|
export declare function isValidUsername(username: string): boolean;
|
|
8787
|
-
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, IdentityCredentialRequest, IdentityCredentialSupport, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, NativeSignInErrorReason, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, RiskIdContext, RiskIdOperation, RiskIdProvider, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
|
|
8873
|
+
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, IdentityCredentialRequest, IdentityCredentialSupport, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, NativeSignInErrorReason, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, RiskIdContext, RiskIdOperation, RiskIdProvider, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCodeSent, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -967,14 +967,15 @@ export declare const recoveryCodesFactor: UpgradeFactor;
|
|
|
967
967
|
* challenge id that binds it to this session.
|
|
968
968
|
*/
|
|
969
969
|
export declare const passkeyFactor: UpgradeFactor;
|
|
970
|
+
/** A code sent by email. */
|
|
971
|
+
export declare const emailOtpFactor: UpgradeFactor;
|
|
972
|
+
/** A code sent by text message. Texts cost money, so it sorts after email. */
|
|
973
|
+
export declare const smsOtpFactor: UpgradeFactor;
|
|
970
974
|
/**
|
|
971
|
-
* The factors this SDK can
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
975
|
-
* enrol them and `upgradeMethodRegistered` refuses the prepare round. Adding
|
|
976
|
-
* them later is one entry here plus a factor whose assert returns
|
|
977
|
-
* `{ challenge_id, code }` — no change to anything that consumes this registry.
|
|
975
|
+
* The factors this SDK can complete, in its default order: TOTP, passkey, an
|
|
976
|
+
* emailed code, a texted code, then recovery codes. The server sends emailed and
|
|
977
|
+
* texted codes at sign-in and at step-up. When the step-up answer lists
|
|
978
|
+
* `available_factors`, that list and its order decide what is offered.
|
|
978
979
|
*/
|
|
979
980
|
export declare const DEFAULT_UPGRADE_FACTORS: readonly UpgradeFactor[];
|
|
980
981
|
/** Indexes a factor list by type for lookup during a challenge. */
|
|
@@ -2207,7 +2208,10 @@ export type PassflowSessionDevice = {
|
|
|
2207
2208
|
user_agent?: string;
|
|
2208
2209
|
ip?: string;
|
|
2209
2210
|
location?: string;
|
|
2210
|
-
/**
|
|
2211
|
+
/**
|
|
2212
|
+
* RFC 3339 time of the last request from this device. The server reads it from the device, so
|
|
2213
|
+
* every session of the same device shows the same time.
|
|
2214
|
+
*/
|
|
2211
2215
|
last_seen?: string;
|
|
2212
2216
|
};
|
|
2213
2217
|
/** One signed-in session of the current user. */
|
|
@@ -2254,22 +2258,30 @@ export type PassflowInvitePayload = {
|
|
|
2254
2258
|
invite_token: string;
|
|
2255
2259
|
scopes: string[];
|
|
2256
2260
|
};
|
|
2261
|
+
/**
|
|
2262
|
+
* One member of a tenant group, as listed in `PassflowTenantResponse.users_in_groups`:
|
|
2263
|
+
* the user's profile fields plus the roles the user holds in that group.
|
|
2264
|
+
*/
|
|
2257
2265
|
export type PassflowUserWithRoles = {
|
|
2258
|
-
|
|
2259
|
-
username
|
|
2260
|
-
email
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
group_id: string;
|
|
2264
|
-
role_id: string;
|
|
2266
|
+
id: string;
|
|
2267
|
+
username?: string;
|
|
2268
|
+
email?: string;
|
|
2269
|
+
/** Always present; an empty string when the user has no phone number. */
|
|
2270
|
+
phone?: string;
|
|
2265
2271
|
preferred_username?: string;
|
|
2266
2272
|
given_name?: string;
|
|
2273
|
+
middle_name?: string;
|
|
2267
2274
|
family_name?: string;
|
|
2268
2275
|
nickname?: string;
|
|
2269
2276
|
picture?: string;
|
|
2270
|
-
|
|
2277
|
+
email_verified?: boolean;
|
|
2278
|
+
phone_verified?: boolean;
|
|
2279
|
+
/** Maps role id to role name. Absent when the user has no role in the group. */
|
|
2280
|
+
roles?: {
|
|
2271
2281
|
[role_id: string]: string;
|
|
2272
2282
|
};
|
|
2283
|
+
/** How the user entered the tenant, e.g. `owner`, `invite`, `auto_join`. Absent for older memberships. */
|
|
2284
|
+
joined_via?: string;
|
|
2273
2285
|
};
|
|
2274
2286
|
export type PassflowGroup = {
|
|
2275
2287
|
id: string;
|
|
@@ -2286,12 +2298,14 @@ export type PassflowRole = {
|
|
|
2286
2298
|
export type PassflowTenantResponse = {
|
|
2287
2299
|
tenant_id: string;
|
|
2288
2300
|
tenant_name: string;
|
|
2289
|
-
|
|
2301
|
+
/** Maps group id to the members of that group. Absent when the tenant has no members. */
|
|
2302
|
+
users_in_groups?: Record<string, PassflowUserWithRoles[]>;
|
|
2290
2303
|
groups?: PassflowGroup[];
|
|
2291
2304
|
roles?: PassflowRole[];
|
|
2292
2305
|
};
|
|
2293
2306
|
/**
|
|
2294
|
-
*
|
|
2307
|
+
* @deprecated The server never sends this shape: `users_in_groups` maps a group id to
|
|
2308
|
+
* `PassflowUserWithRoles[]`.
|
|
2295
2309
|
*/
|
|
2296
2310
|
export type PassflowUserInGroup = {
|
|
2297
2311
|
user: {
|
|
@@ -3877,6 +3891,8 @@ export declare class TwoFactorApiClient {
|
|
|
3877
3891
|
export type UpgradeStartPayload = {
|
|
3878
3892
|
method: string;
|
|
3879
3893
|
relying_party_id?: string;
|
|
3894
|
+
/** Asks for a new code (or push request) in place of the live one. */
|
|
3895
|
+
resend?: boolean;
|
|
3880
3896
|
};
|
|
3881
3897
|
export declare class UpgradeAPI {
|
|
3882
3898
|
protected axiosClient: AxiosClient;
|
|
@@ -5407,6 +5423,7 @@ export declare class InvitationService {
|
|
|
5407
5423
|
*/
|
|
5408
5424
|
export interface User {
|
|
5409
5425
|
id: string;
|
|
5426
|
+
/** Display name: preferred username, else given and family name, else nickname, else username. */
|
|
5410
5427
|
name: string | null;
|
|
5411
5428
|
email: string | null;
|
|
5412
5429
|
phone: string | null;
|
|
@@ -6179,6 +6196,42 @@ type UpgradePromptRequest = {
|
|
|
6179
6196
|
* no longer read. A prompt subscribes the same way as to `onRequirementRaised`.
|
|
6180
6197
|
*/
|
|
6181
6198
|
onClosed?: () => void;
|
|
6199
|
+
/**
|
|
6200
|
+
* Where the last code went, when the flight holds a sent code for an emailed
|
|
6201
|
+
* or texted factor. Set on a re-shown prompt, so it can keep saying "code sent
|
|
6202
|
+
* to j***@e***.com" after a wrong code.
|
|
6203
|
+
*/
|
|
6204
|
+
codeSent?: UpgradeCodeSent;
|
|
6205
|
+
/**
|
|
6206
|
+
* Called each time the server answers a code request: when the user picks an
|
|
6207
|
+
* emailed or texted factor, on `resend`, and when the server says the held
|
|
6208
|
+
* challenge is spent or expired. A prompt subscribes the same way as to
|
|
6209
|
+
* `onRequirementRaised`.
|
|
6210
|
+
*/
|
|
6211
|
+
onCodeSent?: (sent: UpgradeCodeSent) => void;
|
|
6212
|
+
/**
|
|
6213
|
+
* Asks the server for a new code for an emailed or texted factor, and resolves
|
|
6214
|
+
* with its answer, which the next submit uses. `resent` tells whether a new code
|
|
6215
|
+
* went out: a server that keeps the live code answers with it again and sends
|
|
6216
|
+
* nothing. Rejects for a factor that sends no code, once this prompt's step-up
|
|
6217
|
+
* has ended, and with the transport's error when the request fails; the code
|
|
6218
|
+
* held before then still works.
|
|
6219
|
+
*/
|
|
6220
|
+
resend: (factor: UpgradeFactorType) => Promise<UpgradeCodeSent>;
|
|
6221
|
+
};
|
|
6222
|
+
/** The server's answer to a code request for an emailed or texted factor. */
|
|
6223
|
+
type UpgradeCodeSent = {
|
|
6224
|
+
factor: UpgradeFactorType;
|
|
6225
|
+
/** Masked address the code went to, e.g. `j***@e***.com`. */
|
|
6226
|
+
codeSentTo?: string;
|
|
6227
|
+
/** RFC 3339 time the code stops working. */
|
|
6228
|
+
expiresAt: string;
|
|
6229
|
+
/**
|
|
6230
|
+
* True when this answer is a new code in place of one this step-up already
|
|
6231
|
+
* held. False on the first code, and when the server answered with the live
|
|
6232
|
+
* code again: the code already sent is still the one to type.
|
|
6233
|
+
*/
|
|
6234
|
+
resent: boolean;
|
|
6182
6235
|
};
|
|
6183
6236
|
/** The user's answer to an upgrade prompt. */
|
|
6184
6237
|
type UpgradePromptResult = {
|
|
@@ -6201,7 +6254,9 @@ type UpgradeTransport = {
|
|
|
6201
6254
|
* the factor differs from ours. Both are recoveries: the factor then asserts
|
|
6202
6255
|
* with no `prepared`, which is already the TOTP path.
|
|
6203
6256
|
*/
|
|
6204
|
-
prepare(method: UpgradeFactorType
|
|
6257
|
+
prepare(method: UpgradeFactorType, options?: {
|
|
6258
|
+
resend?: boolean;
|
|
6259
|
+
}): Promise<UpgradePrepared | undefined>;
|
|
6205
6260
|
/** `POST /auth/refresh` carrying `upgrade`. Resolves once elevated tokens are stored. */
|
|
6206
6261
|
commit(factor: UpgradeFactorType, assertion: UpgradeAssertion): Promise<void>;
|
|
6207
6262
|
};
|
|
@@ -6391,6 +6446,16 @@ export declare class UpgradeController {
|
|
|
6391
6446
|
private pruned;
|
|
6392
6447
|
/** The request handed to the open prompt. Its `onRequirementRaised` slot is branch 2's channel. */
|
|
6393
6448
|
private openPrompt;
|
|
6449
|
+
/**
|
|
6450
|
+
* The challenge of the code last sent for an emailed or texted factor. The next
|
|
6451
|
+
* submit for that factor uses it, so a wrong code is answered again on the same
|
|
6452
|
+
* challenge instead of sending a new code.
|
|
6453
|
+
*/
|
|
6454
|
+
private heldCode;
|
|
6455
|
+
/** Where the held code went, once its send has succeeded. */
|
|
6456
|
+
private codeSent;
|
|
6457
|
+
/** The challenge id of `codeSent`, to tell a new code from the live one answered again. */
|
|
6458
|
+
private codeSentChallenge;
|
|
6394
6459
|
/** Set while `awaitReports` is waiting; called by the reporting path. See H7. */
|
|
6395
6460
|
private reportsSettled?;
|
|
6396
6461
|
constructor(options: UpgradeControllerOptions);
|
|
@@ -6488,6 +6553,9 @@ export declare class UpgradeController {
|
|
|
6488
6553
|
* is single-use and the server consumes it atomically, so a failed attempt has
|
|
6489
6554
|
* already spent it. Reusing the id would fail with
|
|
6490
6555
|
* `ErrorUpgradeChallengeInvalid` and look like a bad code to the user.
|
|
6556
|
+
*
|
|
6557
|
+
* Emailed and texted codes are the exception: the server gives one code several
|
|
6558
|
+
* tries, so their challenge is held across attempts (see `proveSentCode`).
|
|
6491
6559
|
*/
|
|
6492
6560
|
private prove;
|
|
6493
6561
|
/** Opens (or re-opens) the prompt and wires the two prompt → controller edges. */
|
|
@@ -6496,6 +6564,24 @@ export declare class UpgradeController {
|
|
|
6496
6564
|
private classifyProofFailure;
|
|
6497
6565
|
/** Runs one full proof for a single factor. */
|
|
6498
6566
|
private proveAndCommit;
|
|
6567
|
+
/**
|
|
6568
|
+
* Proves an emailed or texted code against the held challenge.
|
|
6569
|
+
*
|
|
6570
|
+
* The server gives one code several tries, so a wrong code keeps the challenge
|
|
6571
|
+
* and the user answers again. A new code goes out only on `resend`, or here when
|
|
6572
|
+
* the server says the challenge is spent or expired. A prompt that never called
|
|
6573
|
+
* `onFactorSelected` reaches this with no code sent: the send happens now, the
|
|
6574
|
+
* empty answer fails, and the re-shown prompt takes the code.
|
|
6575
|
+
*/
|
|
6576
|
+
private proveSentCode;
|
|
6577
|
+
/**
|
|
6578
|
+
* Asks for a code for an emailed or texted factor and holds its challenge.
|
|
6579
|
+
*
|
|
6580
|
+
* A refused `resend` puts the previous hold back, so the code the user already
|
|
6581
|
+
* has still works. Any other failed send stays held as a rejection until the
|
|
6582
|
+
* submit reports it.
|
|
6583
|
+
*/
|
|
6584
|
+
private sendCode;
|
|
6499
6585
|
}
|
|
6500
6586
|
/** "You were challenged and you declined" — as opposed to "you were not authorised". */
|
|
6501
6587
|
export declare const isUpgradeCancelled: (response: object) => boolean;
|
|
@@ -8784,4 +8870,4 @@ export declare function isValidPhoneNumber(phone: string): boolean;
|
|
|
8784
8870
|
* @returns true if valid username format, false otherwise
|
|
8785
8871
|
*/
|
|
8786
8872
|
export declare function isValidUsername(username: string): boolean;
|
|
8787
|
-
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, IdentityCredentialRequest, IdentityCredentialSupport, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, NativeSignInErrorReason, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, RiskIdContext, RiskIdOperation, RiskIdProvider, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
|
|
8873
|
+
export type { AntiBotAppSettings, AntiBotDeviceContext, AntiBotOperation, AntiBotTokenContext, AntiBotTokenProvider, AntiBotTokenRequest, AssuranceBar, AuthCallbackResult, BodyKind, ChallengeChannel, CreateClientConfig, CurrentUrlInfo, DeviceProofUse, DevicePushProofUse, ErrorPayload, EventOrigin, FetchLike, FetchMiddleware, GroupMembership, IdentityCredentialRequest, IdentityCredentialSupport, InvitationToken, M2MClientConfig, M2MErrorCode, M2MErrorResponse, M2MRateLimitInfo, M2MTokenCache, M2MTokenClaims, M2MTokenRequestInfo, M2MTokenRequestOptions, M2MTokenResponse, NativeSignInErrorReason, OidcErrorCode, OpenAuthUrlOptions, OperationErrorPayload, PassflowEmailVerificationOperation, PassflowEventPayload, PassflowOperation, PassflowRefreshErrorOptions, PassflowSubscriber, PasskeySupport, PlatformAdapter, PlatformStorage, RawUserMembership, RefreshChannel, RefreshClock, RefreshCoordination, RefreshCoordinator, RefreshErrorInfo, RefreshFailureKind, RefreshLockManager, RefreshLockOptions, RefreshTrigger, RegisterOptions, ReplayPolicy, RequestSnapshot, ResponseInterceptorHost, RetryStrategy, RiskIdContext, RiskIdOperation, RiskIdProvider, SessionExpiredReason, SnapshotHeader, Tenant, TenantMembership, Token, UpgradeAssertContext, UpgradeAssertion, UpgradeChallenge, UpgradeCodeSent, UpgradeCommitInterruptedReason, UpgradeControllerOptions, UpgradeDiagnostic, UpgradeDiagnosticReason, UpgradeDiagnosticSink, UpgradeElevation, UpgradeEnableOptions, UpgradeEndpoint, UpgradeErrorKind, UpgradeFacade, UpgradeFactor, UpgradeFactorInput, UpgradeFactorType, UpgradeFlightState, UpgradeFlightSummary, UpgradeOptions, UpgradePrepared, UpgradePromptHandler, UpgradePromptRequest, UpgradePromptResult, UpgradeProof, UpgradeReplayInfo, UpgradeResult, UpgradeSessionPin, UpgradeTransport, UpgradeTransportErrorInit, UpgradeWaiterSummary, UserMembership, Waiter, WaiterEntry, WaiterOutcome, WaiterReport, WithAuthOptions };
|