@metamask-previews/profile-sync-controller 35.0.0-preview-bd4de146a → 35.0.0-preview-63902891a
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 +15 -0
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts +37 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.ts +31 -1
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.js +90 -5
- package/dist/controllers/authentication/AuthenticationController.js.map +1 -1
- package/dist/controllers/authentication/index.d.ts +1 -1
- package/dist/controllers/authentication/index.d.ts.map +1 -1
- package/dist/controllers/authentication/index.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts +25 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js +28 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts +77 -0
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js +27 -0
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts +24 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/services.js +55 -3
- package/dist/sdk/authentication-jwt-bearer/mfa/services.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts +45 -2
- package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/types.js.map +1 -1
- package/dist/sdk/authentication.d.ts +6 -1
- package/dist/sdk/authentication.d.ts.map +1 -1
- package/dist/sdk/authentication.js +8 -0
- package/dist/sdk/authentication.js.map +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/mocks/auth.d.ts +2 -0
- package/dist/sdk/mocks/auth.d.ts.map +1 -1
- package/dist/sdk/mocks/auth.js +2 -0
- package/dist/sdk/mocks/auth.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
12
|
- Add support for Node.js 26 ([#10981](https://github.com/MetaMask/core/pull/10981))
|
|
13
|
+
- Add `AuthenticationController.requestMfaApproval`, also exposed as the `AuthenticationController:requestMfaApproval` messenger action, which requests an approval bound to one request from `POST /api/v2/mfa/approvals` for services such as recovery and signing ([#11071](https://github.com/MetaMask/core/pull/11071))
|
|
14
|
+
- Takes `requestHash`, `audiences`, an optional `includeIdentifiers` and a trace `reason`, and returns `{ approval, expiresIn, identifiers? }`
|
|
15
|
+
- With `requireVerification: true`, the approval proves the verification session; without one, it throws `StepUpRequiredError` (`aal2_required`) without calling the server, so the caller verifies first
|
|
16
|
+
- A 403 `authentication_required` response, which the server sends when that verification is too old, is also reported as `StepUpRequiredError`: it drops that verification session, so the next verification runs a new ceremony, and leaves the SRP session in place
|
|
17
|
+
- Exports the `RequestMfaApprovalRequest`, `MfaApproval` and `MfaApprovalIdentifier` types from the SDK, and the `AuthenticationControllerRequestMfaApprovalAction` type
|
|
18
|
+
- Add `AuthenticationController.removeCredential`, also exposed as the `AuthenticationController:removeCredential` messenger action, which removes an MFA credential with `DELETE /api/v2/mfa/credentials/{credential_id}` and caches the credentials left ([#11079](https://github.com/MetaMask/core/pull/11079))
|
|
19
|
+
- Takes the credential's `credentialId` and a trace `reason`, and returns the credentials left
|
|
20
|
+
- Sends the verification session; without one, it throws `StepUpRequiredError` (`aal2_required`) without calling the server, so the caller verifies with another method first
|
|
21
|
+
- The server refuses with the new `cross_type_step_up_required` error code when the verification used the same type of credential, `last_credential` for the only credential left, and `credential_not_found` for an unknown one
|
|
22
|
+
- Exports the `RemoveCredentialRequest` type from the SDK, and the `AuthenticationControllerRemoveCredentialAction` type
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **BREAKING:** `EnrolledCredential` has a required `id`, read from the `credential_id` the credentials endpoint now returns: the WebAuthn credential ID for a passkey, `email_otp` or `totp` otherwise ([#11079](https://github.com/MetaMask/core/pull/11079))
|
|
27
|
+
- Code that builds `EnrolledCredential` objects, such as test fixtures, must add an `id`
|
|
13
28
|
|
|
14
29
|
## [35.0.0]
|
|
15
30
|
|
|
@@ -42,6 +42,23 @@ export type AuthenticationControllerRefreshEnrolledCredentialsAction = {
|
|
|
42
42
|
type: `AuthenticationController:refreshEnrolledCredentials`;
|
|
43
43
|
handler: AuthenticationController['refreshEnrolledCredentials'];
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Removes a credential from the profile and caches the credentials left.
|
|
47
|
+
*
|
|
48
|
+
* The server requires a verification proven with another type of credential
|
|
49
|
+
* (`cross_type_step_up_required` otherwise) and refuses to remove the last
|
|
50
|
+
* one (`last_credential`). This sends the verification session: without
|
|
51
|
+
* one, it throws a `StepUpRequiredError` (`aal2_required`) without calling
|
|
52
|
+
* the server. The caller verifies with another method through the client
|
|
53
|
+
* MFA kit first, which decides how recent that verification must be.
|
|
54
|
+
*
|
|
55
|
+
* @param request - The credential's `id`, and the trace reason.
|
|
56
|
+
* @returns The credentials left.
|
|
57
|
+
*/
|
|
58
|
+
export type AuthenticationControllerRemoveCredentialAction = {
|
|
59
|
+
type: `AuthenticationController:removeCredential`;
|
|
60
|
+
handler: AuthenticationController['removeCredential'];
|
|
61
|
+
};
|
|
45
62
|
/**
|
|
46
63
|
* Begins enrollment of a passkey, email OTP or authenticator app (TOTP)
|
|
47
64
|
* credential.
|
|
@@ -123,6 +140,25 @@ export type AuthenticationControllerGetVerificationTokenAction = {
|
|
|
123
140
|
type: `AuthenticationController:getVerificationToken`;
|
|
124
141
|
handler: AuthenticationController['getVerificationToken'];
|
|
125
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* Requests an approval bound to one request (`POST /api/v2/mfa/approvals`),
|
|
145
|
+
* for the services in `audiences`, such as recovery or signing.
|
|
146
|
+
*
|
|
147
|
+
* Shows no UI. When `requireVerification` is set, the approval proves the
|
|
148
|
+
* verification session: without one, this throws a `StepUpRequiredError`
|
|
149
|
+
* (`aal2_required`) without calling the server. The server answers the same
|
|
150
|
+
* way when the verification is too old for it, and that session is then
|
|
151
|
+
* dropped. Either way, the caller verifies through the client MFA kit
|
|
152
|
+
* (`verifyOrEnroll`), which runs a new ceremony, and calls again.
|
|
153
|
+
*
|
|
154
|
+
* @param request - Request digest, audiences, whether a recent verification
|
|
155
|
+
* is required, whether to return identifiers, and the trace reason.
|
|
156
|
+
* @returns The approval, its lifetime and the recovery identifiers.
|
|
157
|
+
*/
|
|
158
|
+
export type AuthenticationControllerRequestMfaApprovalAction = {
|
|
159
|
+
type: `AuthenticationController:requestMfaApproval`;
|
|
160
|
+
handler: AuthenticationController['requestMfaApproval'];
|
|
161
|
+
};
|
|
126
162
|
/**
|
|
127
163
|
* Clears every in-memory verification session and its expiration timer,
|
|
128
164
|
* and the tokens kept for enrollments in progress.
|
|
@@ -238,5 +274,5 @@ export type AuthenticationControllerIsSignedInAction = {
|
|
|
238
274
|
/**
|
|
239
275
|
* Union of all AuthenticationController action types.
|
|
240
276
|
*/
|
|
241
|
-
export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerExchangeSocialAccessTokenAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerRefreshEnrolledCredentialsAction | AuthenticationControllerBeginCredentialEnrollmentAction | AuthenticationControllerCompleteCredentialEnrollmentAction | AuthenticationControllerBeginCredentialVerificationAction | AuthenticationControllerCompleteCredentialVerificationAction | AuthenticationControllerGetVerificationTokenAction | AuthenticationControllerClearVerificationSessionAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerClearStateAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerGetPartnerIdentityTokenAction | AuthenticationControllerIsSignedInAction;
|
|
277
|
+
export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerExchangeSocialAccessTokenAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerRefreshEnrolledCredentialsAction | AuthenticationControllerRemoveCredentialAction | AuthenticationControllerBeginCredentialEnrollmentAction | AuthenticationControllerCompleteCredentialEnrollmentAction | AuthenticationControllerBeginCredentialVerificationAction | AuthenticationControllerCompleteCredentialVerificationAction | AuthenticationControllerGetVerificationTokenAction | AuthenticationControllerRequestMfaApprovalAction | AuthenticationControllerClearVerificationSessionAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerClearStateAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerGetPartnerIdentityTokenAction | AuthenticationControllerIsSignedInAction;
|
|
242
278
|
//# sourceMappingURL=AuthenticationController-method-action-types.d.ts.map
|
package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationController-method-action-types.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK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,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,uDAAuD,GACvD,mDAAmD,GACnD,wDAAwD,GACxD,uDAAuD,GACvD,0DAA0D,GAC1D,yDAAyD,GACzD,4DAA4D,GAC5D,kDAAkD,GAClD,sDAAsD,GACtD,4CAA4C,GAC5C,wCAAwC,GACxC,4CAA4C,GAC5C,+CAA+C,GAC/C,uDAAuD,GACvD,mDAAmD,GACnD,qDAAqD,GACrD,qDAAqD,GACrD,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"AuthenticationController-method-action-types.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,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,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,uDAAuD,GACvD,mDAAmD,GACnD,wDAAwD,GACxD,8CAA8C,GAC9C,uDAAuD,GACvD,0DAA0D,GAC1D,yDAAyD,GACzD,4DAA4D,GAC5D,kDAAkD,GAClD,gDAAgD,GAChD,sDAAsD,GACtD,4CAA4C,GAC5C,wCAAwC,GACxC,4CAA4C,GAC5C,+CAA+C,GAC/C,uDAAuD,GACvD,mDAAmD,GACnD,qDAAqD,GACrD,qDAAqD,GACrD,wCAAwC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationController-method-action-types.js","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController.js';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\n/**\n * Exchanges the social access token SeedlessOnboarding holds for the\n * wallet's Google/Apple/Telegram login (`POST /api/v2/social/login`) for an\n * access token and the canonical profile it is paired to. Shows no UI and\n * stores nothing: SRP sessions remain the source of truth for\n * `getBearerToken`.\n *\n * Throws when the wallet has no social vault or no social token, and\n * `SocialIdentifierNotPairedError` when the identifier was never paired to\n * a profile.\n *\n * @returns The access token and canonical profile.\n */\nexport type AuthenticationControllerExchangeSocialAccessTokenAction = {\n type: `AuthenticationController:exchangeSocialAccessToken`;\n handler: AuthenticationController['exchangeSocialAccessToken'];\n};\n\n/**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\nexport type AuthenticationControllerRequestProfilePairingAction = {\n type: `AuthenticationController:requestProfilePairing`;\n handler: AuthenticationController['requestProfilePairing'];\n};\n\n/**\n * Refreshes credentials enrolled on the canonical profile.\n *\n * @returns The current supported credentials.\n */\nexport type AuthenticationControllerRefreshEnrolledCredentialsAction = {\n type: `AuthenticationController:refreshEnrolledCredentials`;\n handler: AuthenticationController['refreshEnrolledCredentials'];\n};\n\n/**\n * Begins enrollment of a passkey, email OTP or authenticator app (TOTP)\n * credential.\n *\n * @param request - Credential, optional email address, and trace reason.\n * @returns A challenge for the client-owned ceremony.\n */\nexport type AuthenticationControllerBeginCredentialEnrollmentAction = {\n type: `AuthenticationController:beginCredentialEnrollment`;\n handler: AuthenticationController['beginCredentialEnrollment'];\n};\n\n/**\n * Completes credential enrollment and refreshes the credential cache.\n *\n * It is sent with the verification token that began the enrollment, if\n * any: once a factor is enrolled, the server requires AAL2 for both steps.\n *\n * The server returns an assertion for the new credential, which opens a\n * verification session like `completeCredentialVerification`, replacing\n * any earlier one. If that exchange fails, the earlier session is kept:\n * the credential is enrolled either way.\n *\n * A cache-refresh failure does not undo successful enrollment. Email\n * enrollment invalidates the primary SRP session *after* refresh so the\n * credentials call can reuse the still-valid access token; the next token\n * fetch then includes the newly verified email claim. That invalidation\n * happens even if the session ends mid-request: the enrollment succeeded\n * on the server, so a token cached across a lock must not be reused\n * without the new claim.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The refreshed credentials, or the existing cache if refresh fails.\n */\nexport type AuthenticationControllerCompleteCredentialEnrollmentAction = {\n type: `AuthenticationController:completeCredentialEnrollment`;\n handler: AuthenticationController['completeCredentialEnrollment'];\n};\n\n/**\n * Begins verification with an enrolled credential.\n *\n * @param request - Credential type and trace reason.\n * @returns A challenge for the client-owned ceremony.\n */\nexport type AuthenticationControllerBeginCredentialVerificationAction = {\n type: `AuthenticationController:beginCredentialVerification`;\n handler: AuthenticationController['beginCredentialVerification'];\n};\n\n/**\n * Completes verification and opens a short-lived verification session.\n *\n * The assertion returned by the MFA service is exchanged at Hydra for an\n * access token. Its assurance level is not checked: the services receiving\n * the token enforce their own requirements. The token itself never enters\n * controller state.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The verification token.\n */\nexport type AuthenticationControllerCompleteCredentialVerificationAction = {\n type: `AuthenticationController:completeCredentialVerification`;\n handler: AuthenticationController['completeCredentialVerification'];\n};\n\n/**\n * Returns the active verification token when it meets the requested\n * freshness.\n *\n * Low-level: features should go through the client MFA kit\n * (`verifyOrEnroll`), which reuses a matching session without showing any\n * screen and checks which method proved it. Read the token directly only\n * from code that cannot show UI, and treat `null` as \"let the UI layer\n * ask\".\n *\n * @param request - Optional maximum session age in milliseconds, measured\n * from when the token was obtained. Zero always requires a new ceremony.\n * @returns A live verification token, or null when no reusable session\n * exists.\n */\nexport type AuthenticationControllerGetVerificationTokenAction = {\n type: `AuthenticationController:getVerificationToken`;\n handler: AuthenticationController['getVerificationToken'];\n};\n\n/**\n * Clears every in-memory verification session and its expiration timer,\n * and the tokens kept for enrollments in progress.\n */\nexport type AuthenticationControllerClearVerificationSessionAction = {\n type: `AuthenticationController:clearVerificationSession`;\n handler: AuthenticationController['clearVerificationSession'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Resets the controller to `defaultState`. Clients call this on wallet reset\n * so the next wallet starts unsigned with both pairing gates re-armed.\n */\nexport type AuthenticationControllerClearStateAction = {\n type: `AuthenticationController:clearState`;\n handler: AuthenticationController['clearState'];\n};\n\n/**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\n/**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\nexport type AuthenticationControllerRefreshCanonicalProfileIdAction = {\n type: `AuthenticationController:refreshCanonicalProfileId`;\n handler: AuthenticationController['refreshCanonicalProfileId'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\n};\n\n/**\n * Mints a partner identity token for the specified SRP, logging in if needed.\n *\n * Calls `POST /api/v2/oidc/token` with the Hydra login bearer and returns\n * the minted `access_token`. Email on live tokens is under JWT `ext`.\n * HTTP 422 throws `EmailRequiredError` when this profile has no\n * verified email.\n *\n * @param claims - Claim names to embed. Only `email` is supported.\n * @param audience - Partner audience (`kyc` or `iron`).\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The partner identity access token.\n */\nexport type AuthenticationControllerGetPartnerIdentityTokenAction = {\n type: `AuthenticationController:getPartnerIdentityToken`;\n handler: AuthenticationController['getPartnerIdentityToken'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerExchangeSocialAccessTokenAction\n | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerRefreshEnrolledCredentialsAction\n | AuthenticationControllerBeginCredentialEnrollmentAction\n | AuthenticationControllerCompleteCredentialEnrollmentAction\n | AuthenticationControllerBeginCredentialVerificationAction\n | AuthenticationControllerCompleteCredentialVerificationAction\n | AuthenticationControllerGetVerificationTokenAction\n | AuthenticationControllerClearVerificationSessionAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerClearStateAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerGetPartnerIdentityTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
|
|
1
|
+
{"version":3,"file":"AuthenticationController-method-action-types.js","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController.js';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\n/**\n * Exchanges the social access token SeedlessOnboarding holds for the\n * wallet's Google/Apple/Telegram login (`POST /api/v2/social/login`) for an\n * access token and the canonical profile it is paired to. Shows no UI and\n * stores nothing: SRP sessions remain the source of truth for\n * `getBearerToken`.\n *\n * Throws when the wallet has no social vault or no social token, and\n * `SocialIdentifierNotPairedError` when the identifier was never paired to\n * a profile.\n *\n * @returns The access token and canonical profile.\n */\nexport type AuthenticationControllerExchangeSocialAccessTokenAction = {\n type: `AuthenticationController:exchangeSocialAccessToken`;\n handler: AuthenticationController['exchangeSocialAccessToken'];\n};\n\n/**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\nexport type AuthenticationControllerRequestProfilePairingAction = {\n type: `AuthenticationController:requestProfilePairing`;\n handler: AuthenticationController['requestProfilePairing'];\n};\n\n/**\n * Refreshes credentials enrolled on the canonical profile.\n *\n * @returns The current supported credentials.\n */\nexport type AuthenticationControllerRefreshEnrolledCredentialsAction = {\n type: `AuthenticationController:refreshEnrolledCredentials`;\n handler: AuthenticationController['refreshEnrolledCredentials'];\n};\n\n/**\n * Removes a credential from the profile and caches the credentials left.\n *\n * The server requires a verification proven with another type of credential\n * (`cross_type_step_up_required` otherwise) and refuses to remove the last\n * one (`last_credential`). This sends the verification session: without\n * one, it throws a `StepUpRequiredError` (`aal2_required`) without calling\n * the server. The caller verifies with another method through the client\n * MFA kit first, which decides how recent that verification must be.\n *\n * @param request - The credential's `id`, and the trace reason.\n * @returns The credentials left.\n */\nexport type AuthenticationControllerRemoveCredentialAction = {\n type: `AuthenticationController:removeCredential`;\n handler: AuthenticationController['removeCredential'];\n};\n\n/**\n * Begins enrollment of a passkey, email OTP or authenticator app (TOTP)\n * credential.\n *\n * @param request - Credential, optional email address, and trace reason.\n * @returns A challenge for the client-owned ceremony.\n */\nexport type AuthenticationControllerBeginCredentialEnrollmentAction = {\n type: `AuthenticationController:beginCredentialEnrollment`;\n handler: AuthenticationController['beginCredentialEnrollment'];\n};\n\n/**\n * Completes credential enrollment and refreshes the credential cache.\n *\n * It is sent with the verification token that began the enrollment, if\n * any: once a factor is enrolled, the server requires AAL2 for both steps.\n *\n * The server returns an assertion for the new credential, which opens a\n * verification session like `completeCredentialVerification`, replacing\n * any earlier one. If that exchange fails, the earlier session is kept:\n * the credential is enrolled either way.\n *\n * A cache-refresh failure does not undo successful enrollment. Email\n * enrollment invalidates the primary SRP session *after* refresh so the\n * credentials call can reuse the still-valid access token; the next token\n * fetch then includes the newly verified email claim. That invalidation\n * happens even if the session ends mid-request: the enrollment succeeded\n * on the server, so a token cached across a lock must not be reused\n * without the new claim.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The refreshed credentials, or the existing cache if refresh fails.\n */\nexport type AuthenticationControllerCompleteCredentialEnrollmentAction = {\n type: `AuthenticationController:completeCredentialEnrollment`;\n handler: AuthenticationController['completeCredentialEnrollment'];\n};\n\n/**\n * Begins verification with an enrolled credential.\n *\n * @param request - Credential type and trace reason.\n * @returns A challenge for the client-owned ceremony.\n */\nexport type AuthenticationControllerBeginCredentialVerificationAction = {\n type: `AuthenticationController:beginCredentialVerification`;\n handler: AuthenticationController['beginCredentialVerification'];\n};\n\n/**\n * Completes verification and opens a short-lived verification session.\n *\n * The assertion returned by the MFA service is exchanged at Hydra for an\n * access token. Its assurance level is not checked: the services receiving\n * the token enforce their own requirements. The token itself never enters\n * controller state.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The verification token.\n */\nexport type AuthenticationControllerCompleteCredentialVerificationAction = {\n type: `AuthenticationController:completeCredentialVerification`;\n handler: AuthenticationController['completeCredentialVerification'];\n};\n\n/**\n * Returns the active verification token when it meets the requested\n * freshness.\n *\n * Low-level: features should go through the client MFA kit\n * (`verifyOrEnroll`), which reuses a matching session without showing any\n * screen and checks which method proved it. Read the token directly only\n * from code that cannot show UI, and treat `null` as \"let the UI layer\n * ask\".\n *\n * @param request - Optional maximum session age in milliseconds, measured\n * from when the token was obtained. Zero always requires a new ceremony.\n * @returns A live verification token, or null when no reusable session\n * exists.\n */\nexport type AuthenticationControllerGetVerificationTokenAction = {\n type: `AuthenticationController:getVerificationToken`;\n handler: AuthenticationController['getVerificationToken'];\n};\n\n/**\n * Requests an approval bound to one request (`POST /api/v2/mfa/approvals`),\n * for the services in `audiences`, such as recovery or signing.\n *\n * Shows no UI. When `requireVerification` is set, the approval proves the\n * verification session: without one, this throws a `StepUpRequiredError`\n * (`aal2_required`) without calling the server. The server answers the same\n * way when the verification is too old for it, and that session is then\n * dropped. Either way, the caller verifies through the client MFA kit\n * (`verifyOrEnroll`), which runs a new ceremony, and calls again.\n *\n * @param request - Request digest, audiences, whether a recent verification\n * is required, whether to return identifiers, and the trace reason.\n * @returns The approval, its lifetime and the recovery identifiers.\n */\nexport type AuthenticationControllerRequestMfaApprovalAction = {\n type: `AuthenticationController:requestMfaApproval`;\n handler: AuthenticationController['requestMfaApproval'];\n};\n\n/**\n * Clears every in-memory verification session and its expiration timer,\n * and the tokens kept for enrollments in progress.\n */\nexport type AuthenticationControllerClearVerificationSessionAction = {\n type: `AuthenticationController:clearVerificationSession`;\n handler: AuthenticationController['clearVerificationSession'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Resets the controller to `defaultState`. Clients call this on wallet reset\n * so the next wallet starts unsigned with both pairing gates re-armed.\n */\nexport type AuthenticationControllerClearStateAction = {\n type: `AuthenticationController:clearState`;\n handler: AuthenticationController['clearState'];\n};\n\n/**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\n/**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\nexport type AuthenticationControllerRefreshCanonicalProfileIdAction = {\n type: `AuthenticationController:refreshCanonicalProfileId`;\n handler: AuthenticationController['refreshCanonicalProfileId'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\n};\n\n/**\n * Mints a partner identity token for the specified SRP, logging in if needed.\n *\n * Calls `POST /api/v2/oidc/token` with the Hydra login bearer and returns\n * the minted `access_token`. Email on live tokens is under JWT `ext`.\n * HTTP 422 throws `EmailRequiredError` when this profile has no\n * verified email.\n *\n * @param claims - Claim names to embed. Only `email` is supported.\n * @param audience - Partner audience (`kyc` or `iron`).\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The partner identity access token.\n */\nexport type AuthenticationControllerGetPartnerIdentityTokenAction = {\n type: `AuthenticationController:getPartnerIdentityToken`;\n handler: AuthenticationController['getPartnerIdentityToken'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerExchangeSocialAccessTokenAction\n | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerRefreshEnrolledCredentialsAction\n | AuthenticationControllerRemoveCredentialAction\n | AuthenticationControllerBeginCredentialEnrollmentAction\n | AuthenticationControllerCompleteCredentialEnrollmentAction\n | AuthenticationControllerBeginCredentialVerificationAction\n | AuthenticationControllerCompleteCredentialVerificationAction\n | AuthenticationControllerGetVerificationTokenAction\n | AuthenticationControllerRequestMfaApprovalAction\n | AuthenticationControllerClearVerificationSessionAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerClearStateAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerGetPartnerIdentityTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
|
|
@@ -4,7 +4,7 @@ import type { TraceCallback } from '@metamask/controller-utils';
|
|
|
4
4
|
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from '@metamask/keyring-controller';
|
|
5
5
|
import type { Messenger } from '@metamask/messenger';
|
|
6
6
|
import type { SeedlessOnboardingControllerGetAccessTokenAction, SeedlessOnboardingControllerGetStateAction } from '@metamask/seedless-onboarding-controller';
|
|
7
|
-
import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage, OidcTokenAudience, OidcTokenClaims, BeginEnrollmentRequest, CompleteEnrollmentRequest, EnrolledCredential, EnrollmentChallenge, BeginVerificationRequest, CompleteVerificationRequest, VerificationToken, GetVerificationTokenRequest, VerificationChallenge } from '../../sdk/index.js';
|
|
7
|
+
import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage, OidcTokenAudience, OidcTokenClaims, BeginEnrollmentRequest, CompleteEnrollmentRequest, EnrolledCredential, EnrollmentChallenge, BeginVerificationRequest, CompleteVerificationRequest, VerificationToken, GetVerificationTokenRequest, MfaApproval, RequestMfaApprovalRequest, RemoveCredentialRequest, VerificationChallenge } from '../../sdk/index.js';
|
|
8
8
|
import { Env } from '../../sdk/index.js';
|
|
9
9
|
import type { MetaMetricsAuth } from '../../shared/types/services.js';
|
|
10
10
|
import { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types.js';
|
|
@@ -121,6 +121,20 @@ export declare class AuthenticationController extends BaseController<typeof cont
|
|
|
121
121
|
* @returns The current supported credentials.
|
|
122
122
|
*/
|
|
123
123
|
refreshEnrolledCredentials(): Promise<EnrolledCredential[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Removes a credential from the profile and caches the credentials left.
|
|
126
|
+
*
|
|
127
|
+
* The server requires a verification proven with another type of credential
|
|
128
|
+
* (`cross_type_step_up_required` otherwise) and refuses to remove the last
|
|
129
|
+
* one (`last_credential`). This sends the verification session: without
|
|
130
|
+
* one, it throws a `StepUpRequiredError` (`aal2_required`) without calling
|
|
131
|
+
* the server. The caller verifies with another method through the client
|
|
132
|
+
* MFA kit first, which decides how recent that verification must be.
|
|
133
|
+
*
|
|
134
|
+
* @param request - The credential's `id`, and the trace reason.
|
|
135
|
+
* @returns The credentials left.
|
|
136
|
+
*/
|
|
137
|
+
removeCredential(request: RemoveCredentialRequest): Promise<EnrolledCredential[]>;
|
|
124
138
|
/**
|
|
125
139
|
* Begins enrollment of a passkey, email OTP or authenticator app (TOTP)
|
|
126
140
|
* credential.
|
|
@@ -187,6 +201,22 @@ export declare class AuthenticationController extends BaseController<typeof cont
|
|
|
187
201
|
* exists.
|
|
188
202
|
*/
|
|
189
203
|
getVerificationToken(request?: GetVerificationTokenRequest): VerificationToken | null;
|
|
204
|
+
/**
|
|
205
|
+
* Requests an approval bound to one request (`POST /api/v2/mfa/approvals`),
|
|
206
|
+
* for the services in `audiences`, such as recovery or signing.
|
|
207
|
+
*
|
|
208
|
+
* Shows no UI. When `requireVerification` is set, the approval proves the
|
|
209
|
+
* verification session: without one, this throws a `StepUpRequiredError`
|
|
210
|
+
* (`aal2_required`) without calling the server. The server answers the same
|
|
211
|
+
* way when the verification is too old for it, and that session is then
|
|
212
|
+
* dropped. Either way, the caller verifies through the client MFA kit
|
|
213
|
+
* (`verifyOrEnroll`), which runs a new ceremony, and calls again.
|
|
214
|
+
*
|
|
215
|
+
* @param request - Request digest, audiences, whether a recent verification
|
|
216
|
+
* is required, whether to return identifiers, and the trace reason.
|
|
217
|
+
* @returns The approval, its lifetime and the recovery identifiers.
|
|
218
|
+
*/
|
|
219
|
+
requestMfaApproval(request: RequestMfaApprovalRequest): Promise<MfaApproval>;
|
|
190
220
|
/**
|
|
191
221
|
* Clears every in-memory verification session and its expiration timer,
|
|
192
222
|
* and the tokens kept for enrollments in progress.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,4BAA4B,CAAC;AAE9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,0CAA0C,EAC3C,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,gDAAgD,EAChD,0CAA0C,EAC3C,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,4BAA4B,CAAC;AAE9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,0CAA0C,EAC3C,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,gDAAgD,EAChD,0CAA0C,EAC3C,MAAM,0CAA0C,CAAC;AAclD,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EAIZ,WAAW,EACX,kBAAk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AAC,kBAAkB,CAAC,CAI7B;IAED;;;;;;;;;;OAUG;IACU,uBAAuB,CAClC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAIjB;IAED;;;;;;;;;;;;OAYG;IACU,uBAAuB,CAClC,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,iBAAiB,EAC3B,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAQjB;IAEM,UAAU,IAAI,OAAO,CAE3B;CA8EF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseController } from '@metamask/base-controller';
|
|
2
2
|
import { selectHdKeyringEntropySourceIds } from '@metamask/keyring-controller';
|
|
3
|
-
import { BeginEnrollmentRequestStruct, CompleteEnrollmentRequestStruct, assertValidMfaRequest, BeginVerificationRequestStruct, CompleteVerificationRequestStruct, GetVerificationTokenRequestStruct, parseVerificationTokenClaims, } from '../../sdk/authentication-jwt-bearer/mfa/schemas.js';
|
|
4
|
-
import { assertMessageStartsWithMetamask, AuthType, Env, JwtBearerAuth, PairConflictError, getMfaErrorCode, VerificationTokenInvalidError, } from '../../sdk/index.js';
|
|
3
|
+
import { BeginEnrollmentRequestStruct, CompleteEnrollmentRequestStruct, assertValidMfaRequest, BeginVerificationRequestStruct, CompleteVerificationRequestStruct, GetVerificationTokenRequestStruct, RequestMfaApprovalRequestStruct, RemoveCredentialRequestStruct, parseVerificationTokenClaims, } from '../../sdk/authentication-jwt-bearer/mfa/schemas.js';
|
|
4
|
+
import { assertMessageStartsWithMetamask, AuthType, Env, JwtBearerAuth, PairConflictError, StepUpRequiredError, getMfaErrorCode, VerificationTokenInvalidError, } from '../../sdk/index.js';
|
|
5
5
|
import { decodeJwtPayload } from '../../sdk/utils/jwt.js';
|
|
6
6
|
import { toErrorMessage } from '../../sdk/utils/to-error-message.js';
|
|
7
7
|
import { getPrimaryHdKeyringEntropySourceId } from '../../shared/utils/entropy-source.js';
|
|
@@ -102,6 +102,8 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
102
102
|
'beginCredentialVerification',
|
|
103
103
|
'completeCredentialVerification',
|
|
104
104
|
'getVerificationToken',
|
|
105
|
+
'requestMfaApproval',
|
|
106
|
+
'removeCredential',
|
|
105
107
|
'clearVerificationSession',
|
|
106
108
|
];
|
|
107
109
|
/**
|
|
@@ -699,15 +701,51 @@ export class AuthenticationController extends BaseController {
|
|
|
699
701
|
if (refreshSeq !== this.#credentialsRefreshSeq) {
|
|
700
702
|
return this.#getEnrolledCredentials();
|
|
701
703
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
+
this.#setEnrolledCredentials(credentials);
|
|
705
|
+
return credentials;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Removes a credential from the profile and caches the credentials left.
|
|
709
|
+
*
|
|
710
|
+
* The server requires a verification proven with another type of credential
|
|
711
|
+
* (`cross_type_step_up_required` otherwise) and refuses to remove the last
|
|
712
|
+
* one (`last_credential`). This sends the verification session: without
|
|
713
|
+
* one, it throws a `StepUpRequiredError` (`aal2_required`) without calling
|
|
714
|
+
* the server. The caller verifies with another method through the client
|
|
715
|
+
* MFA kit first, which decides how recent that verification must be.
|
|
716
|
+
*
|
|
717
|
+
* @param request - The credential's `id`, and the trace reason.
|
|
718
|
+
* @returns The credentials left.
|
|
719
|
+
*/
|
|
720
|
+
async removeCredential(request) {
|
|
721
|
+
this.#assertIsUnlocked('removeCredential');
|
|
722
|
+
const sessionEpoch = this.#authSessionEpoch;
|
|
723
|
+
assertValidMfaRequest(request, RemoveCredentialRequestStruct);
|
|
724
|
+
const accessToken = this.getVerificationToken()?.accessToken;
|
|
725
|
+
if (!accessToken) {
|
|
726
|
+
throw new StepUpRequiredError('removeCredential requires a verification session');
|
|
727
|
+
}
|
|
728
|
+
const type = this.#getEnrolledCredentials().find(({ id }) => id === request.credentialId)?.type ?? 'unknown';
|
|
729
|
+
const credentials = await this.#runMfaRequest('MFA Credential Remove', request.reason.operation, type, async () => await this.#auth.deleteMfaCredential(request.credentialId, accessToken));
|
|
730
|
+
this.#assertAuthSessionEpoch(sessionEpoch, 'removeCredential');
|
|
731
|
+
// A refresh still in flight may have read the list before the removal.
|
|
732
|
+
this.#credentialsRefreshSeq += 1;
|
|
733
|
+
this.#setEnrolledCredentials(credentials);
|
|
734
|
+
return credentials;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Caches the credential list. Skips the write when nothing changed so
|
|
738
|
+
* subscribers are not woken up by a fresh-but-identical array.
|
|
739
|
+
*
|
|
740
|
+
* @param credentials - The credentials from the server.
|
|
741
|
+
*/
|
|
742
|
+
#setEnrolledCredentials(credentials) {
|
|
704
743
|
if (JSON.stringify(credentials) !==
|
|
705
744
|
JSON.stringify(this.#getEnrolledCredentials())) {
|
|
706
745
|
this.update((state) => {
|
|
707
746
|
state.enrolledCredentials = credentials;
|
|
708
747
|
});
|
|
709
748
|
}
|
|
710
|
-
return credentials;
|
|
711
749
|
}
|
|
712
750
|
/**
|
|
713
751
|
* Begins enrollment of a passkey, email OTP or authenticator app (TOTP)
|
|
@@ -914,6 +952,53 @@ export class AuthenticationController extends BaseController {
|
|
|
914
952
|
}
|
|
915
953
|
return session.token;
|
|
916
954
|
}
|
|
955
|
+
/**
|
|
956
|
+
* Requests an approval bound to one request (`POST /api/v2/mfa/approvals`),
|
|
957
|
+
* for the services in `audiences`, such as recovery or signing.
|
|
958
|
+
*
|
|
959
|
+
* Shows no UI. When `requireVerification` is set, the approval proves the
|
|
960
|
+
* verification session: without one, this throws a `StepUpRequiredError`
|
|
961
|
+
* (`aal2_required`) without calling the server. The server answers the same
|
|
962
|
+
* way when the verification is too old for it, and that session is then
|
|
963
|
+
* dropped. Either way, the caller verifies through the client MFA kit
|
|
964
|
+
* (`verifyOrEnroll`), which runs a new ceremony, and calls again.
|
|
965
|
+
*
|
|
966
|
+
* @param request - Request digest, audiences, whether a recent verification
|
|
967
|
+
* is required, whether to return identifiers, and the trace reason.
|
|
968
|
+
* @returns The approval, its lifetime and the recovery identifiers.
|
|
969
|
+
*/
|
|
970
|
+
async requestMfaApproval(request) {
|
|
971
|
+
this.#assertIsUnlocked('requestMfaApproval');
|
|
972
|
+
const sessionEpoch = this.#authSessionEpoch;
|
|
973
|
+
assertValidMfaRequest(request, RequestMfaApprovalRequestStruct);
|
|
974
|
+
const verification = request.requireVerification
|
|
975
|
+
? this.getVerificationToken()
|
|
976
|
+
: null;
|
|
977
|
+
if (request.requireVerification && !verification) {
|
|
978
|
+
throw new StepUpRequiredError('requestMfaApproval requires a verification session');
|
|
979
|
+
}
|
|
980
|
+
const approval = await this.#runMfaRequest('MFA Approval', request.reason.operation, verification ? verification.claims.amr.join(',') : 'none', async () => await this.#auth.requestMfaApproval({
|
|
981
|
+
request_hash: request.requestHash,
|
|
982
|
+
audiences: request.audiences,
|
|
983
|
+
...(request.includeIdentifiers === undefined
|
|
984
|
+
? {}
|
|
985
|
+
: { include_identifiers: request.includeIdentifiers }),
|
|
986
|
+
}, {
|
|
987
|
+
entropySourceId: this.#getPrimaryEntropySourceId(),
|
|
988
|
+
accessToken: verification?.accessToken,
|
|
989
|
+
})).catch((error) => {
|
|
990
|
+
// The server found the verification too old: drop it, so the caller's
|
|
991
|
+
// next verification runs a new ceremony instead of reusing it. A
|
|
992
|
+
// session opened meanwhile is kept.
|
|
993
|
+
if (getMfaErrorCode(error) === 'aal2_required' &&
|
|
994
|
+
this.#verificationSessions.get(DEFAULT_AUDIENCE)?.token === verification) {
|
|
995
|
+
this.#dropVerificationSession(DEFAULT_AUDIENCE);
|
|
996
|
+
}
|
|
997
|
+
throw error;
|
|
998
|
+
});
|
|
999
|
+
this.#assertAuthSessionEpoch(sessionEpoch, 'requestMfaApproval');
|
|
1000
|
+
return approval;
|
|
1001
|
+
}
|
|
917
1002
|
/**
|
|
918
1003
|
* Opens the verification session for the lifetime the server gave the token.
|
|
919
1004
|
* It is measured from `expires_in` on the local clock rather than read from
|