@metamask-previews/mfa-recovery-controller 0.0.0-preview-c5fdaa9c8 → 0.0.0-preview-5e24e4d22

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 (52) hide show
  1. package/CHANGELOG.md +0 -26
  2. package/LICENSE.APACHE2 +1 -1
  3. package/README.md +1 -8
  4. package/dist/index.d.ts +7 -8
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +9 -4
  7. package/dist/index.js.map +1 -1
  8. package/package.json +9 -25
  9. package/dist/MfaRecoveryController-method-action-types.d.ts +0 -88
  10. package/dist/MfaRecoveryController-method-action-types.d.ts.map +0 -1
  11. package/dist/MfaRecoveryController-method-action-types.js +0 -6
  12. package/dist/MfaRecoveryController-method-action-types.js.map +0 -1
  13. package/dist/MfaRecoveryController.d.ts +0 -119
  14. package/dist/MfaRecoveryController.d.ts.map +0 -1
  15. package/dist/MfaRecoveryController.js +0 -489
  16. package/dist/MfaRecoveryController.js.map +0 -1
  17. package/dist/auth-controller-token.d.ts +0 -36
  18. package/dist/auth-controller-token.d.ts.map +0 -1
  19. package/dist/auth-controller-token.js +0 -36
  20. package/dist/auth-controller-token.js.map +0 -1
  21. package/dist/crypto.d.ts +0 -128
  22. package/dist/crypto.d.ts.map +0 -1
  23. package/dist/crypto.js +0 -289
  24. package/dist/crypto.js.map +0 -1
  25. package/dist/errors.d.ts +0 -25
  26. package/dist/errors.d.ts.map +0 -1
  27. package/dist/errors.js +0 -37
  28. package/dist/errors.js.map +0 -1
  29. package/dist/escrow-providers/cubist-escrow-provider.d.ts +0 -75
  30. package/dist/escrow-providers/cubist-escrow-provider.d.ts.map +0 -1
  31. package/dist/escrow-providers/cubist-escrow-provider.js +0 -169
  32. package/dist/escrow-providers/cubist-escrow-provider.js.map +0 -1
  33. package/dist/escrow-utils.d.ts +0 -42
  34. package/dist/escrow-utils.d.ts.map +0 -1
  35. package/dist/escrow-utils.js +0 -77
  36. package/dist/escrow-utils.js.map +0 -1
  37. package/dist/identifier-auth.d.ts +0 -60
  38. package/dist/identifier-auth.d.ts.map +0 -1
  39. package/dist/identifier-auth.js +0 -95
  40. package/dist/identifier-auth.js.map +0 -1
  41. package/dist/pending-operation-validation.d.ts +0 -21
  42. package/dist/pending-operation-validation.d.ts.map +0 -1
  43. package/dist/pending-operation-validation.js +0 -163
  44. package/dist/pending-operation-validation.js.map +0 -1
  45. package/dist/state-machine.d.ts +0 -23
  46. package/dist/state-machine.d.ts.map +0 -1
  47. package/dist/state-machine.js +0 -34
  48. package/dist/state-machine.js.map +0 -1
  49. package/dist/types.d.ts +0 -242
  50. package/dist/types.d.ts.map +0 -1
  51. package/dist/types.js +0 -5
  52. package/dist/types.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,30 +7,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add `MfaRecoveryController` for replicating an MFA recovery secret across injected escrow replicas ([#10022](https://github.com/MetaMask/core/pull/10022))
13
- - Public methods: `register`, `updateRecoverySecret`, `updateIdentifiers`, `authenticateIdentifier`, `getRecoverySecret`, `resume`, `abort`, and `getPhase`
14
- - Inject `RecoveryAuthProvider`, `RecoveryIdentifierAuthProvider`, `RecoveryEscrowProvider[]`, and `PendingOperationEncryptor`
15
- - Persist only an encrypted `authorizing` / `writing` pending mutation (`idle` when `pendingOperation` is `null`)
16
- - `register` and `updateIdentifiers` require at least two distinct identifiers (`MIN_IDENTIFIERS`)
17
- - Identifier types `passkey`, `oidc`, and `siwe` are key-bound; `emailOtp` / `smsOtp` are not wired yet
18
- - `getRecoverySecret` returns `{ recoverySecret, epoch }`; pass that `epoch` into later `updateRecoverySecret` / `updateIdentifiers` calls (register uses `0`). Does not block on a pending mutation; returns the highest consistent version across available escrows
19
- - Mutation `payloadHash` is the hash of the logical pending payload (`identifiers` and/or `0x`-hex secret). At apply, each escrow receives `{ pkE, ciphertext }` wrapped to its own wrap key with escrow-wrap-v1
20
- - `getSecret` request hashes bind the client's ephemeral `pkE`; responses are `{ ciphertext }` plus `wrapKeyId`
21
- - `Mutation.audiences` is the configured replica-id list, in that order. Each replica should require an exact match
22
- - `MutationReceipt` includes `receiptKeyId`. `RecoveryEscrowProvider.verifyReceipt` takes the expected escrow id and verifies with that replica's receipt key
23
- - `AuthControllerToken.expiresAt` and `PoPChallenge.expiresAt` are Unix seconds
24
- - Mutations require idle pending state (`resume()` / `abort()` first). `abort()` drops `authorizing` only; `writing` must be finished with `resume()`
25
- - `CubistEscrowProvider` invokes Cubist escrow commands through `@cubist-labs/cubesigner-sdk` `policyInvoke` (`ping`, `generateChallenge`, `applyMutation`, `getSecret` on `cubist_secret_escrow`) and verifies receipts with a pinned receipt public key
26
- - `authenticateIdentifier` returns an in-memory `IdentifierSession` for key-bound recovery-secret reads
27
-
28
- ### Changed
29
-
30
- - **BREAKING:** `getRecoverySecret` now accepts an `IdentifierSession` returned by `authenticateIdentifier` instead of an `Identifier`
31
-
32
- ### Fixed
33
-
34
- - Clear a pending mutation when every escrow rejects it before applying, so a second `register` or an update with a stale epoch does not stay in `writing`. `resume()` still retries an incomplete write, and `abort()` still refuses a `writing` mutation that may have been applied
35
-
36
10
  [Unreleased]: https://github.com/MetaMask/core/
package/LICENSE.APACHE2 CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2026 MetaMask
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,13 +1,6 @@
1
1
  # `@metamask/mfa-recovery-controller`
2
2
 
3
- Manages MFA recovery flows across MetaMask clients. Auth and escrow storage are
4
- injected so the same controller can run against different identity providers and
5
- escrow backends.
6
-
7
- Pending mutations are persisted as encoded encrypted `authorizing` / `writing`
8
- state so a crash can `resume()` the same mutation. `abort()` drops `authorizing`
9
- only; `writing` must `resume()`. The encoded ciphertext is stored as a string so
10
- BaseController state serialization preserves the encrypted value.
3
+ Manages MFA recovery flows across MetaMask clients
11
4
 
12
5
  ## Installation
13
6
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { MfaRecoveryController, getDefaultMfaRecoveryControllerState, } from './MfaRecoveryController.js';
2
- export type { MfaRecoveryControllerActions, MfaRecoveryControllerEvents, MfaRecoveryControllerGetStateAction, MfaRecoveryControllerMessenger, MfaRecoveryControllerOptions, MfaRecoveryControllerState, MfaRecoveryControllerStateChangedEvent, } from './MfaRecoveryController.js';
3
- export type { MfaRecoveryControllerAbortAction, MfaRecoveryControllerAuthenticateIdentifierAction, MfaRecoveryControllerGetPhaseAction, MfaRecoveryControllerGetRecoverySecretAction, MfaRecoveryControllerRegisterAction, MfaRecoveryControllerResumeAction, MfaRecoveryControllerUpdateIdentifiersAction, MfaRecoveryControllerUpdateRecoverySecretAction, } from './MfaRecoveryController-method-action-types.js';
4
- export { CubistEscrowProvider } from './escrow-providers/cubist-escrow-provider.js';
5
- export type { CubistEscrowProviderOptions } from './escrow-providers/cubist-escrow-provider.js';
6
- export { IncompleteMutationError, MfaRecoveryError, MutationRejectedError, } from './errors.js';
7
- export { IDENTIFIER_AUTH_MODES, MIN_IDENTIFIERS, getIdentifierAuthMode, } from './identifier-auth.js';
8
- export type { AuthControllerToken, EcPublicJwk, EncryptedPendingOperation, Identifier, IdentifierAuthorization, IdentifierSession, Mutation, MutationPayload, MutationReceipt, PendingMutationPayload, PendingOperation, PendingOperationEncryptor, PendingRecoverySecretHex, PendingRegisterPayload, PendingUpdateIdentifiersPayload, PendingUpdateRecoverySecretPayload, RecoveryAuthProvider, RecoveryEscrowProvider, RecoveryIdentifierAuthProvider, RecoveryPhase, RecoveredSecret, WrappedSecret, WrappedSecretOutput, } from './types.js';
1
+ /**
2
+ * Example function that returns a greeting for the given name.
3
+ *
4
+ * @param name - The name to greet.
5
+ * @returns The greeting.
6
+ */
7
+ export default function greeter(name: string): string;
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,sCAAsC,GACvC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,gCAAgC,EAChC,iDAAiD,EACjD,mCAAmC,EACnC,4CAA4C,EAC5C,mCAAmC,EACnC,iCAAiC,EACjC,4CAA4C,EAC5C,+CAA+C,GAChD,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,YAAY,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,+BAA+B,EAC/B,kCAAkC,EAClC,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
package/dist/index.js CHANGED
@@ -1,5 +1,10 @@
1
- export { MfaRecoveryController, getDefaultMfaRecoveryControllerState, } from './MfaRecoveryController.js';
2
- export { CubistEscrowProvider } from './escrow-providers/cubist-escrow-provider.js';
3
- export { IncompleteMutationError, MfaRecoveryError, MutationRejectedError, } from './errors.js';
4
- export { IDENTIFIER_AUTH_MODES, MIN_IDENTIFIERS, getIdentifierAuthMode, } from './identifier-auth.js';
1
+ /**
2
+ * Example function that returns a greeting for the given name.
3
+ *
4
+ * @param name - The name to greet.
5
+ * @returns The greeting.
6
+ */
7
+ export default function greeter(name) {
8
+ return `Hello, ${name}!`;
9
+ }
5
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AAoBpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC","sourcesContent":["export {\n MfaRecoveryController,\n getDefaultMfaRecoveryControllerState,\n} from './MfaRecoveryController.js';\nexport type {\n MfaRecoveryControllerActions,\n MfaRecoveryControllerEvents,\n MfaRecoveryControllerGetStateAction,\n MfaRecoveryControllerMessenger,\n MfaRecoveryControllerOptions,\n MfaRecoveryControllerState,\n MfaRecoveryControllerStateChangedEvent,\n} from './MfaRecoveryController.js';\nexport type {\n MfaRecoveryControllerAbortAction,\n MfaRecoveryControllerAuthenticateIdentifierAction,\n MfaRecoveryControllerGetPhaseAction,\n MfaRecoveryControllerGetRecoverySecretAction,\n MfaRecoveryControllerRegisterAction,\n MfaRecoveryControllerResumeAction,\n MfaRecoveryControllerUpdateIdentifiersAction,\n MfaRecoveryControllerUpdateRecoverySecretAction,\n} from './MfaRecoveryController-method-action-types.js';\nexport { CubistEscrowProvider } from './escrow-providers/cubist-escrow-provider.js';\nexport type { CubistEscrowProviderOptions } from './escrow-providers/cubist-escrow-provider.js';\nexport {\n IncompleteMutationError,\n MfaRecoveryError,\n MutationRejectedError,\n} from './errors.js';\nexport {\n IDENTIFIER_AUTH_MODES,\n MIN_IDENTIFIERS,\n getIdentifierAuthMode,\n} from './identifier-auth.js';\nexport type {\n AuthControllerToken,\n EcPublicJwk,\n EncryptedPendingOperation,\n Identifier,\n IdentifierAuthorization,\n IdentifierSession,\n Mutation,\n MutationPayload,\n MutationReceipt,\n PendingMutationPayload,\n PendingOperation,\n PendingOperationEncryptor,\n PendingRecoverySecretHex,\n PendingRegisterPayload,\n PendingUpdateIdentifiersPayload,\n PendingUpdateRecoverySecretPayload,\n RecoveryAuthProvider,\n RecoveryEscrowProvider,\n RecoveryIdentifierAuthProvider,\n RecoveryPhase,\n RecoveredSecret,\n WrappedSecret,\n WrappedSecretOutput,\n} from './types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,IAAY;IAC1C,OAAO,UAAU,IAAI,GAAG,CAAC;AAC3B,CAAC","sourcesContent":["/**\n * Example function that returns a greeting for the given name.\n *\n * @param name - The name to greet.\n * @returns The greeting.\n */\nexport default function greeter(name: string): string {\n return `Hello, ${name}!`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/mfa-recovery-controller",
3
- "version": "0.0.0-preview-c5fdaa9c8",
3
+ "version": "0.0.0-preview-5e24e4d22",
4
4
  "description": "Manages MFA recovery flows across MetaMask clients",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -39,40 +39,24 @@
39
39
  "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
40
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/mfa-recovery-controller",
41
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/mfa-recovery-controller",
42
- "cubesigner:invoke-escrow": "tsx scripts/invoke-escrow.ts",
43
- "cubesigner:register": "tsx scripts/register-with-controller.ts",
44
42
  "lint:tsconfigs": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
45
43
  "lint:tsconfigs:fix": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
46
- "messenger-action-types:check": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --check",
47
- "messenger-action-types:generate": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --generate",
44
+ "messenger-action-types:check": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --check",
45
+ "messenger-action-types:generate": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --generate",
48
46
  "since-latest-release": "../../scripts/since-latest-release.sh",
49
- "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
50
- "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
51
- "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
52
- "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
53
- },
54
- "dependencies": {
55
- "@cubist-labs/cubesigner-sdk": "^0.4.284",
56
- "@metamask/base-controller": "^10.0.0",
57
- "@metamask/messenger": "^3.0.0",
58
- "@metamask/utils": "^12.0.0",
59
- "@noble/ciphers": "^1.3.0",
60
- "@noble/curves": "^1.9.7",
61
- "@noble/hashes": "^1.8.0"
47
+ "test": "vitest",
48
+ "test:clean": "vitest --clearCache",
49
+ "test:verbose": "vitest --reporter=verbose",
50
+ "test:watch": "vitest --watch"
62
51
  },
63
52
  "devDependencies": {
64
- "@cubist-labs/cubesigner-sdk-fs-storage": "^0.4.284",
65
53
  "@metamask/auto-changelog": "^6.2.1",
66
- "@types/jest": "^30.0.0",
67
54
  "@typescript/native": "npm:typescript@^7.0.2",
68
- "deepmerge": "^4.3.1",
69
- "jest": "^30.5.2",
70
55
  "rimraf": "^6.1.3",
71
- "ts-jest": "^29.4.14",
72
- "tsx": "^4.20.5",
73
56
  "typedoc": "^0.28.20",
74
57
  "typedoc-plugin-missing-exports": "^4.1.4",
75
- "typescript": "npm:@typescript/typescript6@^6.0.2"
58
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
59
+ "vitest": "^5.0.0"
76
60
  },
77
61
  "engines": {
78
62
  "node": "^22.14.0 || ^24"
@@ -1,88 +0,0 @@
1
- /**
2
- * This file is auto generated.
3
- * Do not edit manually.
4
- */
5
- import type { MfaRecoveryController } from './MfaRecoveryController.js';
6
- /**
7
- * Creates version 1 of a recovery record.
8
- *
9
- * @param recoverySecret - Secret replicated in full to every escrow.
10
- * @param identifiers - Ownership-approved identifier set. Must contain at
11
- * least two identifiers.
12
- */
13
- export type MfaRecoveryControllerRegisterAction = {
14
- type: `MfaRecoveryController:register`;
15
- handler: MfaRecoveryController['register'];
16
- };
17
- /**
18
- * Replaces the recovery secret.
19
- *
20
- * @param identifier - Currently registered identifier used to authorize.
21
- * @param recoverySecret - New secret.
22
- * @param epoch - Current recovery version, used as `expectedVersion`.
23
- */
24
- export type MfaRecoveryControllerUpdateRecoverySecretAction = {
25
- type: `MfaRecoveryController:updateRecoverySecret`;
26
- handler: MfaRecoveryController['updateRecoverySecret'];
27
- };
28
- /**
29
- * Replaces the complete identifier set.
30
- *
31
- * @param identifier - Currently registered identifier used to authorize.
32
- * @param identifiers - New identifier set. Must contain at least two
33
- * identifiers.
34
- * @param epoch - Current recovery version, used as `expectedVersion`.
35
- */
36
- export type MfaRecoveryControllerUpdateIdentifiersAction = {
37
- type: `MfaRecoveryController:updateIdentifiers`;
38
- handler: MfaRecoveryController['updateIdentifiers'];
39
- };
40
- /**
41
- * Authenticates an identifier for a subsequent recovery-secret read.
42
- *
43
- * @param identifier - Identifier to authenticate.
44
- * @returns Ephemeral session data required by {@link getRecoverySecret}.
45
- */
46
- export type MfaRecoveryControllerAuthenticateIdentifierAction = {
47
- type: `MfaRecoveryController:authenticateIdentifier`;
48
- handler: MfaRecoveryController['authenticateIdentifier'];
49
- };
50
- /**
51
- * Reads the recovery secret from available escrows and returns the highest
52
- * consistent version. `epoch` is the current recovery version and is required
53
- * by later mutations. Does not wait for a pending mutation to be repaired.
54
- *
55
- * @param session - Identifier authentication session used to authorize the
56
- * read.
57
- * @returns Recovered secret bytes and the selected epoch.
58
- */
59
- export type MfaRecoveryControllerGetRecoverySecretAction = {
60
- type: `MfaRecoveryController:getRecoverySecret`;
61
- handler: MfaRecoveryController['getRecoverySecret'];
62
- };
63
- /**
64
- * Completes a persisted pending mutation, if any.
65
- */
66
- export type MfaRecoveryControllerResumeAction = {
67
- type: `MfaRecoveryController:resume`;
68
- handler: MfaRecoveryController['resume'];
69
- };
70
- /**
71
- * Drops `authorizing` pending. `writing` must be finished with {@link resume}.
72
- */
73
- export type MfaRecoveryControllerAbortAction = {
74
- type: `MfaRecoveryController:abort`;
75
- handler: MfaRecoveryController['abort'];
76
- };
77
- /**
78
- * @returns Current recovery phase.
79
- */
80
- export type MfaRecoveryControllerGetPhaseAction = {
81
- type: `MfaRecoveryController:getPhase`;
82
- handler: MfaRecoveryController['getPhase'];
83
- };
84
- /**
85
- * Union of all MfaRecoveryController action types.
86
- */
87
- export type MfaRecoveryControllerMethodActions = MfaRecoveryControllerRegisterAction | MfaRecoveryControllerUpdateRecoverySecretAction | MfaRecoveryControllerUpdateIdentifiersAction | MfaRecoveryControllerAuthenticateIdentifierAction | MfaRecoveryControllerGetRecoverySecretAction | MfaRecoveryControllerResumeAction | MfaRecoveryControllerAbortAction | MfaRecoveryControllerGetPhaseAction;
88
- //# sourceMappingURL=MfaRecoveryController-method-action-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MfaRecoveryController-method-action-types.d.ts","sourceRoot":"","sources":["../src/MfaRecoveryController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C,mCAAmC,GACnC,+CAA+C,GAC/C,4CAA4C,GAC5C,iDAAiD,GACjD,4CAA4C,GAC5C,iCAAiC,GACjC,gCAAgC,GAChC,mCAAmC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * This file is auto generated.
3
- * Do not edit manually.
4
- */
5
- export {};
6
- //# sourceMappingURL=MfaRecoveryController-method-action-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MfaRecoveryController-method-action-types.js","sourceRoot":"","sources":["../src/MfaRecoveryController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { MfaRecoveryController } from './MfaRecoveryController.js';\n\n/**\n * Creates version 1 of a recovery record.\n *\n * @param recoverySecret - Secret replicated in full to every escrow.\n * @param identifiers - Ownership-approved identifier set. Must contain at\n * least two identifiers.\n */\nexport type MfaRecoveryControllerRegisterAction = {\n type: `MfaRecoveryController:register`;\n handler: MfaRecoveryController['register'];\n};\n\n/**\n * Replaces the recovery secret.\n *\n * @param identifier - Currently registered identifier used to authorize.\n * @param recoverySecret - New secret.\n * @param epoch - Current recovery version, used as `expectedVersion`.\n */\nexport type MfaRecoveryControllerUpdateRecoverySecretAction = {\n type: `MfaRecoveryController:updateRecoverySecret`;\n handler: MfaRecoveryController['updateRecoverySecret'];\n};\n\n/**\n * Replaces the complete identifier set.\n *\n * @param identifier - Currently registered identifier used to authorize.\n * @param identifiers - New identifier set. Must contain at least two\n * identifiers.\n * @param epoch - Current recovery version, used as `expectedVersion`.\n */\nexport type MfaRecoveryControllerUpdateIdentifiersAction = {\n type: `MfaRecoveryController:updateIdentifiers`;\n handler: MfaRecoveryController['updateIdentifiers'];\n};\n\n/**\n * Authenticates an identifier for a subsequent recovery-secret read.\n *\n * @param identifier - Identifier to authenticate.\n * @returns Ephemeral session data required by {@link getRecoverySecret}.\n */\nexport type MfaRecoveryControllerAuthenticateIdentifierAction = {\n type: `MfaRecoveryController:authenticateIdentifier`;\n handler: MfaRecoveryController['authenticateIdentifier'];\n};\n\n/**\n * Reads the recovery secret from available escrows and returns the highest\n * consistent version. `epoch` is the current recovery version and is required\n * by later mutations. Does not wait for a pending mutation to be repaired.\n *\n * @param session - Identifier authentication session used to authorize the\n * read.\n * @returns Recovered secret bytes and the selected epoch.\n */\nexport type MfaRecoveryControllerGetRecoverySecretAction = {\n type: `MfaRecoveryController:getRecoverySecret`;\n handler: MfaRecoveryController['getRecoverySecret'];\n};\n\n/**\n * Completes a persisted pending mutation, if any.\n */\nexport type MfaRecoveryControllerResumeAction = {\n type: `MfaRecoveryController:resume`;\n handler: MfaRecoveryController['resume'];\n};\n\n/**\n * Drops `authorizing` pending. `writing` must be finished with {@link resume}.\n */\nexport type MfaRecoveryControllerAbortAction = {\n type: `MfaRecoveryController:abort`;\n handler: MfaRecoveryController['abort'];\n};\n\n/**\n * @returns Current recovery phase.\n */\nexport type MfaRecoveryControllerGetPhaseAction = {\n type: `MfaRecoveryController:getPhase`;\n handler: MfaRecoveryController['getPhase'];\n};\n\n/**\n * Union of all MfaRecoveryController action types.\n */\nexport type MfaRecoveryControllerMethodActions =\n | MfaRecoveryControllerRegisterAction\n | MfaRecoveryControllerUpdateRecoverySecretAction\n | MfaRecoveryControllerUpdateIdentifiersAction\n | MfaRecoveryControllerAuthenticateIdentifierAction\n | MfaRecoveryControllerGetRecoverySecretAction\n | MfaRecoveryControllerResumeAction\n | MfaRecoveryControllerAbortAction\n | MfaRecoveryControllerGetPhaseAction;\n"]}
@@ -1,119 +0,0 @@
1
- import type { ControllerGetStateAction, ControllerStateChangedEvent } from '@metamask/base-controller';
2
- import { BaseController } from '@metamask/base-controller';
3
- import type { Messenger } from '@metamask/messenger';
4
- import type { MfaRecoveryControllerMethodActions } from './MfaRecoveryController-method-action-types.js';
5
- import type { Identifier, IdentifierSession, PendingOperationEncryptor, RecoveryAuthProvider, RecoveryEscrowProvider, RecoveryIdentifierAuthProvider, RecoveryPhase, RecoveredSecret } from './types.js';
6
- declare const CONTROLLER_NAME = "MfaRecoveryController";
7
- export type MfaRecoveryControllerState = {
8
- /**
9
- * Encrypted pending mutation, or `null` when idle.
10
- */
11
- pendingOperation: string | null;
12
- };
13
- /**
14
- * @returns The default {@link MfaRecoveryController} state.
15
- */
16
- export declare function getDefaultMfaRecoveryControllerState(): MfaRecoveryControllerState;
17
- export type MfaRecoveryControllerGetStateAction = ControllerGetStateAction<typeof CONTROLLER_NAME, MfaRecoveryControllerState>;
18
- export type MfaRecoveryControllerActions = MfaRecoveryControllerGetStateAction | MfaRecoveryControllerMethodActions;
19
- type AllowedActions = never;
20
- export type MfaRecoveryControllerStateChangedEvent = ControllerStateChangedEvent<typeof CONTROLLER_NAME, MfaRecoveryControllerState>;
21
- export type MfaRecoveryControllerEvents = MfaRecoveryControllerStateChangedEvent;
22
- type AllowedEvents = never;
23
- export type MfaRecoveryControllerMessenger = Messenger<typeof CONTROLLER_NAME, MfaRecoveryControllerActions | AllowedActions, MfaRecoveryControllerEvents | AllowedEvents>;
24
- export type MfaRecoveryControllerOptions = {
25
- /**
26
- * The messenger suited for this controller.
27
- */
28
- messenger: MfaRecoveryControllerMessenger;
29
- /**
30
- * The desired state with which to initialize this controller. Missing
31
- * properties will be filled in with defaults.
32
- */
33
- state?: Partial<MfaRecoveryControllerState>;
34
- /**
35
- * Authenticates the MetaMask profile and issues request-bound attestations.
36
- */
37
- authProvider: RecoveryAuthProvider;
38
- /**
39
- * Obtains key-bound identifier tokens from an IdP.
40
- */
41
- identifierAuthProvider: RecoveryIdentifierAuthProvider;
42
- /**
43
- * Ordered, non-empty set of recovery escrow replicas. This is build-time
44
- * configuration; public methods cannot override it.
45
- */
46
- escrows: RecoveryEscrowProvider[];
47
- /**
48
- * Encrypts pending mutation state using wallet secure storage.
49
- */
50
- pendingOperationEncryptor: PendingOperationEncryptor;
51
- /**
52
- * Clock used for AuthController token expiry checks. Unix seconds.
53
- * Defaults to {@link unixNow}.
54
- */
55
- now?: () => number;
56
- };
57
- /**
58
- * Coordinates MFA recovery secret replication across independent escrows.
59
- */
60
- export declare class MfaRecoveryController extends BaseController<typeof CONTROLLER_NAME, MfaRecoveryControllerState, MfaRecoveryControllerMessenger> {
61
- #private;
62
- constructor({ messenger, state, authProvider, identifierAuthProvider, escrows, pendingOperationEncryptor, now, }: MfaRecoveryControllerOptions);
63
- /**
64
- * Creates version 1 of a recovery record.
65
- *
66
- * @param recoverySecret - Secret replicated in full to every escrow.
67
- * @param identifiers - Ownership-approved identifier set. Must contain at
68
- * least two identifiers.
69
- */
70
- register(recoverySecret: Uint8Array, identifiers: Identifier[]): Promise<void>;
71
- /**
72
- * Replaces the recovery secret.
73
- *
74
- * @param identifier - Currently registered identifier used to authorize.
75
- * @param recoverySecret - New secret.
76
- * @param epoch - Current recovery version, used as `expectedVersion`.
77
- */
78
- updateRecoverySecret(identifier: Identifier, recoverySecret: Uint8Array, epoch: number): Promise<void>;
79
- /**
80
- * Replaces the complete identifier set.
81
- *
82
- * @param identifier - Currently registered identifier used to authorize.
83
- * @param identifiers - New identifier set. Must contain at least two
84
- * identifiers.
85
- * @param epoch - Current recovery version, used as `expectedVersion`.
86
- */
87
- updateIdentifiers(identifier: Identifier, identifiers: Identifier[], epoch: number): Promise<void>;
88
- /**
89
- * Authenticates an identifier for a subsequent recovery-secret read.
90
- *
91
- * @param identifier - Identifier to authenticate.
92
- * @returns Ephemeral session data required by {@link getRecoverySecret}.
93
- */
94
- authenticateIdentifier(identifier: Identifier): Promise<IdentifierSession>;
95
- /**
96
- * Reads the recovery secret from available escrows and returns the highest
97
- * consistent version. `epoch` is the current recovery version and is required
98
- * by later mutations. Does not wait for a pending mutation to be repaired.
99
- *
100
- * @param session - Identifier authentication session used to authorize the
101
- * read.
102
- * @returns Recovered secret bytes and the selected epoch.
103
- */
104
- getRecoverySecret(session: IdentifierSession): Promise<RecoveredSecret>;
105
- /**
106
- * Completes a persisted pending mutation, if any.
107
- */
108
- resume(): Promise<void>;
109
- /**
110
- * Drops `authorizing` pending. `writing` must be finished with {@link resume}.
111
- */
112
- abort(): Promise<void>;
113
- /**
114
- * @returns Current recovery phase.
115
- */
116
- getPhase(): Promise<RecoveryPhase>;
117
- }
118
- export {};
119
- //# sourceMappingURL=MfaRecoveryController.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MfaRecoveryController.d.ts","sourceRoot":"","sources":["../src/MfaRecoveryController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAE5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAiCrD,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AAOzG,OAAO,KAAK,EAGV,UAAU,EACV,iBAAiB,EAMjB,yBAAyB,EAIzB,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,aAAa,EACb,eAAe,EAGhB,MAAM,YAAY,CAAC;AAEpB,QAAA,MAAM,eAAe,0BAA0B,CAAC;AAahD,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAWF;;GAEG;AACH,wBAAgB,oCAAoC,IAAI,0BAA0B,CAEjF;AAED,MAAM,MAAM,mCAAmC,GAAG,wBAAwB,CACxE,OAAO,eAAe,EACtB,0BAA0B,CAC3B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC,mCAAmC,GACnC,kCAAkC,CAAC;AAEvC,KAAK,cAAc,GAAG,KAAK,CAAC;AAE5B,MAAM,MAAM,sCAAsC,GAChD,2BAA2B,CACzB,OAAO,eAAe,EACtB,0BAA0B,CAC3B,CAAC;AAEJ,MAAM,MAAM,2BAA2B,GACrC,sCAAsC,CAAC;AAEzC,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B,MAAM,MAAM,8BAA8B,GAAG,SAAS,CACpD,OAAO,eAAe,EACtB,4BAA4B,GAAG,cAAc,EAC7C,2BAA2B,GAAG,aAAa,CAC5C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,SAAS,EAAE,8BAA8B,CAAC;IAE1C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAE5C;;OAEG;IACH,YAAY,EAAE,oBAAoB,CAAC;IAEnC;;OAEG;IACH,sBAAsB,EAAE,8BAA8B,CAAC;IAEvD;;;OAGG;IACH,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAElC;;OAEG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;IAErD;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,CAAC;AAsBF;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CACvD,OAAO,eAAe,EACtB,0BAA0B,EAC1B,8BAA8B,CAC/B;;IAaC,YAAY,EACV,SAAS,EACT,KAAK,EACL,YAAY,EACZ,sBAAsB,EACtB,OAAO,EACP,yBAAyB,EACzB,GAAa,GACd,EAAE,4BAA4B,EAgC9B;IAED;;;;;;OAMG;IACG,QAAQ,CACZ,cAAc,EAAE,UAAU,EAC1B,WAAW,EAAE,UAAU,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAYf;IAED;;;;;;OAMG;IACG,oBAAoB,CACxB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,UAAU,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAUf;IAED;;;;;;;OAOG;IACG,iBAAiB,CACrB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,UAAU,EAAE,EACzB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CASf;IAED;;;;;OAKG;IACG,sBAAsB,CAC1B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAqB5B;IAED;;;;;;;;OAQG;IACG,iBAAiB,CACrB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,CAyD1B;IAED;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAI5B;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ3B;IAED;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAIvC;CAsXF"}