@idp.global/interfaces 30.3.0 → 30.5.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/changelog.md +46 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/activity.d.ts +5 -3
- package/dist_ts/data/activity.js +8 -2
- package/dist_ts/data/index.d.ts +1 -0
- package/dist_ts/data/index.js +2 -1
- package/dist_ts/data/loginsession.d.ts +19 -1
- package/dist_ts/data/loginsession.js +24 -2
- package/dist_ts/data/mfa.d.ts +4 -1
- package/dist_ts/data/mfa.js +8 -2
- package/dist_ts/data/oidc.d.ts +8 -0
- package/dist_ts/data/upstreamidentity.d.ts +42 -0
- package/dist_ts/data/upstreamidentity.js +15 -0
- package/dist_ts/data/user.d.ts +4 -2
- package/dist_ts/data/user.js +6 -2
- package/dist_ts/dto/activity.d.ts +6 -1
- package/dist_ts/dto/index.d.ts +1 -0
- package/dist_ts/dto/index.js +2 -1
- package/dist_ts/dto/upstreamidentity.d.ts +15 -0
- package/dist_ts/dto/upstreamidentity.js +2 -0
- package/dist_ts/request/authorization.d.ts +3 -1
- package/dist_ts/request/authorization.js +1 -1
- package/dist_ts/request/index.d.ts +1 -0
- package/dist_ts/request/index.js +2 -1
- package/dist_ts/request/upstreamidentity.d.ts +146 -0
- package/dist_ts/request/upstreamidentity.js +4 -0
- package/package.json +1 -1
- package/readme.md +77 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/activity.ts +15 -3
- package/ts/data/index.ts +1 -0
- package/ts/data/loginsession.ts +34 -4
- package/ts/data/mfa.ts +12 -1
- package/ts/data/oidc.ts +9 -0
- package/ts/data/upstreamidentity.ts +52 -0
- package/ts/data/user.ts +5 -1
- package/ts/dto/activity.ts +12 -1
- package/ts/dto/index.ts +1 -0
- package/ts/dto/upstreamidentity.ts +16 -0
- package/ts/readme.md +4 -1
- package/ts/request/authorization.ts +7 -1
- package/ts/request/index.ts +1 -0
- package/ts/request/upstreamidentity.ts +176 -0
package/changelog.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-11-13 - 30.5.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- the purpose of an upstream flow and the authentication-change gate's refusal data (data, request; AGL-1801)
|
|
8
|
+
- `upstreamSignInPurposes` (`sign-in`, `link`) and `TUpstreamSignInPurpose`. `IReq_StartUpstreamSignIn` takes
|
|
9
|
+
`TStartUpstreamSignInRequest`: a start without `purpose` is a sign-in, and a link start that carries
|
|
10
|
+
`oidcTransactionId` does not compile. Callers written against 30.4.0 compile unchanged.
|
|
11
|
+
- The link flow replaces the account-page link path 30.4.0 described (start, provider round trip, confirm without
|
|
12
|
+
finish); a confirm on a flow that was not finished now fails. The account page sends the person to
|
|
13
|
+
`<login>/login?link=<provider>`, the provider returns to `<login>/login?upstream=<id>`, and
|
|
14
|
+
`finishUpstreamSignIn` on a link flow never mints a session, never creates an account and looks up no account
|
|
15
|
+
and no link. `confirmUpstreamIdentityLink` accepts only a flow whose finish answered `linkRequired`, after a
|
|
16
|
+
new sign-in and an explicit confirmation; a refused confirm leaves the flow open.
|
|
17
|
+
- The provider's email is always vouched for: `linkRequired` and every link carry an email the provider's signed
|
|
18
|
+
token marks as verified. Both flows refuse `provider_email_unverified` otherwise; a finish refused with a code
|
|
19
|
+
ends the flow, and only a wrong verifier leaves it usable.
|
|
20
|
+
- `authenticationChangeRefusalCodes` (`fresh_passkey_sign_in_required`, `fresh_sign_in_required`),
|
|
21
|
+
`TAuthenticationChangeRefusalCode` and `IAuthenticationChangeRefusal`: the `errorData` of a request the
|
|
22
|
+
authentication-change gate refuses when a new sign-in would satisfy it.
|
|
23
|
+
|
|
24
|
+
## 2026-11-13 - 30.4.0
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
- the contract for signing in to idp.global with Apple or Google (data, dto, request; AGL-1801)
|
|
29
|
+
- `upstreamIdentityProviders` (`apple`, `google`) and `TUpstreamIdentityProvider` are the one source of every
|
|
30
|
+
provider value. New runtime lists derive from it: `loginSessionPrimaryAuthenticationMethods`,
|
|
31
|
+
`mfaChallengePrimaryAuthMethods` and `activityAuthenticationMethods`; `userEmailVerificationMethods` gains the
|
|
32
|
+
providers.
|
|
33
|
+
- Five requests: `IReq_StartUpstreamSignIn` (provider, the S256 hash of a verifier the browser keeps, optional
|
|
34
|
+
OIDC transaction; answers the flow `id` and the provider's authorization URL), `IReq_FinishUpstreamSignIn`
|
|
35
|
+
(`{ id, verifier }`; answers like password sign-in, or with `linkRequired`), `IReq_ConfirmUpstreamIdentityLink`,
|
|
36
|
+
`IReq_GetUpstreamIdentities` and `IReq_UnlinkUpstreamIdentity`. Links are listed as `dto.IUpstreamIdentityDto`
|
|
37
|
+
(provider, link time, email at link time, private-relay flag).
|
|
38
|
+
- A refused request throws a `TypedResponseError` whose `errorData` is `IUpstreamIdentityRefusal` with a closed
|
|
39
|
+
`code` (`TUpstreamIdentityRefusalCode`).
|
|
40
|
+
- `provider_hint` on `IAuthorizationRequest`, returned to the login UI as `providerHint` by
|
|
41
|
+
`IReq_InspectOidcAuthorizationV2`: a relying app's own "Sign in with Apple" button starts that provider at once.
|
|
42
|
+
- Activity: actions `upstream_identity_linked` and `upstream_identity_unlinked` (fact `provider`) and target type
|
|
43
|
+
`upstream_identity`; the `login` fact's `authenticationMethod` may name a provider.
|
|
44
|
+
- Widened unions: `TLoginSessionPrimaryAuthenticationMethod`, `IMfaChallenge.data.primaryAuthMethod`,
|
|
45
|
+
`TUserEmailVerificationMethod`, `TActivityAuthenticationMethod`, `TActivityAction` and `TActivityTargetType` gain
|
|
46
|
+
members. Code that handles one of them exhaustively (a `switch` with a `never` check, a
|
|
47
|
+
`Record<TActivityAction, …>` table) must add the new members when it moves to this version.
|
|
48
|
+
|
|
3
49
|
## 2026-11-12 - 30.3.0
|
|
4
50
|
|
|
5
51
|
### Features
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@idp.global/interfaces',
|
|
6
|
-
version: '30.
|
|
6
|
+
version: '30.5.0',
|
|
7
7
|
description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'global_admin_granted' | 'global_admin_removed' | 'global_capabilities_changed' | 'break_glass_requested' | 'break_glass_activated' | 'break_glass_used' | 'break_glass_reviewed' | 'administrator_recovery_requested' | 'administrator_recovery_activated' | 'administrator_recovery_completed' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_domain_verified' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed' | 'oidc_authorization_granted' | 'oidc_code_exchanged' | 'oidc_refresh_rotated' | 'oidc_refresh_reuse_detected' | 'oidc_token_revoked' | 'oidc_logout' | 'oidc_client_created' | 'oidc_client_updated' | 'oidc_client_activation_changed' | 'oidc_client_deleted' | 'oidc_client_secret_rotated' | 'oidc_client_app_connection_requests_enabled' | 'oidc_client_app_connection_requests_disabled' | 'oidc_signing_key_rotated' | 'oidc_lifecycle_revoked' | 'org_suspended' | 'org_unsuspended';
|
|
1
|
+
export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'global_admin_granted' | 'global_admin_removed' | 'global_capabilities_changed' | 'break_glass_requested' | 'break_glass_activated' | 'break_glass_used' | 'break_glass_reviewed' | 'administrator_recovery_requested' | 'administrator_recovery_activated' | 'administrator_recovery_completed' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_domain_verified' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed' | 'oidc_authorization_granted' | 'oidc_code_exchanged' | 'oidc_refresh_rotated' | 'oidc_refresh_reuse_detected' | 'oidc_token_revoked' | 'oidc_logout' | 'oidc_client_created' | 'oidc_client_updated' | 'oidc_client_activation_changed' | 'oidc_client_deleted' | 'oidc_client_secret_rotated' | 'oidc_client_app_connection_requests_enabled' | 'oidc_client_app_connection_requests_disabled' | 'oidc_signing_key_rotated' | 'oidc_lifecycle_revoked' | 'org_suspended' | 'org_unsuspended' | 'upstream_identity_linked' | 'upstream_identity_unlinked';
|
|
2
2
|
export type TActivityOutcome = 'attempted' | 'succeeded' | 'denied' | 'failed';
|
|
3
3
|
/**
|
|
4
4
|
* Public failure reasons are deliberately finite and non-descriptive. They
|
|
@@ -6,8 +6,10 @@ export type TActivityOutcome = 'attempted' | 'succeeded' | 'denied' | 'failed';
|
|
|
6
6
|
* caller-authored text across the public contract boundary.
|
|
7
7
|
*/
|
|
8
8
|
export type TActivityReasonCode = 'account_inactive' | 'authentication_failed' | 'authorization_denied' | 'conflict' | 'expired' | 'invalid_request' | 'policy_denied' | 'rate_limited' | 'replay_detected' | 'revoked' | 'step_up_required' | 'upstream_unavailable' | 'user_cancelled';
|
|
9
|
-
export type TActivityTargetType = 'account' | 'administrator_recovery' | 'application_connection' | 'break_glass_access' | 'mfa_method' | 'oidc_authorization' | 'oidc_client' | 'oidc_lifecycle' | 'oidc_signing_key' | 'oidc_token' | 'organization' | 'organization_membership' | 'organization_role_mapping' | 'passkey' | 'passport_challenge' | 'passport_device' | 'profile' | 'scim_group_membership' | 'scim_token' | 'scim_user' | 'session' | 'sso_connection' | 'sso_domain';
|
|
10
|
-
|
|
9
|
+
export type TActivityTargetType = 'account' | 'administrator_recovery' | 'application_connection' | 'break_glass_access' | 'mfa_method' | 'oidc_authorization' | 'oidc_client' | 'oidc_lifecycle' | 'oidc_signing_key' | 'oidc_token' | 'organization' | 'organization_membership' | 'organization_role_mapping' | 'passkey' | 'passport_challenge' | 'passport_device' | 'profile' | 'scim_group_membership' | 'scim_token' | 'scim_user' | 'session' | 'sso_connection' | 'sso_domain' | 'upstream_identity';
|
|
10
|
+
/** The first factor of a `login` event; an upstream provider names itself. */
|
|
11
|
+
export declare const activityAuthenticationMethods: readonly ["magic_link", "password", "apple", "google"];
|
|
12
|
+
export type TActivityAuthenticationMethod = (typeof activityAuthenticationMethods)[number];
|
|
11
13
|
export type TActivitySessionKind = 'browser' | 'oidc';
|
|
12
14
|
export type TActivityRevocationScope = 'account' | 'all_sessions' | 'application' | 'current_session' | 'organization' | 'token_family';
|
|
13
15
|
export type TActivityRoleChange = 'assigned' | 'removed' | 'replaced';
|
package/dist_ts/data/activity.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { upstreamIdentityProviders } from './upstreamidentity.js';
|
|
2
|
+
/** The first factor of a `login` event; an upstream provider names itself. */
|
|
3
|
+
export const activityAuthenticationMethods = [
|
|
4
|
+
'magic_link',
|
|
5
|
+
'password',
|
|
6
|
+
...upstreamIdentityProviders,
|
|
7
|
+
];
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aXZpdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kYXRhL2FjdGl2aXR5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx5QkFBeUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBMkhsRSw4RUFBOEU7QUFDOUUsTUFBTSxDQUFDLE1BQU0sNkJBQTZCLEdBQUc7SUFDM0MsWUFBWTtJQUNaLFVBQVU7SUFDVixHQUFHLHlCQUF5QjtDQUNwQixDQUFDIn0=
|
package/dist_ts/data/index.d.ts
CHANGED
package/dist_ts/data/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export * from './registrationsession.js';
|
|
|
22
22
|
export * from './role.js';
|
|
23
23
|
export * from './user.js';
|
|
24
24
|
export * from './userinvitation.js';
|
|
25
|
+
export * from './upstreamidentity.js';
|
|
25
26
|
export * from './ssoconnection.js';
|
|
26
27
|
export * from './scim.js';
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kYXRhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxXQUFXLENBQUM7QUFDMUIsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLHlCQUF5QixDQUFDO0FBQ3hDLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxXQUFXLENBQUM7QUFDMUIsY0FBYyxXQUFXLENBQUM7QUFDMUIsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsb0JBQW9CLENBQUM7QUFDbkMsY0FBYyxXQUFXLENBQUMifQ==
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** How a session's person first authenticated; an upstream provider names itself. */
|
|
2
|
+
export declare const loginSessionPrimaryAuthenticationMethods: readonly ["magic_link", "passkey", "password", "saml", "apple", "google"];
|
|
3
|
+
export type TLoginSessionPrimaryAuthenticationMethod = (typeof loginSessionPrimaryAuthenticationMethods)[number];
|
|
2
4
|
export type TLoginSessionMfaFactor = 'backup_code' | 'passkey' | 'totp';
|
|
3
5
|
export interface ILoginSessionAuthenticationEvidence {
|
|
4
6
|
primaryMethod: TLoginSessionPrimaryAuthenticationMethod;
|
|
@@ -6,6 +8,22 @@ export interface ILoginSessionAuthenticationEvidence {
|
|
|
6
8
|
mfaFactor: TLoginSessionMfaFactor | null;
|
|
7
9
|
mfaAuthenticatedAt: number | null;
|
|
8
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Why the authentication-change gate refused a request. The gate guards every change to how
|
|
13
|
+
* an account signs in and judges the session's authentication evidence. Wherever a new sign-in
|
|
14
|
+
* would satisfy it, a refused request throws a `TypedResponseError` whose `errorData` is
|
|
15
|
+
* `IAuthenticationChangeRefusal`; a refusal that no new sign-in can satisfy carries no code.
|
|
16
|
+
* The proof is always a new sign-in on the login origin: there is no in-session step-up
|
|
17
|
+
* request. The list is closed.
|
|
18
|
+
* - `fresh_passkey_sign_in_required`: sign in again with a passkey, then retry;
|
|
19
|
+
* - `fresh_sign_in_required`: sign in again, then retry.
|
|
20
|
+
*/
|
|
21
|
+
export declare const authenticationChangeRefusalCodes: readonly ['fresh_passkey_sign_in_required', 'fresh_sign_in_required'];
|
|
22
|
+
export type TAuthenticationChangeRefusalCode = (typeof authenticationChangeRefusalCodes)[number];
|
|
23
|
+
/** The `errorData` of a request the authentication-change gate refused. */
|
|
24
|
+
export interface IAuthenticationChangeRefusal {
|
|
25
|
+
code: TAuthenticationChangeRefusalCode;
|
|
26
|
+
}
|
|
9
27
|
export interface ILoginSession {
|
|
10
28
|
id: string;
|
|
11
29
|
data: {
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { upstreamIdentityProviders } from './upstreamidentity.js';
|
|
2
|
+
/** How a session's person first authenticated; an upstream provider names itself. */
|
|
3
|
+
export const loginSessionPrimaryAuthenticationMethods = [
|
|
4
|
+
'magic_link',
|
|
5
|
+
'passkey',
|
|
6
|
+
'password',
|
|
7
|
+
'saml',
|
|
8
|
+
...upstreamIdentityProviders,
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Why the authentication-change gate refused a request. The gate guards every change to how
|
|
12
|
+
* an account signs in and judges the session's authentication evidence. Wherever a new sign-in
|
|
13
|
+
* would satisfy it, a refused request throws a `TypedResponseError` whose `errorData` is
|
|
14
|
+
* `IAuthenticationChangeRefusal`; a refusal that no new sign-in can satisfy carries no code.
|
|
15
|
+
* The proof is always a new sign-in on the login origin: there is no in-session step-up
|
|
16
|
+
* request. The list is closed.
|
|
17
|
+
* - `fresh_passkey_sign_in_required`: sign in again with a passkey, then retry;
|
|
18
|
+
* - `fresh_sign_in_required`: sign in again, then retry.
|
|
19
|
+
*/
|
|
20
|
+
export const authenticationChangeRefusalCodes = [
|
|
21
|
+
'fresh_passkey_sign_in_required',
|
|
22
|
+
'fresh_sign_in_required',
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9naW5zZXNzaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvZGF0YS9sb2dpbnNlc3Npb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFbEUscUZBQXFGO0FBQ3JGLE1BQU0sQ0FBQyxNQUFNLHdDQUF3QyxHQUFHO0lBQ3RELFlBQVk7SUFDWixTQUFTO0lBQ1QsVUFBVTtJQUNWLE1BQU07SUFDTixHQUFHLHlCQUF5QjtDQUNwQixDQUFDO0FBY1g7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sZ0NBQWdDLEdBQUc7SUFDOUMsZ0NBQWdDO0lBQ2hDLHdCQUF3QjtDQUNoQixDQUFDIn0=
|
package/dist_ts/data/mfa.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type TMfaMethod = 'totp' | 'backupCode' | 'passkey';
|
|
2
2
|
export type TMfaChallengeStatus = 'pending' | 'completed' | 'expired';
|
|
3
|
+
/** The first factor an MFA challenge follows; an upstream provider names itself. */
|
|
4
|
+
export declare const mfaChallengePrimaryAuthMethods: readonly ["password", "email", "apple", "google"];
|
|
5
|
+
export type TMfaChallengePrimaryAuthMethod = (typeof mfaChallengePrimaryAuthMethods)[number];
|
|
3
6
|
export type TTotpCredentialStatus = 'pending' | 'active' | 'disabled';
|
|
4
7
|
export interface ITotpBackupCode {
|
|
5
8
|
id: string;
|
|
@@ -32,7 +35,7 @@ export interface IMfaChallenge {
|
|
|
32
35
|
tokenHash: string;
|
|
33
36
|
status: TMfaChallengeStatus;
|
|
34
37
|
availableMethods: TMfaMethod[];
|
|
35
|
-
primaryAuthMethod:
|
|
38
|
+
primaryAuthMethod: TMfaChallengePrimaryAuthMethod;
|
|
36
39
|
createdAt: number;
|
|
37
40
|
expiresAt: number;
|
|
38
41
|
completedAt?: number | null;
|
package/dist_ts/data/mfa.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { upstreamIdentityProviders } from './upstreamidentity.js';
|
|
2
|
+
/** The first factor an MFA challenge follows; an upstream provider names itself. */
|
|
3
|
+
export const mfaChallengePrimaryAuthMethods = [
|
|
4
|
+
'password',
|
|
5
|
+
'email',
|
|
6
|
+
...upstreamIdentityProviders,
|
|
7
|
+
];
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWZhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvZGF0YS9tZmEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFNbEUsb0ZBQW9GO0FBQ3BGLE1BQU0sQ0FBQyxNQUFNLDhCQUE4QixHQUFHO0lBQzVDLFVBQVU7SUFDVixPQUFPO0lBQ1AsR0FBRyx5QkFBeUI7Q0FDcEIsQ0FBQyJ9
|
package/dist_ts/data/oidc.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OIDC (OpenID Connect) data interfaces for third-party client support
|
|
3
3
|
*/
|
|
4
|
+
import type { TUpstreamIdentityProvider } from './upstreamidentity.js';
|
|
4
5
|
/**
|
|
5
6
|
* Supported OIDC scopes
|
|
6
7
|
*/
|
|
@@ -192,6 +193,13 @@ export interface IAuthorizationRequest {
|
|
|
192
193
|
* `type` with `invalid_authorization_details` (RFC 9396 section 5) and never ignores it.
|
|
193
194
|
*/
|
|
194
195
|
authorization_details?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The idp.global `provider_hint` parameter: the relying app's own "Sign in with …" button asks
|
|
198
|
+
* the login UI to start that provider's sign-in at once instead of showing the sign-in choice.
|
|
199
|
+
* It is a hint only; it never skips MFA or any other step of the sign-in. A value that names
|
|
200
|
+
* no provider this installation offers is ignored: the login UI shows the sign-in choice.
|
|
201
|
+
*/
|
|
202
|
+
provider_hint?: TUpstreamIdentityProvider;
|
|
195
203
|
}
|
|
196
204
|
/**
|
|
197
205
|
* Token request for authorization_code grant
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identity providers a person can sign in to idp.global with. The list is closed and is
|
|
3
|
+
* the one source of every provider value in these contracts: login-session evidence, the MFA
|
|
4
|
+
* challenge, the email verification method and the activity vocabulary derive from it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const upstreamIdentityProviders: readonly ['apple', 'google'];
|
|
7
|
+
export type TUpstreamIdentityProvider = (typeof upstreamIdentityProviders)[number];
|
|
8
|
+
/**
|
|
9
|
+
* What an upstream flow is for. The server records it on the flow at start and never changes
|
|
10
|
+
* it, so a sign-in flow that answered `linkRequired` stays a sign-in flow. The list is closed.
|
|
11
|
+
* - `sign-in`: sign in to idp.global, or create an account, with the provider identity;
|
|
12
|
+
* - `link`: link the provider identity to an existing account. A link flow never mints a
|
|
13
|
+
* session and never creates an account.
|
|
14
|
+
*/
|
|
15
|
+
export declare const upstreamSignInPurposes: readonly ['sign-in', 'link'];
|
|
16
|
+
export type TUpstreamSignInPurpose = (typeof upstreamSignInPurposes)[number];
|
|
17
|
+
/**
|
|
18
|
+
* Why an upstream sign-in, link or unlink was refused. A refused request throws a
|
|
19
|
+
* `TypedResponseError` whose `errorData` is `IUpstreamIdentityRefusal`. The authentication-change
|
|
20
|
+
* gate refuses with its own `IAuthenticationChangeRefusal`, whose codes differ from these; any
|
|
21
|
+
* other failure (an expired or spent flow, a wrong verifier, an unavailable provider) carries
|
|
22
|
+
* no code.
|
|
23
|
+
* - `sso_domain_required`: the email of the account concerned is under a verified SSO domain;
|
|
24
|
+
* sign in through its organization's single sign-on. At finish on a sign-in flow that is the
|
|
25
|
+
* vouched email of an identity not linked yet, or the account's email for a linked identity;
|
|
26
|
+
* at `confirmUpstreamIdentityLink` it is the signed-in account's email. The provider's email
|
|
27
|
+
* on a link flow is not judged;
|
|
28
|
+
* - `provider_email_unverified`: the provider did not vouch for an email: the signed token
|
|
29
|
+
* carries none, or does not say it is verified. A sign-in flow answers it for an identity
|
|
30
|
+
* that is not linked yet, before any account lookup; a link flow answers it for every
|
|
31
|
+
* identity, before any lookup. It never tells whether an account or a link exists; nothing
|
|
32
|
+
* is created or linked, and the flow is ended;
|
|
33
|
+
* - `upstream_identity_linked_elsewhere`: this provider identity is linked to another account;
|
|
34
|
+
* - `provider_already_linked`: the account already has a link to this provider;
|
|
35
|
+
* - `last_sign_in_method`: after the unlink the account would have no password, no active
|
|
36
|
+
* passkey and no other link while its email is this link's private-relay address.
|
|
37
|
+
*/
|
|
38
|
+
export type TUpstreamIdentityRefusalCode = 'sso_domain_required' | 'provider_email_unverified' | 'upstream_identity_linked_elsewhere' | 'provider_already_linked' | 'last_sign_in_method';
|
|
39
|
+
/** The `errorData` of a refused upstream identity request. */
|
|
40
|
+
export interface IUpstreamIdentityRefusal {
|
|
41
|
+
code: TUpstreamIdentityRefusalCode;
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identity providers a person can sign in to idp.global with. The list is closed and is
|
|
3
|
+
* the one source of every provider value in these contracts: login-session evidence, the MFA
|
|
4
|
+
* challenge, the email verification method and the activity vocabulary derive from it.
|
|
5
|
+
*/
|
|
6
|
+
export const upstreamIdentityProviders = ['apple', 'google'];
|
|
7
|
+
/**
|
|
8
|
+
* What an upstream flow is for. The server records it on the flow at start and never changes
|
|
9
|
+
* it, so a sign-in flow that answered `linkRequired` stays a sign-in flow. The list is closed.
|
|
10
|
+
* - `sign-in`: sign in to idp.global, or create an account, with the provider identity;
|
|
11
|
+
* - `link`: link the provider identity to an existing account. A link flow never mints a
|
|
12
|
+
* session and never creates an account.
|
|
13
|
+
*/
|
|
14
|
+
export const upstreamSignInPurposes = ['sign-in', 'link'];
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBzdHJlYW1pZGVudGl0eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL2RhdGEvdXBzdHJlYW1pZGVudGl0eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLE1BQU0seUJBQXlCLEdBQUcsQ0FBQyxPQUFPLEVBQUUsUUFBUSxDQUFVLENBQUM7QUFJdEU7Ozs7OztHQU1HO0FBQ0gsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBQUcsQ0FBQyxTQUFTLEVBQUUsTUFBTSxDQUFVLENBQUMifQ==
|
package/dist_ts/data/user.d.ts
CHANGED
|
@@ -57,9 +57,11 @@ export type TAdministratorRecovery = IAdministratorRecoveryBase & ({
|
|
|
57
57
|
* - `magic-link`: an emailed sign-in link was followed;
|
|
58
58
|
* - `password-reset`: an emailed password-reset link was completed;
|
|
59
59
|
* - `fixture`: a local development fixture (development IdP persona, seed data); nobody
|
|
60
|
-
* proved control of the address
|
|
60
|
+
* proved control of the address;
|
|
61
|
+
* - an upstream provider (`apple`, `google`): the account was created from that provider's
|
|
62
|
+
* signed assertion that the address is verified.
|
|
61
63
|
*/
|
|
62
|
-
export declare const userEmailVerificationMethods: readonly [
|
|
64
|
+
export declare const userEmailVerificationMethods: readonly ["registration", "sign-in-code", "magic-link", "password-reset", "fixture", "apple", "google"];
|
|
63
65
|
export type TUserEmailVerificationMethod = (typeof userEmailVerificationMethods)[number];
|
|
64
66
|
/** A verification of the user's current email address. */
|
|
65
67
|
export interface IUserEmailVerification {
|
package/dist_ts/data/user.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
2
|
import {} from './role.js';
|
|
3
|
+
import { upstreamIdentityProviders } from './upstreamidentity.js';
|
|
3
4
|
/**
|
|
4
5
|
* How idp.global learned that the user controls an email address. The set is closed:
|
|
5
6
|
* - `registration`: the registration's emailed code or link was confirmed before the
|
|
@@ -8,7 +9,9 @@ import {} from './role.js';
|
|
|
8
9
|
* - `magic-link`: an emailed sign-in link was followed;
|
|
9
10
|
* - `password-reset`: an emailed password-reset link was completed;
|
|
10
11
|
* - `fixture`: a local development fixture (development IdP persona, seed data); nobody
|
|
11
|
-
* proved control of the address
|
|
12
|
+
* proved control of the address;
|
|
13
|
+
* - an upstream provider (`apple`, `google`): the account was created from that provider's
|
|
14
|
+
* signed assertion that the address is verified.
|
|
12
15
|
*/
|
|
13
16
|
export const userEmailVerificationMethods = [
|
|
14
17
|
'registration',
|
|
@@ -16,5 +19,6 @@ export const userEmailVerificationMethods = [
|
|
|
16
19
|
'magic-link',
|
|
17
20
|
'password-reset',
|
|
18
21
|
'fixture',
|
|
22
|
+
...upstreamIdentityProviders,
|
|
19
23
|
];
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL2RhdGEvdXNlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQWMsTUFBTSxXQUFXLENBQUM7QUFLdkMsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFtRWxFOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sNEJBQTRCLEdBQUc7SUFDMUMsY0FBYztJQUNkLGNBQWM7SUFDZCxZQUFZO0lBQ1osZ0JBQWdCO0lBQ2hCLFNBQVM7SUFDVCxHQUFHLHlCQUF5QjtDQUNwQixDQUFDIn0=
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TActivityAction, TActivityAuthenticationMethod, TActivityMembershipChange, TActivityMfaFactor, TActivityOidcTokenType, TActivityOutcome, TActivityReasonCode, TActivityRevocationScope, TActivityRoleChange, TActivitySessionKind, TActivityTargetType } from '../data/activity.js';
|
|
2
2
|
import type { TOAuthClientType } from '../data/app.js';
|
|
3
|
+
import type { TUpstreamIdentityProvider } from '../data/upstreamidentity.js';
|
|
3
4
|
type TActivityEventFor<TAction extends TActivityAction, TTargetType extends TActivityTargetType, TFacts> = TAction extends TActivityAction ? {
|
|
4
5
|
action: TAction;
|
|
5
6
|
timestamp: number;
|
|
@@ -65,5 +66,9 @@ export type TActivityEventDto = TActivityEventFor<'login', 'account', {
|
|
|
65
66
|
clientType: TOAuthClientType;
|
|
66
67
|
}> | TActivityEventFor<'oidc_signing_key_rotated', 'oidc_signing_key', null> | TActivityEventFor<'oidc_lifecycle_revoked', 'oidc_lifecycle', {
|
|
67
68
|
revocationScope: TActivityRevocationScope;
|
|
68
|
-
}> | TActivityEventFor<'org_suspended', 'organization', null> | TActivityEventFor<'org_unsuspended', 'organization', null
|
|
69
|
+
}> | TActivityEventFor<'org_suspended', 'organization', null> | TActivityEventFor<'org_unsuspended', 'organization', null> | TActivityEventFor<'upstream_identity_linked', 'upstream_identity', {
|
|
70
|
+
provider: TUpstreamIdentityProvider;
|
|
71
|
+
}> | TActivityEventFor<'upstream_identity_unlinked', 'upstream_identity', {
|
|
72
|
+
provider: TUpstreamIdentityProvider;
|
|
73
|
+
}>;
|
|
69
74
|
export {};
|
package/dist_ts/dto/index.d.ts
CHANGED
package/dist_ts/dto/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export * from './organization.js';
|
|
|
8
8
|
export * from './passport.js';
|
|
9
9
|
export * from './user.js';
|
|
10
10
|
export * from './ssoconnection.js';
|
|
11
|
-
|
|
11
|
+
export * from './upstreamidentity.js';
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kdG8vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsV0FBVyxDQUFDO0FBQzFCLGNBQWMsb0JBQW9CLENBQUM7QUFDbkMsY0FBYyx1QkFBdUIsQ0FBQyJ9
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TUpstreamIdentityProvider } from '../data/upstreamidentity.js';
|
|
2
|
+
/**
|
|
3
|
+
* A link between the account and an upstream provider identity, as the account UI shows it.
|
|
4
|
+
* An account has at most one link per provider, so the provider names the link. The provider's
|
|
5
|
+
* subject and every provider token stay server-side.
|
|
6
|
+
*/
|
|
7
|
+
export interface IUpstreamIdentityDto {
|
|
8
|
+
provider: TUpstreamIdentityProvider;
|
|
9
|
+
/** epoch ms when the link was made */
|
|
10
|
+
linkedAt: number;
|
|
11
|
+
/** The email the provider vouched for when the link was made; later provider emails never replace it. */
|
|
12
|
+
email: string;
|
|
13
|
+
/** The provider signed that `email` is a private relay address (Apple's `is_private_email`). */
|
|
14
|
+
isPrivateEmail: boolean;
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
|
-
import { type IOidcAppConnectionView, type TOidcScope } from '../data/index.js';
|
|
2
|
+
import { type IOidcAppConnectionView, type TOidcScope, type TUpstreamIdentityProvider } from '../data/index.js';
|
|
3
3
|
export interface IReq_CompleteOidcAuthorization extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_CompleteOidcAuthorization> {
|
|
4
4
|
method: 'completeOidcAuthorization';
|
|
5
5
|
request: {
|
|
@@ -57,6 +57,8 @@ export interface IReq_InspectOidcAuthorizationV2 extends plugins.typedRequestInt
|
|
|
57
57
|
appConnection?: {
|
|
58
58
|
requiresPasskey: true;
|
|
59
59
|
};
|
|
60
|
+
/** The authorize request's `provider_hint`: the login UI starts this provider's sign-in itself. */
|
|
61
|
+
providerHint?: TUpstreamIdentityProvider;
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
export interface IReq_PrepareOidcAuthorizationV2 extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_PrepareOidcAuthorizationV2> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
2
|
import {} from '../data/index.js';
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL3JlcXVlc3QvYXV0aG9yaXphdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBSU4sTUFBTSxrQkFBa0IsQ0FBQyJ9
|
package/dist_ts/request/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export * from './registration.js';
|
|
|
15
15
|
export * from './user.js';
|
|
16
16
|
export * from './userinvitation.js';
|
|
17
17
|
export * from './ssoconnection.js';
|
|
18
|
-
|
|
18
|
+
export * from './upstreamidentity.js';
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9yZXF1ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsWUFBWSxDQUFDO0FBQzNCLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsWUFBWSxDQUFDO0FBQzNCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxXQUFXLENBQUM7QUFDMUIsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsb0JBQW9CLENBQUM7QUFDbkMsY0FBYyx1QkFBdUIsQ0FBQyJ9
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as plugins from '../plugins.js';
|
|
2
|
+
import * as data from '../data/index.js';
|
|
3
|
+
import * as dto from '../dto/index.js';
|
|
4
|
+
import type { IReq_LoginWithEmailOrUsernameAndPassword } from './login.js';
|
|
5
|
+
/**
|
|
6
|
+
* The fields of `startUpstreamSignIn`. `purpose` defaults to `sign-in`; only a sign-in flow
|
|
7
|
+
* may carry an OIDC authorization transaction.
|
|
8
|
+
*/
|
|
9
|
+
export type TStartUpstreamSignInRequest = {
|
|
10
|
+
provider: data.TUpstreamIdentityProvider;
|
|
11
|
+
/** base64url(SHA-256(verifier)) of the verifier the login page keeps */
|
|
12
|
+
verifierChallenge: string;
|
|
13
|
+
} & ({
|
|
14
|
+
purpose?: Extract<data.TUpstreamSignInPurpose, 'sign-in'>;
|
|
15
|
+
/**
|
|
16
|
+
* Optional opaque OIDC authorization transaction to resume through the existing
|
|
17
|
+
* prepare/complete requests once the sign-in is complete.
|
|
18
|
+
*/
|
|
19
|
+
oidcTransactionId?: string;
|
|
20
|
+
} | {
|
|
21
|
+
purpose: Extract<data.TUpstreamSignInPurpose, 'link'>;
|
|
22
|
+
oidcTransactionId?: never;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Public: starts an upstream flow; no session is needed. The login page makes a random
|
|
26
|
+
* verifier, sends only its S256 hash here and keeps the verifier in the login origin's
|
|
27
|
+
* sessionStorage under the answered `id`. The server records the flow and its purpose for ten
|
|
28
|
+
* minutes; the purpose never changes. `id` names that record and is the OAuth `state` inside
|
|
29
|
+
* `authorizationUrl`. The provider returns to the issuer's callback, which always redirects the
|
|
30
|
+
* browser to `<login>/login?upstream=<id>` (plus `&tx=<oidcTransactionId>` when one was given).
|
|
31
|
+
*
|
|
32
|
+
* A sign-in flow starts on the login page, optionally with an OIDC authorization transaction.
|
|
33
|
+
* A link flow starts when the account UI's "Link" navigates to `<login>/login?link=<provider>`;
|
|
34
|
+
* that page starts it with `purpose: 'link'` and goes to the provider.
|
|
35
|
+
*/
|
|
36
|
+
export interface IReq_StartUpstreamSignIn extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_StartUpstreamSignIn> {
|
|
37
|
+
method: 'startUpstreamSignIn';
|
|
38
|
+
request: TStartUpstreamSignInRequest;
|
|
39
|
+
response: {
|
|
40
|
+
id: string;
|
|
41
|
+
/** The provider's authorization URL; the browser navigates to it. */
|
|
42
|
+
authorizationUrl: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The returned provider identity can be linked to an existing account. `finishUpstreamSignIn`
|
|
47
|
+
* answers it in two situations:
|
|
48
|
+
* - on a sign-in flow, when the provider identity is not linked and the email the provider
|
|
49
|
+
* vouched for names an existing account. A sign-in flow never answers it for an email the
|
|
50
|
+
* provider did not vouch for;
|
|
51
|
+
* - on a link flow, for every identity whose email the provider vouched for, without any
|
|
52
|
+
* account or link lookup.
|
|
53
|
+
*
|
|
54
|
+
* It mints nothing. The flow stays open until its ten-minute expiry for
|
|
55
|
+
* `confirmUpstreamIdentityLink`.
|
|
56
|
+
*/
|
|
57
|
+
export interface IUpstreamSignInLinkRequired {
|
|
58
|
+
provider: data.TUpstreamIdentityProvider;
|
|
59
|
+
/** The email the provider vouched for; the confirmation screen names it. */
|
|
60
|
+
email: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Public: finishes an upstream flow after the provider returned. The page at
|
|
64
|
+
* `<login>/login?upstream=<id>` calls it when it holds a verifier for that `id`, and calls
|
|
65
|
+
* nothing otherwise; it never needs to know the flow's purpose. It answers once per flow.
|
|
66
|
+
*
|
|
67
|
+
* On a sign-in flow it answers like password sign-in: a refresh token, or an MFA challenge to
|
|
68
|
+
* answer through `verifyMfaChallenge` or the passkey MFA requests. Either answer ends the flow.
|
|
69
|
+
* `linkRequired` is the third outcome. Refusal codes (`data.IUpstreamIdentityRefusal`), in
|
|
70
|
+
* this order: `provider_email_unverified`, then `sso_domain_required`. A refusal with a code
|
|
71
|
+
* ends the flow; only a wrong verifier leaves the flow usable.
|
|
72
|
+
*
|
|
73
|
+
* On a link flow it never mints a session, never creates an account and looks up no account
|
|
74
|
+
* and no link: it answers `linkRequired` when the provider vouched for the email, whatever
|
|
75
|
+
* identity the provider returned. Refusal code: `provider_email_unverified`. A refusal with a
|
|
76
|
+
* code ends the flow.
|
|
77
|
+
*/
|
|
78
|
+
export interface IReq_FinishUpstreamSignIn extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_FinishUpstreamSignIn> {
|
|
79
|
+
method: 'finishUpstreamSignIn';
|
|
80
|
+
request: {
|
|
81
|
+
id: string;
|
|
82
|
+
/** The verifier whose hash `startUpstreamSignIn` received. */
|
|
83
|
+
verifier: string;
|
|
84
|
+
};
|
|
85
|
+
response: IReq_LoginWithEmailOrUsernameAndPassword['response'] & {
|
|
86
|
+
linkRequired?: IUpstreamSignInLinkRequired;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Links the provider identity of a flow whose `finishUpstreamSignIn` answered `linkRequired`;
|
|
91
|
+
* any other flow fails without a code. The link stores the provider's vouched email and
|
|
92
|
+
* private-relay flag as the flow recorded them. It links to the signed-in account and carries
|
|
93
|
+
* the flow's `id` and `verifier`. One confirmation screen on the login origin serves sign-in
|
|
94
|
+
* and link flows alike. It always asks for a new sign-in to the account, whatever session the
|
|
95
|
+
* browser holds, then names the provider, the provider's email and the signed-in account; only
|
|
96
|
+
* the person's explicit confirmation sends this request, never a URL on its own.
|
|
97
|
+
*
|
|
98
|
+
* An authentication change: it needs the account's strongest enrolled proof, fresh (a fresh
|
|
99
|
+
* passkey sign-in while the account has an active passkey, otherwise a fresh primary sign-in);
|
|
100
|
+
* an administrator-recovery session does not count. The gate is checked at entry and again
|
|
101
|
+
* when the link is written, and can refuse with `data.IAuthenticationChangeRefusal`.
|
|
102
|
+
*
|
|
103
|
+
* A refused confirm, the gate's refusal included, leaves the flow open until its ten-minute
|
|
104
|
+
* expiry; only the link write spends it.
|
|
105
|
+
* Refusal codes (`data.IUpstreamIdentityRefusal`): `sso_domain_required` (the signed-in
|
|
106
|
+
* account's email), `provider_already_linked`, `upstream_identity_linked_elsewhere`. Never
|
|
107
|
+
* `provider_email_unverified`: no flow reaches this request without a vouched email.
|
|
108
|
+
*/
|
|
109
|
+
export interface IReq_ConfirmUpstreamIdentityLink extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_ConfirmUpstreamIdentityLink> {
|
|
110
|
+
method: 'confirmUpstreamIdentityLink';
|
|
111
|
+
request: {
|
|
112
|
+
jwt: string;
|
|
113
|
+
id: string;
|
|
114
|
+
verifier: string;
|
|
115
|
+
};
|
|
116
|
+
response: {
|
|
117
|
+
upstreamIdentity: dto.IUpstreamIdentityDto;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Lists the signed-in account's upstream identity links.
|
|
122
|
+
*/
|
|
123
|
+
export interface IReq_GetUpstreamIdentities extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_GetUpstreamIdentities> {
|
|
124
|
+
method: 'getUpstreamIdentities';
|
|
125
|
+
request: {
|
|
126
|
+
jwt: string;
|
|
127
|
+
};
|
|
128
|
+
response: {
|
|
129
|
+
upstreamIdentities: dto.IUpstreamIdentityDto[];
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Removes the signed-in account's link to a provider. An authentication change, gated like
|
|
134
|
+
* `confirmUpstreamIdentityLink`; the gate can refuse with `data.IAuthenticationChangeRefusal`.
|
|
135
|
+
* Refusal code (`data.IUpstreamIdentityRefusal`): `last_sign_in_method`.
|
|
136
|
+
*/
|
|
137
|
+
export interface IReq_UnlinkUpstreamIdentity extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_UnlinkUpstreamIdentity> {
|
|
138
|
+
method: 'unlinkUpstreamIdentity';
|
|
139
|
+
request: {
|
|
140
|
+
jwt: string;
|
|
141
|
+
provider: data.TUpstreamIdentityProvider;
|
|
142
|
+
};
|
|
143
|
+
response: {
|
|
144
|
+
success: boolean;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as plugins from '../plugins.js';
|
|
2
|
+
import * as data from '../data/index.js';
|
|
3
|
+
import * as dto from '../dto/index.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBzdHJlYW1pZGVudGl0eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL3JlcXVlc3QvdXBzdHJlYW1pZGVudGl0eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEtBQUssSUFBSSxNQUFNLGtCQUFrQixDQUFDO0FBQ3pDLE9BQU8sS0FBSyxHQUFHLE1BQU0saUJBQWlCLENBQUMifQ==
|