@metamask-previews/profile-sync-controller 36.0.0-preview-677dff22f → 36.1.0-preview-a2a3d82
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 +14 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts +48 -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 +38 -0
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.js +77 -3
- 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 +9 -3
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js +12 -11
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -1
- package/dist/sdk/authentication.d.ts +3 -3
- package/dist/sdk/authentication.d.ts.map +1 -1
- package/dist/sdk/authentication.js +6 -6
- package/dist/sdk/authentication.js.map +1 -1
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [36.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `AuthenticationController.refreshSocialLoginCredentials`, `beginSocialLoginVerification` and `completeSocialLoginVerification`, also exposed as `AuthenticationController:*` messenger actions, which verify an enrolled MFA credential while the wallet is locked, for the recovery of a social login wallet ([#11371](https://github.com/MetaMask/core/pull/11371))
|
|
15
|
+
- They take the access token from the social login (see `exchangeSocialAccessToken`) at each call, so no keyring or signing is involved, and accept no token from the caller
|
|
16
|
+
- They throw when the wallet is unlocked: unlocked features keep using `refreshEnrolledCredentials`, `beginCredentialVerification` and `completeCredentialVerification`
|
|
17
|
+
- `completeSocialLoginVerification` returns the verification token without opening a verification session, so nothing proven while locked is readable once the wallet unlocks
|
|
18
|
+
- Nothing is cached in state, and enrollment stays unavailable while the wallet is locked
|
|
19
|
+
- Exports the `AuthenticationControllerRefreshSocialLoginCredentialsAction`, `AuthenticationControllerBeginSocialLoginVerificationAction` and `AuthenticationControllerCompleteSocialLoginVerificationAction` types
|
|
20
|
+
|
|
10
21
|
### Changed
|
|
11
22
|
|
|
23
|
+
- `JwtBearerAuth.getMfaCredentials`, `beginMfaVerification` and `completeMfaVerification` accept an optional `accessToken` to use instead of signing in with the entropy source ([#11371](https://github.com/MetaMask/core/pull/11371))
|
|
12
24
|
- Bump `@metamask/utils` from `^12.0.0` to `^12.0.1` ([#11107](https://github.com/MetaMask/core/pull/11107))
|
|
13
25
|
|
|
14
26
|
## [36.0.0]
|
|
@@ -1120,7 +1132,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1120
1132
|
|
|
1121
1133
|
- Initial release
|
|
1122
1134
|
|
|
1123
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@36.
|
|
1135
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@36.1.0...HEAD
|
|
1136
|
+
[36.1.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@36.0.0...@metamask/profile-sync-controller@36.1.0
|
|
1124
1137
|
[36.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@35.0.0...@metamask/profile-sync-controller@36.0.0
|
|
1125
1138
|
[35.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@34.1.0...@metamask/profile-sync-controller@35.0.0
|
|
1126
1139
|
[34.1.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@34.0.3...@metamask/profile-sync-controller@34.1.0
|
|
@@ -121,6 +121,53 @@ export type AuthenticationControllerCompleteCredentialVerificationAction = {
|
|
|
121
121
|
type: `AuthenticationController:completeCredentialVerification`;
|
|
122
122
|
handler: AuthenticationController['completeCredentialVerification'];
|
|
123
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* Refreshes the credentials enrolled on the profile a social login is
|
|
126
|
+
* paired to, while the wallet is locked, for the recovery of a social login
|
|
127
|
+
* wallet.
|
|
128
|
+
*
|
|
129
|
+
* Takes its access token from the social login (see
|
|
130
|
+
* `exchangeSocialAccessToken`), so no keyring or signing is involved. Throws
|
|
131
|
+
* when the wallet is unlocked: unlocked features use
|
|
132
|
+
* `refreshEnrolledCredentials`. Nothing is cached.
|
|
133
|
+
*
|
|
134
|
+
* @returns The current supported credentials.
|
|
135
|
+
*/
|
|
136
|
+
export type AuthenticationControllerRefreshSocialLoginCredentialsAction = {
|
|
137
|
+
type: `AuthenticationController:refreshSocialLoginCredentials`;
|
|
138
|
+
handler: AuthenticationController['refreshSocialLoginCredentials'];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Begins verification with an enrolled credential, while the wallet is
|
|
142
|
+
* locked, for the recovery of a social login wallet.
|
|
143
|
+
*
|
|
144
|
+
* Takes its access token from the social login, like
|
|
145
|
+
* `refreshSocialLoginCredentials`. Throws when the wallet is unlocked:
|
|
146
|
+
* unlocked features use `beginCredentialVerification`.
|
|
147
|
+
*
|
|
148
|
+
* @param request - Credential type and trace reason.
|
|
149
|
+
* @returns A challenge for the client-owned ceremony.
|
|
150
|
+
*/
|
|
151
|
+
export type AuthenticationControllerBeginSocialLoginVerificationAction = {
|
|
152
|
+
type: `AuthenticationController:beginSocialLoginVerification`;
|
|
153
|
+
handler: AuthenticationController['beginSocialLoginVerification'];
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Completes verification while the wallet is locked and returns the
|
|
157
|
+
* verification token, for the recovery of a social login wallet.
|
|
158
|
+
*
|
|
159
|
+
* Unlike `completeCredentialVerification`, no verification session is
|
|
160
|
+
* opened: the token goes to the caller alone, so nothing proven here is
|
|
161
|
+
* readable once the wallet unlocks. Takes its access token from the social
|
|
162
|
+
* login. Throws when the wallet is unlocked.
|
|
163
|
+
*
|
|
164
|
+
* @param request - Flow identifier, platform or email proof, and trace reason.
|
|
165
|
+
* @returns The verification token.
|
|
166
|
+
*/
|
|
167
|
+
export type AuthenticationControllerCompleteSocialLoginVerificationAction = {
|
|
168
|
+
type: `AuthenticationController:completeSocialLoginVerification`;
|
|
169
|
+
handler: AuthenticationController['completeSocialLoginVerification'];
|
|
170
|
+
};
|
|
124
171
|
/**
|
|
125
172
|
* Returns the active verification token when it meets the requested
|
|
126
173
|
* freshness.
|
|
@@ -274,5 +321,5 @@ export type AuthenticationControllerIsSignedInAction = {
|
|
|
274
321
|
/**
|
|
275
322
|
* Union of all AuthenticationController action types.
|
|
276
323
|
*/
|
|
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;
|
|
324
|
+
export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerExchangeSocialAccessTokenAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerRefreshEnrolledCredentialsAction | AuthenticationControllerRemoveCredentialAction | AuthenticationControllerBeginCredentialEnrollmentAction | AuthenticationControllerCompleteCredentialEnrollmentAction | AuthenticationControllerBeginCredentialVerificationAction | AuthenticationControllerCompleteCredentialVerificationAction | AuthenticationControllerRefreshSocialLoginCredentialsAction | AuthenticationControllerBeginSocialLoginVerificationAction | AuthenticationControllerCompleteSocialLoginVerificationAction | AuthenticationControllerGetVerificationTokenAction | AuthenticationControllerRequestMfaApprovalAction | AuthenticationControllerClearVerificationSessionAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerClearStateAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerGetPartnerIdentityTokenAction | AuthenticationControllerIsSignedInAction;
|
|
278
325
|
//# 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,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,w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MAAM,MAAM,qDAAqD,GAAG;IAClE,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,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
|
+
{"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;CACh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AAC"}
|
|
@@ -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 * 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"]}
|
|
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 * Refreshes the credentials enrolled on the profile a social login is\n * paired to, while the wallet is locked, for the recovery of a social login\n * wallet.\n *\n * Takes its access token from the social login (see\n * `exchangeSocialAccessToken`), so no keyring or signing is involved. Throws\n * when the wallet is unlocked: unlocked features use\n * `refreshEnrolledCredentials`. Nothing is cached.\n *\n * @returns The current supported credentials.\n */\nexport type AuthenticationControllerRefreshSocialLoginCredentialsAction = {\n type: `AuthenticationController:refreshSocialLoginCredentials`;\n handler: AuthenticationController['refreshSocialLoginCredentials'];\n};\n\n/**\n * Begins verification with an enrolled credential, while the wallet is\n * locked, for the recovery of a social login wallet.\n *\n * Takes its access token from the social login, like\n * `refreshSocialLoginCredentials`. Throws when the wallet is unlocked:\n * unlocked features use `beginCredentialVerification`.\n *\n * @param request - Credential type and trace reason.\n * @returns A challenge for the client-owned ceremony.\n */\nexport type AuthenticationControllerBeginSocialLoginVerificationAction = {\n type: `AuthenticationController:beginSocialLoginVerification`;\n handler: AuthenticationController['beginSocialLoginVerification'];\n};\n\n/**\n * Completes verification while the wallet is locked and returns the\n * verification token, for the recovery of a social login wallet.\n *\n * Unlike `completeCredentialVerification`, no verification session is\n * opened: the token goes to the caller alone, so nothing proven here is\n * readable once the wallet unlocks. Takes its access token from the social\n * login. Throws when the wallet is unlocked.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The verification token.\n */\nexport type AuthenticationControllerCompleteSocialLoginVerificationAction = {\n type: `AuthenticationController:completeSocialLoginVerification`;\n handler: AuthenticationController['completeSocialLoginVerification'];\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 | AuthenticationControllerRefreshSocialLoginCredentialsAction\n | AuthenticationControllerBeginSocialLoginVerificationAction\n | AuthenticationControllerCompleteSocialLoginVerificationAction\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"]}
|
|
@@ -185,6 +185,44 @@ export declare class AuthenticationController extends BaseController<typeof cont
|
|
|
185
185
|
* @returns The verification token.
|
|
186
186
|
*/
|
|
187
187
|
completeCredentialVerification(request: CompleteVerificationRequest): Promise<VerificationToken>;
|
|
188
|
+
/**
|
|
189
|
+
* Refreshes the credentials enrolled on the profile a social login is
|
|
190
|
+
* paired to, while the wallet is locked, for the recovery of a social login
|
|
191
|
+
* wallet.
|
|
192
|
+
*
|
|
193
|
+
* Takes its access token from the social login (see
|
|
194
|
+
* `exchangeSocialAccessToken`), so no keyring or signing is involved. Throws
|
|
195
|
+
* when the wallet is unlocked: unlocked features use
|
|
196
|
+
* `refreshEnrolledCredentials`. Nothing is cached.
|
|
197
|
+
*
|
|
198
|
+
* @returns The current supported credentials.
|
|
199
|
+
*/
|
|
200
|
+
refreshSocialLoginCredentials(): Promise<EnrolledCredential[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Begins verification with an enrolled credential, while the wallet is
|
|
203
|
+
* locked, for the recovery of a social login wallet.
|
|
204
|
+
*
|
|
205
|
+
* Takes its access token from the social login, like
|
|
206
|
+
* `refreshSocialLoginCredentials`. Throws when the wallet is unlocked:
|
|
207
|
+
* unlocked features use `beginCredentialVerification`.
|
|
208
|
+
*
|
|
209
|
+
* @param request - Credential type and trace reason.
|
|
210
|
+
* @returns A challenge for the client-owned ceremony.
|
|
211
|
+
*/
|
|
212
|
+
beginSocialLoginVerification(request: BeginVerificationRequest): Promise<VerificationChallenge>;
|
|
213
|
+
/**
|
|
214
|
+
* Completes verification while the wallet is locked and returns the
|
|
215
|
+
* verification token, for the recovery of a social login wallet.
|
|
216
|
+
*
|
|
217
|
+
* Unlike `completeCredentialVerification`, no verification session is
|
|
218
|
+
* opened: the token goes to the caller alone, so nothing proven here is
|
|
219
|
+
* readable once the wallet unlocks. Takes its access token from the social
|
|
220
|
+
* login. Throws when the wallet is unlocked.
|
|
221
|
+
*
|
|
222
|
+
* @param request - Flow identifier, platform or email proof, and trace reason.
|
|
223
|
+
* @returns The verification token.
|
|
224
|
+
*/
|
|
225
|
+
completeSocialLoginVerification(request: CompleteVerificationRequest): Promise<VerificationToken>;
|
|
188
226
|
/**
|
|
189
227
|
* Returns the active verification token when it meets the requested
|
|
190
228
|
* freshness.
|
|
@@ -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;AAclD,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EAIZ,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EACjB,2BAA2B,EAC3B,WAAW,EAGX,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../src/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
|
|
99
99
|
'refreshEnrolledCredentials',
|
|
100
|
+
'refreshSocialLoginCredentials',
|
|
100
101
|
'beginCredentialEnrollment',
|
|
101
102
|
'completeCredentialEnrollment',
|
|
102
103
|
'beginCredentialVerification',
|
|
103
104
|
'completeCredentialVerification',
|
|
105
|
+
'beginSocialLoginVerification',
|
|
106
|
+
'completeSocialLoginVerification',
|
|
104
107
|
'getVerificationToken',
|
|
105
108
|
'requestMfaApproval',
|
|
106
109
|
'removeCredential',
|
|
@@ -239,6 +242,11 @@ export class AuthenticationController extends BaseController {
|
|
|
239
242
|
throw new Error(`${methodName} - unable to proceed, wallet is locked`);
|
|
240
243
|
}
|
|
241
244
|
}
|
|
245
|
+
#assertIsLocked(methodName) {
|
|
246
|
+
if (this.#isUnlocked) {
|
|
247
|
+
throw new Error(`${methodName} - unable to proceed, the wallet is unlocked`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
242
250
|
#assertAuthSessionEpoch(epoch, methodName) {
|
|
243
251
|
if (!this.#isUnlocked || this.#authSessionEpoch !== epoch) {
|
|
244
252
|
throw new Error(`${methodName} - unable to proceed, the authenticated session ended`);
|
|
@@ -886,6 +894,62 @@ export class AuthenticationController extends BaseController {
|
|
|
886
894
|
methodName: 'completeCredentialVerification',
|
|
887
895
|
});
|
|
888
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* Refreshes the credentials enrolled on the profile a social login is
|
|
899
|
+
* paired to, while the wallet is locked, for the recovery of a social login
|
|
900
|
+
* wallet.
|
|
901
|
+
*
|
|
902
|
+
* Takes its access token from the social login (see
|
|
903
|
+
* `exchangeSocialAccessToken`), so no keyring or signing is involved. Throws
|
|
904
|
+
* when the wallet is unlocked: unlocked features use
|
|
905
|
+
* `refreshEnrolledCredentials`. Nothing is cached.
|
|
906
|
+
*
|
|
907
|
+
* @returns The current supported credentials.
|
|
908
|
+
*/
|
|
909
|
+
async refreshSocialLoginCredentials() {
|
|
910
|
+
this.#assertIsLocked('refreshSocialLoginCredentials');
|
|
911
|
+
const { token } = await this.exchangeSocialAccessToken();
|
|
912
|
+
return await this.#runMfaRequest('MFA Social Login Credentials Refresh', 'credentials.refresh', 'all', async () => await this.#auth.getMfaCredentials(undefined, token.accessToken));
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Begins verification with an enrolled credential, while the wallet is
|
|
916
|
+
* locked, for the recovery of a social login wallet.
|
|
917
|
+
*
|
|
918
|
+
* Takes its access token from the social login, like
|
|
919
|
+
* `refreshSocialLoginCredentials`. Throws when the wallet is unlocked:
|
|
920
|
+
* unlocked features use `beginCredentialVerification`.
|
|
921
|
+
*
|
|
922
|
+
* @param request - Credential type and trace reason.
|
|
923
|
+
* @returns A challenge for the client-owned ceremony.
|
|
924
|
+
*/
|
|
925
|
+
async beginSocialLoginVerification(request) {
|
|
926
|
+
this.#assertIsLocked('beginSocialLoginVerification');
|
|
927
|
+
assertValidMfaRequest(request, BeginVerificationRequestStruct);
|
|
928
|
+
const { token } = await this.exchangeSocialAccessToken();
|
|
929
|
+
return await this.#runMfaRequest('MFA Social Login Verification Begin', request.reason.operation, request.type, async () => await this.#auth.beginMfaVerification(request.type, undefined, token.accessToken));
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Completes verification while the wallet is locked and returns the
|
|
933
|
+
* verification token, for the recovery of a social login wallet.
|
|
934
|
+
*
|
|
935
|
+
* Unlike `completeCredentialVerification`, no verification session is
|
|
936
|
+
* opened: the token goes to the caller alone, so nothing proven here is
|
|
937
|
+
* readable once the wallet unlocks. Takes its access token from the social
|
|
938
|
+
* login. Throws when the wallet is unlocked.
|
|
939
|
+
*
|
|
940
|
+
* @param request - Flow identifier, platform or email proof, and trace reason.
|
|
941
|
+
* @returns The verification token.
|
|
942
|
+
*/
|
|
943
|
+
async completeSocialLoginVerification(request) {
|
|
944
|
+
this.#assertIsLocked('completeSocialLoginVerification');
|
|
945
|
+
assertValidMfaRequest(request, CompleteVerificationRequestStruct);
|
|
946
|
+
const { type } = request.proof;
|
|
947
|
+
const { operation } = request.reason;
|
|
948
|
+
const { token } = await this.exchangeSocialAccessToken();
|
|
949
|
+
const assertion = await this.#runMfaRequest('MFA Social Login Verification Complete', operation, type, async () => await this.#auth.completeMfaVerification(request.flowId, request.proof, undefined, token.accessToken));
|
|
950
|
+
const accessToken = await this.#runMfaRequest('MFA Token Exchange', operation, type, async () => await this.#auth.exchangeMfaAssertion(assertion.token));
|
|
951
|
+
return this.#toVerificationToken(accessToken);
|
|
952
|
+
}
|
|
889
953
|
/**
|
|
890
954
|
* Exchanges an MFA assertion at Hydra and opens the verification session
|
|
891
955
|
* with the resulting token.
|
|
@@ -901,6 +965,18 @@ export class AuthenticationController extends BaseController {
|
|
|
901
965
|
async #openVerificationSessionFromAssertion(assertion, { operation, type, sessionEpoch, methodName, }) {
|
|
902
966
|
const accessToken = await this.#runMfaRequest('MFA Token Exchange', operation, type, async () => await this.#auth.exchangeMfaAssertion(assertion.token));
|
|
903
967
|
this.#assertAuthSessionEpoch(sessionEpoch, methodName);
|
|
968
|
+
const token = this.#toVerificationToken(accessToken);
|
|
969
|
+
this.#openVerificationSession(token);
|
|
970
|
+
return token;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Checks the token a verification assertion was exchanged for and reads its
|
|
974
|
+
* claims.
|
|
975
|
+
*
|
|
976
|
+
* @param accessToken - Token returned by the assertion exchange.
|
|
977
|
+
* @returns The verification token.
|
|
978
|
+
*/
|
|
979
|
+
#toVerificationToken(accessToken) {
|
|
904
980
|
let decodedClaims;
|
|
905
981
|
try {
|
|
906
982
|
decodedClaims = decodeJwtPayload(accessToken.accessToken);
|
|
@@ -912,9 +988,7 @@ export class AuthenticationController extends BaseController {
|
|
|
912
988
|
if (!Number.isFinite(accessToken.expiresIn) || accessToken.expiresIn <= 0) {
|
|
913
989
|
throw new VerificationTokenInvalidError('Verification token has no remaining lifetime');
|
|
914
990
|
}
|
|
915
|
-
|
|
916
|
-
this.#openVerificationSession(token);
|
|
917
|
-
return token;
|
|
991
|
+
return { ...accessToken, claims };
|
|
918
992
|
}
|
|
919
993
|
/**
|
|
920
994
|
* Returns the active verification token when it meets the requested
|