@metamask/profile-sync-controller 32.1.0 → 32.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +17 -0
  3. package/auth/mocks/package.json +2 -2
  4. package/auth/package.json +2 -2
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts +80 -1
  6. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -1
  7. package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -1
  8. package/dist/controllers/authentication/AuthenticationController.d.ts +79 -2
  9. package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -1
  10. package/dist/controllers/authentication/AuthenticationController.js +340 -9
  11. package/dist/controllers/authentication/AuthenticationController.js.map +1 -1
  12. package/dist/controllers/authentication/index.d.ts +1 -1
  13. package/dist/controllers/authentication/index.d.ts.map +1 -1
  14. package/dist/controllers/authentication/index.js.map +1 -1
  15. package/dist/controllers/authentication/mocks/mockResponses.d.ts +5 -0
  16. package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +1 -1
  17. package/dist/controllers/authentication/mocks/mockResponses.js +26 -1
  18. package/dist/controllers/authentication/mocks/mockResponses.js.map +1 -1
  19. package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -1
  20. package/dist/controllers/user-storage/UserStorageController.js +6 -5
  21. package/dist/controllers/user-storage/UserStorageController.js.map +1 -1
  22. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts +56 -1
  23. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
  24. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +119 -1
  25. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -1
  26. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts +691 -0
  27. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts.map +1 -0
  28. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js +265 -0
  29. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js.map +1 -0
  30. package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts +104 -0
  31. package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts.map +1 -0
  32. package/dist/sdk/authentication-jwt-bearer/mfa/services.js +363 -0
  33. package/dist/sdk/authentication-jwt-bearer/mfa/services.js.map +1 -0
  34. package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts +125 -0
  35. package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts.map +1 -0
  36. package/dist/sdk/authentication-jwt-bearer/mfa/types.js +3 -0
  37. package/dist/sdk/authentication-jwt-bearer/mfa/types.js.map +1 -0
  38. package/dist/sdk/authentication.d.ts +15 -6
  39. package/dist/sdk/authentication.d.ts.map +1 -1
  40. package/dist/sdk/authentication.js +24 -0
  41. package/dist/sdk/authentication.js.map +1 -1
  42. package/dist/sdk/constants.d.ts +2 -0
  43. package/dist/sdk/constants.d.ts.map +1 -1
  44. package/dist/sdk/constants.js +2 -0
  45. package/dist/sdk/constants.js.map +1 -1
  46. package/dist/sdk/errors.d.ts +91 -0
  47. package/dist/sdk/errors.d.ts.map +1 -1
  48. package/dist/sdk/errors.js +161 -0
  49. package/dist/sdk/errors.js.map +1 -1
  50. package/dist/sdk/index.d.ts +3 -0
  51. package/dist/sdk/index.d.ts.map +1 -1
  52. package/dist/sdk/index.js +1 -0
  53. package/dist/sdk/index.js.map +1 -1
  54. package/dist/sdk/mocks/auth.d.ts +63 -0
  55. package/dist/sdk/mocks/auth.d.ts.map +1 -1
  56. package/dist/sdk/mocks/auth.js +90 -0
  57. package/dist/sdk/mocks/auth.js.map +1 -1
  58. package/dist/sdk/utils/as-record.d.ts +10 -0
  59. package/dist/sdk/utils/as-record.d.ts.map +1 -0
  60. package/dist/sdk/utils/as-record.js +14 -0
  61. package/dist/sdk/utils/as-record.js.map +1 -0
  62. package/dist/sdk/utils/jwt.d.ts +13 -0
  63. package/dist/sdk/utils/jwt.d.ts.map +1 -0
  64. package/dist/sdk/utils/jwt.js +21 -0
  65. package/dist/sdk/utils/jwt.js.map +1 -0
  66. package/dist/sdk/utils/to-error-message.d.ts +8 -0
  67. package/dist/sdk/utils/to-error-message.d.ts.map +1 -0
  68. package/dist/sdk/utils/to-error-message.js +10 -0
  69. package/dist/sdk/utils/to-error-message.js.map +1 -0
  70. package/dist/sdk/utils/validate-login-response.d.ts.map +1 -1
  71. package/dist/sdk/utils/validate-login-response.js +5 -7
  72. package/dist/sdk/utils/validate-login-response.js.map +1 -1
  73. package/dist/shared/storage-schema.d.ts +1 -0
  74. package/dist/shared/storage-schema.d.ts.map +1 -1
  75. package/dist/shared/storage-schema.js +1 -0
  76. package/dist/shared/storage-schema.js.map +1 -1
  77. package/dist/shared/utils/entropy-source.d.ts +3 -12
  78. package/dist/shared/utils/entropy-source.d.ts.map +1 -1
  79. package/dist/shared/utils/entropy-source.js +4 -17
  80. package/dist/shared/utils/entropy-source.js.map +1 -1
  81. package/package.json +5 -2
  82. package/sdk/package.json +2 -2
  83. package/user-storage/mocks/package.json +2 -2
  84. package/user-storage/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [32.2.0]
11
+
12
+ ### Added
13
+
14
+ - Add `beginStepUp`, `completeStepUp`, `getElevatedProfileToken` and `clearStepUpSession` to `AuthenticationController`, holding the elevated token in memory only behind a hard-expiring `stepUpSessionExpiresAt` state ([#10267](https://github.com/MetaMask/core/pull/10267))
15
+ - Add `refreshEnrolledCredentials`, `beginCredentialEnrollment` and `completeCredentialEnrollment` to `AuthenticationController`, backed by a memory-only `enrolledCredentials` state and an optional `trace` callback ([#10266](https://github.com/MetaMask/core/pull/10266))
16
+ - Add passkey and email OTP enrollment, verification, credential-list, and elevated-token exchange SDK methods ([#10265](https://github.com/MetaMask/core/pull/10265))
17
+ - Add validated MFA domain types and structured `MfaError` classes with a serialization-safe `mfaCode` ([#10264](https://github.com/MetaMask/core/pull/10264))
18
+ - Add `rampsOrders` to `USER_STORAGE_FEATURE_NAMES` ([#10227](https://github.com/MetaMask/core/pull/10227))
19
+
20
+ ## [32.1.1]
21
+
22
+ ### Changed
23
+
24
+ - Bump `@metamask/utils` from `^11.12.0` to `^12.0.0` ([#10192](https://github.com/MetaMask/core/pull/10192))
25
+
26
+ ### Fixed
27
+
28
+ - Point leftover `sdk`, `auth`, and `user-storage` subpath `package.json` files at the ESM build ([#10218](https://github.com/MetaMask/core/pull/10218))
29
+
10
30
  ## [32.1.0]
11
31
 
12
32
  ### Added
@@ -960,7 +980,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
960
980
 
961
981
  - Initial release
962
982
 
963
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@32.1.0...HEAD
983
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@32.2.0...HEAD
984
+ [32.2.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@32.1.1...@metamask/profile-sync-controller@32.2.0
985
+ [32.1.1]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@32.1.0...@metamask/profile-sync-controller@32.1.1
964
986
  [32.1.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@32.0.0...@metamask/profile-sync-controller@32.1.0
965
987
  [32.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@31.0.0...@metamask/profile-sync-controller@32.0.0
966
988
  [31.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@30.0.0...@metamask/profile-sync-controller@31.0.0
package/README.md CHANGED
@@ -42,6 +42,23 @@ import { ... } from '@metamask/profile-sync-controller/auth/mocks'
42
42
  import { ... } from '@metamask/profile-sync-controller/user-storage/mocks'
43
43
  ```
44
44
 
45
+ ## Multi-factor authentication
46
+
47
+ `AuthenticationController` exposes UI-independent primitives for passkey and
48
+ email OTP enrollment and step-up verification:
49
+
50
+ - `refreshEnrolledCredentials()` refreshes the in-memory credential list.
51
+ - `beginCredentialEnrollment()` and `completeCredentialEnrollment()` surround
52
+ a client-owned passkey ceremony or email-code screen.
53
+ - `beginStepUp()` and `completeStepUp()` verify an enrolled credential and
54
+ return an elevated profile token.
55
+ - `getElevatedProfileToken()` reuses a live elevated session when it satisfies
56
+ the caller's freshness requirement; `clearStepUpSession()` clears it.
57
+
58
+ Clients must retain the challenge `flowId`, perform the platform ceremony, and
59
+ send the resulting proof to the matching completion method. OTP codes,
60
+ passkey results, and elevated tokens are never persisted in controller state.
61
+
45
62
  ## Contributing
46
63
 
47
64
  This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
@@ -4,6 +4,6 @@
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
- "main": "../../dist/controllers/authentication/mocks/index.cjs",
8
- "types": "../../dist/controllers/authentication/mocks/index.d.cts"
7
+ "main": "../../dist/controllers/authentication/mocks/index.js",
8
+ "types": "../../dist/controllers/authentication/mocks/index.d.ts"
9
9
  }
package/auth/package.json CHANGED
@@ -4,6 +4,6 @@
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
- "main": "../dist/controllers/authentication/index.cjs",
8
- "types": "../dist/controllers/authentication/index.d.cts"
7
+ "main": "../dist/controllers/authentication/index.js",
8
+ "types": "../dist/controllers/authentication/index.d.ts"
9
9
  }
@@ -16,6 +16,85 @@ export type AuthenticationControllerRequestProfilePairingAction = {
16
16
  type: `AuthenticationController:requestProfilePairing`;
17
17
  handler: AuthenticationController['requestProfilePairing'];
18
18
  };
19
+ /**
20
+ * Refreshes credentials enrolled on the canonical profile.
21
+ *
22
+ * @returns The current supported credentials.
23
+ */
24
+ export type AuthenticationControllerRefreshEnrolledCredentialsAction = {
25
+ type: `AuthenticationController:refreshEnrolledCredentials`;
26
+ handler: AuthenticationController['refreshEnrolledCredentials'];
27
+ };
28
+ /**
29
+ * Begins enrollment of a passkey or email OTP credential.
30
+ *
31
+ * @param request - Credential, optional email address, and trace reason.
32
+ * @returns A challenge for the client-owned ceremony.
33
+ */
34
+ export type AuthenticationControllerBeginCredentialEnrollmentAction = {
35
+ type: `AuthenticationController:beginCredentialEnrollment`;
36
+ handler: AuthenticationController['beginCredentialEnrollment'];
37
+ };
38
+ /**
39
+ * Completes credential enrollment and refreshes the credential cache.
40
+ *
41
+ * A cache-refresh failure does not undo successful enrollment. Email
42
+ * enrollment invalidates the primary SRP session *after* refresh so the
43
+ * credentials call can reuse the still-valid access token; the next token
44
+ * fetch then includes the newly verified email claim. That invalidation
45
+ * happens even if the session ends mid-request: the enrollment succeeded
46
+ * on the server, so a token cached across a lock must not be reused
47
+ * without the new claim.
48
+ *
49
+ * @param request - Flow identifier, platform or email proof, and trace reason.
50
+ * @returns The refreshed credentials, or the existing cache if refresh fails.
51
+ */
52
+ export type AuthenticationControllerCompleteCredentialEnrollmentAction = {
53
+ type: `AuthenticationController:completeCredentialEnrollment`;
54
+ handler: AuthenticationController['completeCredentialEnrollment'];
55
+ };
56
+ /**
57
+ * Begins step-up verification with an enrolled credential.
58
+ *
59
+ * @param request - Credential type and trace reason.
60
+ * @returns A challenge for the client-owned ceremony.
61
+ */
62
+ export type AuthenticationControllerBeginStepUpAction = {
63
+ type: `AuthenticationController:beginStepUp`;
64
+ handler: AuthenticationController['beginStepUp'];
65
+ };
66
+ /**
67
+ * Completes step-up verification and opens a short-lived elevated session.
68
+ *
69
+ * The AAL2 assertion returned by the MFA service is exchanged at Hydra for
70
+ * an elevated access token, whose claims are checked before the session
71
+ * opens. The token itself never enters controller state.
72
+ *
73
+ * @param request - Flow identifier, platform or email proof, and trace reason.
74
+ * @returns The elevated profile access token.
75
+ */
76
+ export type AuthenticationControllerCompleteStepUpAction = {
77
+ type: `AuthenticationController:completeStepUp`;
78
+ handler: AuthenticationController['completeStepUp'];
79
+ };
80
+ /**
81
+ * Returns the active elevated token when it meets the requested freshness.
82
+ *
83
+ * @param request - Optional maximum session age in milliseconds, measured
84
+ * from when the token was obtained. Zero always requires a new ceremony.
85
+ * @returns A live elevated token, or null when no reusable session exists.
86
+ */
87
+ export type AuthenticationControllerGetElevatedProfileTokenAction = {
88
+ type: `AuthenticationController:getElevatedProfileToken`;
89
+ handler: AuthenticationController['getElevatedProfileToken'];
90
+ };
91
+ /**
92
+ * Clears the in-memory elevated session and its expiration timer.
93
+ */
94
+ export type AuthenticationControllerClearStepUpSessionAction = {
95
+ type: `AuthenticationController:clearStepUpSession`;
96
+ handler: AuthenticationController['clearStepUpSession'];
97
+ };
19
98
  export type AuthenticationControllerPerformSignOutAction = {
20
99
  type: `AuthenticationController:performSignOut`;
21
100
  handler: AuthenticationController['performSignOut'];
@@ -123,5 +202,5 @@ export type AuthenticationControllerIsSignedInAction = {
123
202
  /**
124
203
  * Union of all AuthenticationController action types.
125
204
  */
126
- export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerClearStateAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerGetPartnerIdentityTokenAction | AuthenticationControllerIsSignedInAction;
205
+ export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerRefreshEnrolledCredentialsAction | AuthenticationControllerBeginCredentialEnrollmentAction | AuthenticationControllerCompleteCredentialEnrollmentAction | AuthenticationControllerBeginStepUpAction | AuthenticationControllerCompleteStepUpAction | AuthenticationControllerGetElevatedProfileTokenAction | AuthenticationControllerClearStepUpSessionAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerClearStateAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerGetPartnerIdentityTokenAction | AuthenticationControllerIsSignedInAction;
127
206
  //# sourceMappingURL=AuthenticationController-method-action-types.d.ts.map
@@ -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;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,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,mDAAmD,GACnD,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,EA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AAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,mDAAmD,GACnD,wDAAwD,GACxD,uDAAuD,GACvD,0DAA0D,GAC1D,yCAAyC,GACzC,4CAA4C,GAC5C,qDAAqD,GACrD,gDAAgD,GAChD,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 * 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\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 | AuthenticationControllerRequestProfilePairingAction\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 * 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 or email OTP 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 * 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 step-up 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 AuthenticationControllerBeginStepUpAction = {\n type: `AuthenticationController:beginStepUp`;\n handler: AuthenticationController['beginStepUp'];\n};\n\n/**\n * Completes step-up verification and opens a short-lived elevated session.\n *\n * The AAL2 assertion returned by the MFA service is exchanged at Hydra for\n * an elevated access token, whose claims are checked before the session\n * opens. The token itself never enters controller state.\n *\n * @param request - Flow identifier, platform or email proof, and trace reason.\n * @returns The elevated profile access token.\n */\nexport type AuthenticationControllerCompleteStepUpAction = {\n type: `AuthenticationController:completeStepUp`;\n handler: AuthenticationController['completeStepUp'];\n};\n\n/**\n * Returns the active elevated token when it meets the requested freshness.\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 elevated token, or null when no reusable session exists.\n */\nexport type AuthenticationControllerGetElevatedProfileTokenAction = {\n type: `AuthenticationController:getElevatedProfileToken`;\n handler: AuthenticationController['getElevatedProfileToken'];\n};\n\n/**\n * Clears the in-memory elevated session and its expiration timer.\n */\nexport type AuthenticationControllerClearStepUpSessionAction = {\n type: `AuthenticationController:clearStepUpSession`;\n handler: AuthenticationController['clearStepUpSession'];\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 | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerRefreshEnrolledCredentialsAction\n | AuthenticationControllerBeginCredentialEnrollmentAction\n | AuthenticationControllerCompleteCredentialEnrollmentAction\n | AuthenticationControllerBeginStepUpAction\n | AuthenticationControllerCompleteStepUpAction\n | AuthenticationControllerGetElevatedProfileTokenAction\n | AuthenticationControllerClearStepUpSessionAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerClearStateAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerGetPartnerIdentityTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
@@ -1,9 +1,10 @@
1
1
  import { BaseController } from '@metamask/base-controller';
2
2
  import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
3
+ import type { TraceCallback } from '@metamask/controller-utils';
3
4
  import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from '@metamask/keyring-controller';
4
5
  import type { Messenger } from '@metamask/messenger';
5
6
  import type { SeedlessOnboardingControllerGetAccessTokenAction, SeedlessOnboardingControllerGetStateAction } from '@metamask/seedless-onboarding-controller';
6
- import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage, OidcTokenAudience, OidcTokenClaims } from '../../sdk/index.js';
7
+ import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage, OidcTokenAudience, OidcTokenClaims, BeginEnrollmentRequest, CompleteEnrollmentRequest, EnrolledCredential, EnrollmentChallenge, BeginStepUpRequest, CompleteStepUpRequest, ElevatedProfileToken, GetElevatedTokenRequest, StepUpChallenge } from '../../sdk/index.js';
7
8
  import { Env } from '../../sdk/index.js';
8
9
  import type { MetaMetricsAuth } from '../../shared/types/services.js';
9
10
  import { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types.js';
@@ -11,6 +12,17 @@ declare const controllerName = "AuthenticationController";
11
12
  export type AuthenticationControllerState = {
12
13
  isSignedIn: boolean;
13
14
  srpSessionData?: Record<string, LoginResponse>;
15
+ /**
16
+ * Credentials fetched for the current profile. The controller always seeds
17
+ * this to an empty array; it remains optional so partial-state selectors stay
18
+ * assignable to the controller state type.
19
+ */
20
+ enrolledCredentials?: EnrolledCredential[];
21
+ /**
22
+ * Epoch-ms hard expiry of the in-memory elevated session, or undefined when
23
+ * none is open. Lets UI show "verified" state without holding the token.
24
+ */
25
+ stepUpSessionExpiresAt?: number;
14
26
  /**
15
27
  * Client gate for profile pairing. Defaults to `true` (fresh install /
16
28
  * upgrade), set to `false` after a successful `performSignIn` pair, set
@@ -38,6 +50,12 @@ export type AuthenticationControllerState = {
38
50
  needsSocialPairing?: boolean;
39
51
  };
40
52
  export declare const defaultState: AuthenticationControllerState;
53
+ /**
54
+ * Lifetime of an elevated session. Deliberately shorter than the
55
+ * elevated token's own `exp` so a fresh ceremony is required per sensitive
56
+ * action window, per the MFA phase-1 specification.
57
+ */
58
+ export declare const STEP_UP_SESSION_TTL_MS = 60000;
41
59
  type ControllerConfig = {
42
60
  env: Env;
43
61
  /**
@@ -69,7 +87,7 @@ export type AuthenticationControllerMessenger = Messenger<typeof controllerName,
69
87
  */
70
88
  export declare class AuthenticationController extends BaseController<typeof controllerName, AuthenticationControllerState, AuthenticationControllerMessenger> {
71
89
  #private;
72
- constructor({ messenger, state, config, metametrics, }: {
90
+ constructor({ messenger, state, config, metametrics, trace, }: {
73
91
  messenger: AuthenticationControllerMessenger;
74
92
  state?: AuthenticationControllerState;
75
93
  config?: Partial<ControllerConfig>;
@@ -78,6 +96,7 @@ export declare class AuthenticationController extends BaseController<typeof cont
78
96
  * do not want to tie this strictly to extension
79
97
  */
80
98
  metametrics: MetaMetricsAuth;
99
+ trace?: TraceCallback;
81
100
  });
82
101
  performSignIn(): Promise<string[]>;
83
102
  /**
@@ -86,6 +105,64 @@ export declare class AuthenticationController extends BaseController<typeof cont
86
105
  * re-runs `performSignIn` and re-pairs.
87
106
  */
88
107
  requestProfilePairing(): void;
108
+ /**
109
+ * Refreshes credentials enrolled on the canonical profile.
110
+ *
111
+ * @returns The current supported credentials.
112
+ */
113
+ refreshEnrolledCredentials(): Promise<EnrolledCredential[]>;
114
+ /**
115
+ * Begins enrollment of a passkey or email OTP credential.
116
+ *
117
+ * @param request - Credential, optional email address, and trace reason.
118
+ * @returns A challenge for the client-owned ceremony.
119
+ */
120
+ beginCredentialEnrollment(request: BeginEnrollmentRequest): Promise<EnrollmentChallenge>;
121
+ /**
122
+ * Completes credential enrollment and refreshes the credential cache.
123
+ *
124
+ * A cache-refresh failure does not undo successful enrollment. Email
125
+ * enrollment invalidates the primary SRP session *after* refresh so the
126
+ * credentials call can reuse the still-valid access token; the next token
127
+ * fetch then includes the newly verified email claim. That invalidation
128
+ * happens even if the session ends mid-request: the enrollment succeeded
129
+ * on the server, so a token cached across a lock must not be reused
130
+ * without the new claim.
131
+ *
132
+ * @param request - Flow identifier, platform or email proof, and trace reason.
133
+ * @returns The refreshed credentials, or the existing cache if refresh fails.
134
+ */
135
+ completeCredentialEnrollment(request: CompleteEnrollmentRequest): Promise<EnrolledCredential[]>;
136
+ /**
137
+ * Begins step-up verification with an enrolled credential.
138
+ *
139
+ * @param request - Credential type and trace reason.
140
+ * @returns A challenge for the client-owned ceremony.
141
+ */
142
+ beginStepUp(request: BeginStepUpRequest): Promise<StepUpChallenge>;
143
+ /**
144
+ * Completes step-up verification and opens a short-lived elevated session.
145
+ *
146
+ * The AAL2 assertion returned by the MFA service is exchanged at Hydra for
147
+ * an elevated access token, whose claims are checked before the session
148
+ * opens. The token itself never enters controller state.
149
+ *
150
+ * @param request - Flow identifier, platform or email proof, and trace reason.
151
+ * @returns The elevated profile access token.
152
+ */
153
+ completeStepUp(request: CompleteStepUpRequest): Promise<ElevatedProfileToken>;
154
+ /**
155
+ * Returns the active elevated token when it meets the requested freshness.
156
+ *
157
+ * @param request - Optional maximum session age in milliseconds, measured
158
+ * from when the token was obtained. Zero always requires a new ceremony.
159
+ * @returns A live elevated token, or null when no reusable session exists.
160
+ */
161
+ getElevatedProfileToken(request?: GetElevatedTokenRequest): ElevatedProfileToken | null;
162
+ /**
163
+ * Clears the in-memory elevated session and its expiration timer.
164
+ */
165
+ clearStepUpSession(): void;
89
166
  performSignOut(): void;
90
167
  /**
91
168
  * Resets the controller to `defaultState`. Clients call this on wallet reset
@@ -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,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;AAGlD,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EAGZ,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,GAAG,EAGJ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,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,EAAE,iBAAiB,EAC3B,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAQjB;IAEM,UAAU,IAAI,OAAO,CAE3B;CA8EF"}
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;AAYlD,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EAGZ,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,GAAG,EAKJ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,QAAA,MAAM,cAAc,6BAA6B,CAAC;AAGlD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC/C;;;;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