@metamask-previews/seedless-onboarding-controller 0.0.0-preview-e9f8bc88 → 1.0.0-preview-39fa8d37

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 (42) hide show
  1. package/CHANGELOG.md +24 -19
  2. package/dist/SecretMetadata.cjs.map +1 -1
  3. package/dist/SecretMetadata.d.cts +4 -0
  4. package/dist/SecretMetadata.d.cts.map +1 -1
  5. package/dist/SecretMetadata.d.mts +4 -0
  6. package/dist/SecretMetadata.d.mts.map +1 -1
  7. package/dist/SecretMetadata.mjs.map +1 -1
  8. package/dist/SeedlessOnboardingController.cjs +65 -25
  9. package/dist/SeedlessOnboardingController.cjs.map +1 -1
  10. package/dist/SeedlessOnboardingController.d.cts +2 -1
  11. package/dist/SeedlessOnboardingController.d.cts.map +1 -1
  12. package/dist/SeedlessOnboardingController.d.mts +2 -1
  13. package/dist/SeedlessOnboardingController.d.mts.map +1 -1
  14. package/dist/SeedlessOnboardingController.mjs +66 -26
  15. package/dist/SeedlessOnboardingController.mjs.map +1 -1
  16. package/dist/constants.cjs +1 -1
  17. package/dist/constants.cjs.map +1 -1
  18. package/dist/constants.d.cts.map +1 -1
  19. package/dist/constants.d.mts.map +1 -1
  20. package/dist/constants.mjs +1 -1
  21. package/dist/constants.mjs.map +1 -1
  22. package/dist/errors.cjs +31 -7
  23. package/dist/errors.cjs.map +1 -1
  24. package/dist/errors.d.cts +5 -4
  25. package/dist/errors.d.cts.map +1 -1
  26. package/dist/errors.d.mts +5 -4
  27. package/dist/errors.d.mts.map +1 -1
  28. package/dist/errors.mjs +31 -7
  29. package/dist/errors.mjs.map +1 -1
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -1
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +1 -1
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/types.cjs.map +1 -1
  37. package/dist/types.d.cts +50 -0
  38. package/dist/types.d.cts.map +1 -1
  39. package/dist/types.d.mts +50 -0
  40. package/dist/types.d.mts.map +1 -1
  41. package/dist/types.mjs.map +1 -1
  42. package/package.json +4 -4
package/dist/errors.mjs CHANGED
@@ -35,10 +35,16 @@ function getRateLimitErrorData(error) {
35
35
  'remainingTime' in error.meta.rateLimitDetails &&
36
36
  typeof error.meta.rateLimitDetails.remainingTime === 'number' &&
37
37
  'message' in error.meta.rateLimitDetails &&
38
- typeof error.meta.rateLimitDetails.message === 'string') {
38
+ typeof error.meta.rateLimitDetails.message === 'string' &&
39
+ 'lockTime' in error.meta.rateLimitDetails &&
40
+ typeof error.meta.rateLimitDetails.lockTime === 'number' &&
41
+ 'guessCount' in error.meta.rateLimitDetails &&
42
+ typeof error.meta.rateLimitDetails.guessCount === 'number') {
39
43
  return {
40
44
  remainingTime: error.meta.rateLimitDetails.remainingTime,
41
45
  message: error.meta.rateLimitDetails.message,
46
+ lockTime: error.meta.rateLimitDetails.lockTime,
47
+ guessCount: error.meta.rateLimitDetails.guessCount,
42
48
  };
43
49
  }
44
50
  return undefined;
@@ -79,15 +85,33 @@ export class RecoveryError extends Error {
79
85
  * Get an instance of the RecoveryError class.
80
86
  *
81
87
  * @param error - The error to get the instance of.
88
+ * @param cachedErrorData - The cached error data to help synchronize the recovery error data across multiple devices.
82
89
  * @returns The instance of the RecoveryError class.
83
90
  */
84
- static getInstance(error) {
85
- if (error instanceof TOPRFError) {
86
- const rateLimitErrorData = getRateLimitErrorData(error);
87
- const errorMessage = getErrorMessageFromTOPRFErrorCode(error.code, SeedlessOnboardingControllerErrorMessage.LoginFailedError);
88
- return new RecoveryError(errorMessage, rateLimitErrorData);
91
+ static getInstance(error, cachedErrorData) {
92
+ if (!(error instanceof TOPRFError)) {
93
+ return new RecoveryError(SeedlessOnboardingControllerErrorMessage.LoginFailedError);
94
+ }
95
+ const rateLimitErrorData = getRateLimitErrorData(error);
96
+ const recoveryErrorData = rateLimitErrorData
97
+ ? {
98
+ numberOfAttempts: rateLimitErrorData.guessCount,
99
+ remainingTime: rateLimitErrorData.remainingTime,
100
+ }
101
+ : undefined;
102
+ if (rateLimitErrorData &&
103
+ recoveryErrorData &&
104
+ rateLimitErrorData.guessCount === cachedErrorData?.numberOfAttempts) {
105
+ // if the number of attempts is the same, we can assume that the previous attempt has been made from the same device.
106
+ // The `lockTime` value is the total ratelimit duration based on the `guessCount` value.
107
+ // The `remainingTime` value is the time that server acutally waits to block the recovery (count down from the `lockTime`) before the next attempt.
108
+ // However, due to the network delay and server processing time, the `remainingTime` value will be smaller than the `lockTime` value when it reaches to the client side.
109
+ // e.g. The actual remaining time is 30s, but when it reaches to the client side, it becomes less than 30s, but the `lockTime` value is still 30s.
110
+ // So, to enforce the user to follow the rate limit policy in the client side, we use the `lockTime` value to calculate the remaining time.
111
+ recoveryErrorData.remainingTime = rateLimitErrorData.lockTime;
89
112
  }
90
- return new RecoveryError(SeedlessOnboardingControllerErrorMessage.LoginFailedError);
113
+ const errorMessage = getErrorMessageFromTOPRFErrorCode(error.code, SeedlessOnboardingControllerErrorMessage.LoginFailedError);
114
+ return new RecoveryError(errorMessage, recoveryErrorData);
91
115
  }
92
116
  }
93
117
  //# sourceMappingURL=errors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,sCAAsC;AAEvC,OAAO,EAAE,wCAAwC,EAAE,wBAAoB;AAEvE;;;;;;GAMG;AACH,SAAS,iCAAiC,CACxC,SAAyB,EACzB,cAAsB;IAEtB,QAAQ,SAAS,EAAE;QACjB,KAAK,cAAc,CAAC,iBAAiB;YACnC,OAAO,wCAAwC,CAAC,oBAAoB,CAAC;QACvE,KAAK,cAAc,CAAC,2BAA2B;YAC7C,OAAO,wCAAwC,CAAC,iBAAiB,CAAC;QACpE,KAAK,cAAc,CAAC,qBAAqB;YACvC,OAAO,wCAAwC,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;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGtC,YAAY,OAAe,EAAE,IAAyB;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,8CAA8C,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,KAAc;QAC/B,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACxD,MAAM,YAAY,GAAG,iCAAiC,CACpD,KAAK,CAAC,IAAI,EACV,wCAAwC,CAAC,gBAAgB,CAC1D,CAAC;YACF,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;SAC5D;QACD,OAAO,IAAI,aAAa,CACtB,wCAAwC,CAAC,gBAAgB,CAC1D,CAAC;IACJ,CAAC;CACF","sourcesContent":["import {\n type RateLimitErrorData,\n TOPRFError,\n TOPRFErrorCode,\n} from '@metamask/toprf-secure-backup';\n\nimport { SeedlessOnboardingControllerErrorMessage } from './constants';\n\n/**\n * Get the error message from the TOPRF error code.\n *\n * @param errorCode - The TOPRF error code.\n * @param defaultMessage - The default error message if the error code is not found.\n * @returns The error message.\n */\nfunction getErrorMessageFromTOPRFErrorCode(\n errorCode: TOPRFErrorCode,\n defaultMessage: string,\n): string {\n switch (errorCode) {\n case TOPRFErrorCode.RateLimitExceeded:\n return SeedlessOnboardingControllerErrorMessage.TooManyLoginAttempts;\n case TOPRFErrorCode.CouldNotDeriveEncryptionKey:\n return SeedlessOnboardingControllerErrorMessage.IncorrectPassword;\n case TOPRFErrorCode.CouldNotFetchPassword:\n return SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword;\n default:\n return defaultMessage;\n }\n}\n\n/**\n * Check if the provided error is a rate limit error triggered by too many login attempts.\n *\n * Return a new TooManyLoginAttemptsError if the error is a rate limit error, otherwise undefined.\n *\n * @param error - The error to check.\n * @returns The rate limit error if the error is a rate limit error, otherwise undefined.\n */\nfunction getRateLimitErrorData(\n error: TOPRFError,\n): RateLimitErrorData | undefined {\n if (\n error.meta && // error metadata must be present\n error.code === TOPRFErrorCode.RateLimitExceeded &&\n typeof error.meta.rateLimitDetails === 'object' &&\n error.meta.rateLimitDetails !== null &&\n 'remainingTime' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.remainingTime === 'number' &&\n 'message' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.message === 'string'\n ) {\n return {\n remainingTime: error.meta.rateLimitDetails.remainingTime,\n message: error.meta.rateLimitDetails.message,\n };\n }\n return undefined;\n}\n\n/**\n * The PasswordSyncError class is used to handle errors that occur during the password sync process.\n */\nexport class PasswordSyncError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SeedlessOnboardingController - PasswordSyncError';\n }\n\n /**\n * Get an instance of the PasswordSyncError class.\n *\n * @param error - The error to get the instance of.\n * @returns The instance of the PasswordSyncError class.\n */\n static getInstance(error: unknown): PasswordSyncError {\n if (error instanceof TOPRFError) {\n const errorMessage = getErrorMessageFromTOPRFErrorCode(\n error.code,\n SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword,\n );\n return new PasswordSyncError(errorMessage);\n }\n return new PasswordSyncError(\n SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword,\n );\n }\n}\n\n/**\n * The RecoveryError class is used to handle errors that occur during the recover encryption key process from the passwrord.\n * It extends the Error class and includes a data property that can be used to store additional information.\n */\nexport class RecoveryError extends Error {\n data: RateLimitErrorData | undefined;\n\n constructor(message: string, data?: RateLimitErrorData) {\n super(message);\n this.data = data;\n this.name = 'SeedlessOnboardingController - RecoveryError';\n }\n\n /**\n * Get an instance of the RecoveryError class.\n *\n * @param error - The error to get the instance of.\n * @returns The instance of the RecoveryError class.\n */\n static getInstance(error: unknown): RecoveryError {\n if (error instanceof TOPRFError) {\n const rateLimitErrorData = getRateLimitErrorData(error);\n const errorMessage = getErrorMessageFromTOPRFErrorCode(\n error.code,\n SeedlessOnboardingControllerErrorMessage.LoginFailedError,\n );\n return new RecoveryError(errorMessage, rateLimitErrorData);\n }\n return new RecoveryError(\n SeedlessOnboardingControllerErrorMessage.LoginFailedError,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACf,sCAAsC;AAEvC,OAAO,EAAE,wCAAwC,EAAE,wBAAoB;AAGvE;;;;;;GAMG;AACH,SAAS,iCAAiC,CACxC,SAAyB,EACzB,cAAsB;IAEtB,QAAQ,SAAS,EAAE;QACjB,KAAK,cAAc,CAAC,iBAAiB;YACnC,OAAO,wCAAwC,CAAC,oBAAoB,CAAC;QACvE,KAAK,cAAc,CAAC,2BAA2B;YAC7C,OAAO,wCAAwC,CAAC,iBAAiB,CAAC;QACpE,KAAK,cAAc,CAAC,qBAAqB;YACvC,OAAO,wCAAwC,CAAC,uBAAuB,CAAC;QAC1E;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAC5B,KAAiB;IAEjB,IACE,KAAK,CAAC,IAAI,IAAI,iCAAiC;QAC/C,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;QAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,QAAQ;QAC/C,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,IAAI;QACpC,eAAe,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,KAAK,QAAQ;QAC7D,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB;QACxC,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,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QACjB,IAAI,CAAC,IAAI,GAAG,8CAA8C,CAAC;IAC7D,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAChB,KAAc,EACd,eAAmC;QAEnC,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE;YAClC,OAAO,IAAI,aAAa,CACtB,wCAAwC,CAAC,gBAAgB,CAC1D,CAAC;SACH;QAED,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,iBAAiB,GAAG,kBAAkB;YAC1C,CAAC,CAAC;gBACE,gBAAgB,EAAE,kBAAkB,CAAC,UAAU;gBAC/C,aAAa,EAAE,kBAAkB,CAAC,aAAa;aAChD;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,IACE,kBAAkB;YAClB,iBAAiB;YACjB,kBAAkB,CAAC,UAAU,KAAK,eAAe,EAAE,gBAAgB,EACnE;YACA,qHAAqH;YACrH,wFAAwF;YACxF,mJAAmJ;YACnJ,wKAAwK;YACxK,kJAAkJ;YAClJ,2IAA2I;YAC3I,iBAAiB,CAAC,aAAa,GAAG,kBAAkB,CAAC,QAAQ,CAAC;SAC/D;QAED,MAAM,YAAY,GAAG,iCAAiC,CACpD,KAAK,CAAC,IAAI,EACV,wCAAwC,CAAC,gBAAgB,CAC1D,CAAC;QACF,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import {\n type RateLimitErrorData,\n TOPRFError,\n TOPRFErrorCode,\n} from '@metamask/toprf-secure-backup';\n\nimport { SeedlessOnboardingControllerErrorMessage } from './constants';\nimport type { RecoveryErrorData } from './types';\n\n/**\n * Get the error message from the TOPRF error code.\n *\n * @param errorCode - The TOPRF error code.\n * @param defaultMessage - The default error message if the error code is not found.\n * @returns The error message.\n */\nfunction getErrorMessageFromTOPRFErrorCode(\n errorCode: TOPRFErrorCode,\n defaultMessage: string,\n): string {\n switch (errorCode) {\n case TOPRFErrorCode.RateLimitExceeded:\n return SeedlessOnboardingControllerErrorMessage.TooManyLoginAttempts;\n case TOPRFErrorCode.CouldNotDeriveEncryptionKey:\n return SeedlessOnboardingControllerErrorMessage.IncorrectPassword;\n case TOPRFErrorCode.CouldNotFetchPassword:\n return SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword;\n default:\n return defaultMessage;\n }\n}\n\n/**\n * Check if the provided error is a rate limit error triggered by too many login attempts.\n *\n * Return a new TooManyLoginAttemptsError if the error is a rate limit error, otherwise undefined.\n *\n * @param error - The error to check.\n * @returns The rate limit error if the error is a rate limit error, otherwise undefined.\n */\nfunction getRateLimitErrorData(\n error: TOPRFError,\n): RateLimitErrorData | undefined {\n if (\n error.meta && // error metadata must be present\n error.code === TOPRFErrorCode.RateLimitExceeded &&\n typeof error.meta.rateLimitDetails === 'object' &&\n error.meta.rateLimitDetails !== null &&\n 'remainingTime' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.remainingTime === 'number' &&\n 'message' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.message === 'string' &&\n 'lockTime' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.lockTime === 'number' &&\n 'guessCount' in error.meta.rateLimitDetails &&\n typeof error.meta.rateLimitDetails.guessCount === 'number'\n ) {\n return {\n remainingTime: error.meta.rateLimitDetails.remainingTime,\n message: error.meta.rateLimitDetails.message,\n lockTime: error.meta.rateLimitDetails.lockTime,\n guessCount: error.meta.rateLimitDetails.guessCount,\n };\n }\n return undefined;\n}\n\n/**\n * The PasswordSyncError class is used to handle errors that occur during the password sync process.\n */\nexport class PasswordSyncError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SeedlessOnboardingController - PasswordSyncError';\n }\n\n /**\n * Get an instance of the PasswordSyncError class.\n *\n * @param error - The error to get the instance of.\n * @returns The instance of the PasswordSyncError class.\n */\n static getInstance(error: unknown): PasswordSyncError {\n if (error instanceof TOPRFError) {\n const errorMessage = getErrorMessageFromTOPRFErrorCode(\n error.code,\n SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword,\n );\n return new PasswordSyncError(errorMessage);\n }\n return new PasswordSyncError(\n SeedlessOnboardingControllerErrorMessage.CouldNotRecoverPassword,\n );\n }\n}\n\n/**\n * The RecoveryError class is used to handle errors that occur during the recover encryption key process from the passwrord.\n * It extends the Error class and includes a data property that can be used to store additional information.\n */\nexport class RecoveryError extends Error {\n data: RecoveryErrorData | undefined;\n\n constructor(message: string, data?: RecoveryErrorData) {\n super(message);\n this.data = data;\n this.name = 'SeedlessOnboardingController - RecoveryError';\n }\n\n /**\n * Get an instance of the RecoveryError class.\n *\n * @param error - The error to get the instance of.\n * @param cachedErrorData - The cached error data to help synchronize the recovery error data across multiple devices.\n * @returns The instance of the RecoveryError class.\n */\n static getInstance(\n error: unknown,\n cachedErrorData?: RecoveryErrorData,\n ): RecoveryError {\n if (!(error instanceof TOPRFError)) {\n return new RecoveryError(\n SeedlessOnboardingControllerErrorMessage.LoginFailedError,\n );\n }\n\n const rateLimitErrorData = getRateLimitErrorData(error);\n const recoveryErrorData = rateLimitErrorData\n ? {\n numberOfAttempts: rateLimitErrorData.guessCount,\n remainingTime: rateLimitErrorData.remainingTime,\n }\n : undefined;\n\n if (\n rateLimitErrorData &&\n recoveryErrorData &&\n rateLimitErrorData.guessCount === cachedErrorData?.numberOfAttempts\n ) {\n // if the number of attempts is the same, we can assume that the previous attempt has been made from the same device.\n // The `lockTime` value is the total ratelimit duration based on the `guessCount` value.\n // The `remainingTime` value is the time that server acutally waits to block the recovery (count down from the `lockTime`) before the next attempt.\n // However, due to the network delay and server processing time, the `remainingTime` value will be smaller than the `lockTime` value when it reaches to the client side.\n // e.g. The actual remaining time is 30s, but when it reaches to the client side, it becomes less than 30s, but the `lockTime` value is still 30s.\n // So, to enforce the user to follow the rate limit policy in the client side, we use the `lockTime` value to calculate the remaining time.\n recoveryErrorData.remainingTime = rateLimitErrorData.lockTime;\n }\n\n const errorMessage = getErrorMessageFromTOPRFErrorCode(\n error.code,\n SeedlessOnboardingControllerErrorMessage.LoginFailedError,\n );\n return new RecoveryError(errorMessage, recoveryErrorData);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAGwC;AAFtC,4IAAA,4BAA4B,OAAA;AAC5B,2JAAA,2CAA2C,OAAA;AAa7C,6CAIqB;AAHnB,4GAAA,eAAe,OAAA;AACf,qIAAA,wCAAwC,OAAA;AACxC,2GAAA,cAAc,OAAA;AAEhB,uCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export {\n SeedlessOnboardingController,\n getDefaultSeedlessOnboardingControllerState,\n} from './SeedlessOnboardingController';\nexport type {\n AuthenticatedUserDetails,\n SocialBackupsMetadata,\n SeedlessOnboardingControllerState,\n SeedlessOnboardingControllerOptions,\n SeedlessOnboardingControllerMessenger,\n SeedlessOnboardingControllerGetStateAction,\n SeedlessOnboardingControllerStateChangeEvent,\n SeedlessOnboardingControllerActions,\n SeedlessOnboardingControllerEvents,\n} from './types';\nexport {\n Web3AuthNetwork,\n SeedlessOnboardingControllerErrorMessage,\n AuthConnection,\n} from './constants';\nexport { RecoveryError } from './errors';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAGwC;AAFtC,4IAAA,4BAA4B,OAAA;AAC5B,2JAAA,2CAA2C,OAAA;AAe7C,6CAIqB;AAHnB,4GAAA,eAAe,OAAA;AACf,qIAAA,wCAAwC,OAAA;AACxC,2GAAA,cAAc,OAAA;AAEhB,uCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export {\n SeedlessOnboardingController,\n getDefaultSeedlessOnboardingControllerState,\n} from './SeedlessOnboardingController';\nexport type {\n AuthenticatedUserDetails,\n SocialBackupsMetadata,\n SeedlessOnboardingControllerState,\n SeedlessOnboardingControllerOptions,\n SeedlessOnboardingControllerMessenger,\n SeedlessOnboardingControllerGetStateAction,\n SeedlessOnboardingControllerStateChangeEvent,\n SeedlessOnboardingControllerActions,\n SeedlessOnboardingControllerEvents,\n ToprfKeyDeriver,\n RecoveryErrorData,\n} from './types';\nexport {\n Web3AuthNetwork,\n SeedlessOnboardingControllerErrorMessage,\n AuthConnection,\n} from './constants';\nexport { RecoveryError } from './errors';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { SeedlessOnboardingController, getDefaultSeedlessOnboardingControllerState, } from "./SeedlessOnboardingController.cjs";
2
- export type { AuthenticatedUserDetails, SocialBackupsMetadata, SeedlessOnboardingControllerState, SeedlessOnboardingControllerOptions, SeedlessOnboardingControllerMessenger, SeedlessOnboardingControllerGetStateAction, SeedlessOnboardingControllerStateChangeEvent, SeedlessOnboardingControllerActions, SeedlessOnboardingControllerEvents, } from "./types.cjs";
2
+ export type { AuthenticatedUserDetails, SocialBackupsMetadata, SeedlessOnboardingControllerState, SeedlessOnboardingControllerOptions, SeedlessOnboardingControllerMessenger, SeedlessOnboardingControllerGetStateAction, SeedlessOnboardingControllerStateChangeEvent, SeedlessOnboardingControllerActions, SeedlessOnboardingControllerEvents, ToprfKeyDeriver, RecoveryErrorData, } from "./types.cjs";
3
3
  export { Web3AuthNetwork, SeedlessOnboardingControllerErrorMessage, AuthConnection, } from "./constants.cjs";
4
4
  export { RecoveryError } from "./errors.cjs";
5
5
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,GAC5C,2CAAuC;AACxC,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,0CAA0C,EAC1C,4CAA4C,EAC5C,mCAAmC,EACnC,kCAAkC,GACnC,oBAAgB;AACjB,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,GACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,GAC5C,2CAAuC;AACxC,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,0CAA0C,EAC1C,4CAA4C,EAC5C,mCAAmC,EACnC,kCAAkC,EAClC,eAAe,EACf,iBAAiB,GAClB,oBAAgB;AACjB,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,GACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { SeedlessOnboardingController, getDefaultSeedlessOnboardingControllerState, } from "./SeedlessOnboardingController.mjs";
2
- export type { AuthenticatedUserDetails, SocialBackupsMetadata, SeedlessOnboardingControllerState, SeedlessOnboardingControllerOptions, SeedlessOnboardingControllerMessenger, SeedlessOnboardingControllerGetStateAction, SeedlessOnboardingControllerStateChangeEvent, SeedlessOnboardingControllerActions, SeedlessOnboardingControllerEvents, } from "./types.mjs";
2
+ export type { AuthenticatedUserDetails, SocialBackupsMetadata, SeedlessOnboardingControllerState, SeedlessOnboardingControllerOptions, SeedlessOnboardingControllerMessenger, SeedlessOnboardingControllerGetStateAction, SeedlessOnboardingControllerStateChangeEvent, SeedlessOnboardingControllerActions, SeedlessOnboardingControllerEvents, ToprfKeyDeriver, RecoveryErrorData, } from "./types.mjs";
3
3
  export { Web3AuthNetwork, SeedlessOnboardingControllerErrorMessage, AuthConnection, } from "./constants.mjs";
4
4
  export { RecoveryError } from "./errors.mjs";
5
5
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,GAC5C,2CAAuC;AACxC,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,0CAA0C,EAC1C,4CAA4C,EAC5C,mCAAmC,EACnC,kCAAkC,GACnC,oBAAgB;AACjB,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,GACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,GAC5C,2CAAuC;AACxC,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iCAAiC,EACjC,mCAAmC,EACnC,qCAAqC,EACrC,0CAA0C,EAC1C,4CAA4C,EAC5C,mCAAmC,EACnC,kCAAkC,EAClC,eAAe,EACf,iBAAiB,GAClB,oBAAgB;AACjB,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,GACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,EAC5C,2CAAuC;AAYxC,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,EACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB","sourcesContent":["export {\n SeedlessOnboardingController,\n getDefaultSeedlessOnboardingControllerState,\n} from './SeedlessOnboardingController';\nexport type {\n AuthenticatedUserDetails,\n SocialBackupsMetadata,\n SeedlessOnboardingControllerState,\n SeedlessOnboardingControllerOptions,\n SeedlessOnboardingControllerMessenger,\n SeedlessOnboardingControllerGetStateAction,\n SeedlessOnboardingControllerStateChangeEvent,\n SeedlessOnboardingControllerActions,\n SeedlessOnboardingControllerEvents,\n} from './types';\nexport {\n Web3AuthNetwork,\n SeedlessOnboardingControllerErrorMessage,\n AuthConnection,\n} from './constants';\nexport { RecoveryError } from './errors';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2CAA2C,EAC5C,2CAAuC;AAcxC,OAAO,EACL,eAAe,EACf,wCAAwC,EACxC,cAAc,EACf,wBAAoB;AACrB,OAAO,EAAE,aAAa,EAAE,qBAAiB","sourcesContent":["export {\n SeedlessOnboardingController,\n getDefaultSeedlessOnboardingControllerState,\n} from './SeedlessOnboardingController';\nexport type {\n AuthenticatedUserDetails,\n SocialBackupsMetadata,\n SeedlessOnboardingControllerState,\n SeedlessOnboardingControllerOptions,\n SeedlessOnboardingControllerMessenger,\n SeedlessOnboardingControllerGetStateAction,\n SeedlessOnboardingControllerStateChangeEvent,\n SeedlessOnboardingControllerActions,\n SeedlessOnboardingControllerEvents,\n ToprfKeyDeriver,\n RecoveryErrorData,\n} from './types';\nexport {\n Web3AuthNetwork,\n SeedlessOnboardingControllerErrorMessage,\n AuthConnection,\n} from './constants';\nexport { RecoveryError } from './errors';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RestrictedMessenger } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type {\n ExportableKeyEncryptor,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n} from '@metamask/keyring-controller';\nimport type { NodeAuthTokens } from '@metamask/toprf-secure-backup';\nimport type { MutexInterface } from 'async-mutex';\n\nimport type {\n AuthConnection,\n controllerName,\n SecretMetadataVersion,\n SecretType,\n Web3AuthNetwork,\n} from './constants';\n\nexport type SocialBackupsMetadata = {\n id: string;\n hash: string;\n};\n\nexport type AuthenticatedUserDetails = {\n /**\n * Type of social login provider.\n */\n authConnection: AuthConnection;\n\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n *\n * This values are used to authenticate users when they go through the Seedless Onboarding flow.\n */\n nodeAuthTokens: NodeAuthTokens;\n\n /**\n * OAuth connection id from web3auth dashboard.\n */\n authConnectionId: string;\n\n /**\n * The optional grouped authConnectionId to authenticate the user with Web3Auth network.\n */\n groupedAuthConnectionId?: string;\n\n /**\n * The user email or ID from Social login.\n */\n userId: string;\n\n /**\n * The user email from Social login.\n */\n socialLoginEmail: string;\n};\n\nexport type SRPBackedUpUserDetails = {\n /**\n * The public key of the authentication key pair in base64 format.\n *\n * This value is used to check if the password is outdated compare to the global password and find backed up old password.\n */\n authPubKey: string;\n};\n\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> &\n Partial<SRPBackedUpUserDetails> & {\n /**\n * Encrypted array of serialized keyrings data.\n */\n vault?: string;\n\n /**\n * The hashes of the seed phrase backups.\n *\n * This is to facilitate the UI to display backup status of the seed phrases.\n */\n socialBackupsMetadata: SocialBackupsMetadata[];\n\n /**\n * The encryption key derived from the password and used to encrypt\n * the vault.\n */\n vaultEncryptionKey?: string;\n\n /**\n * The salt used to derive the encryption key from the password.\n */\n vaultEncryptionSalt?: string;\n\n /**\n * Cache for checkIsPasswordOutdated result and timestamp.\n */\n passwordOutdatedCache?: { isExpiredPwd: boolean; timestamp: number };\n };\n\n// Actions\nexport type SeedlessOnboardingControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerActions =\n SeedlessOnboardingControllerGetStateAction;\n\nexport type AllowedActions = never;\n\n// Events\nexport type SeedlessOnboardingControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerEvents =\n SeedlessOnboardingControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type SeedlessOnboardingControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n SeedlessOnboardingControllerActions | AllowedActions,\n SeedlessOnboardingControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Encryptor interface for encrypting and decrypting seedless onboarding vault.\n */\nexport type VaultEncryptor<EncryptionKey> = Omit<\n ExportableKeyEncryptor<EncryptionKey>,\n 'encryptWithKey'\n>;\n\n/**\n * Seedless Onboarding Controller Options.\n *\n * @param messenger - The messenger to use for this controller.\n * @param state - The initial state to set on this controller.\n * @param encryptor - The encryptor to use for encrypting and decrypting seedless onboarding vault.\n */\nexport type SeedlessOnboardingControllerOptions<EncryptionKey> = {\n messenger: SeedlessOnboardingControllerMessenger;\n\n /**\n * Initial state to set on this controller.\n */\n state?: Partial<SeedlessOnboardingControllerState>;\n\n /**\n * Encryptor to use for encrypting and decrypting seedless onboarding vault.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n encryptor: VaultEncryptor<EncryptionKey>;\n\n /**\n * Type of Web3Auth network to be used for the Seedless Onboarding flow.\n *\n * @default Web3AuthNetwork.Mainnet\n */\n network?: Web3AuthNetwork;\n};\n\n/**\n * A function executed within a mutually exclusive lock, with\n * a mutex releaser in its option bag.\n *\n * @param releaseLock - A function to release the lock.\n */\nexport type MutuallyExclusiveCallback<Result> = ({\n releaseLock,\n}: {\n releaseLock: MutexInterface.Releaser;\n}) => Promise<Result>;\n\n/**\n * The structure of the data which is serialized and stored in the vault.\n */\nexport type VaultData = {\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n */\n authTokens: NodeAuthTokens;\n /**\n * The encryption key to encrypt the seed phrase.\n */\n toprfEncryptionKey: string;\n /**\n * The authentication key pair to authenticate the TOPRF.\n */\n toprfAuthKeyPair: string;\n};\n\nexport type SecretDataType = Uint8Array | string | number;\n\n/**\n * The constructor options for the seed phrase metadata.\n */\nexport type SecretMetadataOptions = {\n /**\n * The timestamp when the seed phrase was created.\n */\n timestamp: number;\n /**\n * The type of the seed phrase.\n */\n type: SecretType;\n /**\n * The version of the seed phrase metadata.\n */\n version: SecretMetadataVersion;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RestrictedMessenger } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type {\n ExportableKeyEncryptor,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n} from '@metamask/keyring-controller';\nimport type { NodeAuthTokens } from '@metamask/toprf-secure-backup';\nimport type { MutexInterface } from 'async-mutex';\n\nimport type {\n AuthConnection,\n controllerName,\n SecretMetadataVersion,\n SecretType,\n Web3AuthNetwork,\n} from './constants';\n\nexport type SocialBackupsMetadata = {\n id: string;\n hash: string;\n};\n\nexport type AuthenticatedUserDetails = {\n /**\n * Type of social login provider.\n */\n authConnection: AuthConnection;\n\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n *\n * This values are used to authenticate users when they go through the Seedless Onboarding flow.\n */\n nodeAuthTokens: NodeAuthTokens;\n\n /**\n * OAuth connection id from web3auth dashboard.\n */\n authConnectionId: string;\n\n /**\n * The optional grouped authConnectionId to authenticate the user with Web3Auth network.\n */\n groupedAuthConnectionId?: string;\n\n /**\n * The user email or ID from Social login.\n */\n userId: string;\n\n /**\n * The user email from Social login.\n */\n socialLoginEmail: string;\n};\n\nexport type SRPBackedUpUserDetails = {\n /**\n * The public key of the authentication key pair in base64 format.\n *\n * This value is used to check if the password is outdated compare to the global password and find backed up old password.\n */\n authPubKey: string;\n};\n\n/**\n * The data of the recovery error.\n */\nexport type RecoveryErrorData = {\n /**\n * The remaining time in seconds before the user can try again.\n */\n remainingTime: number;\n\n /**\n * The number of attempts made by the user.\n */\n numberOfAttempts: number;\n};\n\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> &\n Partial<SRPBackedUpUserDetails> & {\n /**\n * Encrypted array of serialized keyrings data.\n */\n vault?: string;\n\n /**\n * The hashes of the seed phrase backups.\n *\n * This is to facilitate the UI to display backup status of the seed phrases.\n */\n socialBackupsMetadata: SocialBackupsMetadata[];\n\n /**\n * The encryption key derived from the password and used to encrypt\n * the vault.\n */\n vaultEncryptionKey?: string;\n\n /**\n * The salt used to derive the encryption key from the password.\n */\n vaultEncryptionSalt?: string;\n\n /**\n * Cache for checkIsPasswordOutdated result and timestamp.\n */\n passwordOutdatedCache?: { isExpiredPwd: boolean; timestamp: number };\n\n /**\n * The cached data of the recovery error.\n *\n * This data is used to cache the recovery error data to retrieve the accurate ratelimit remainingTime and numberOfAttempts.\n * And it also helps to synchronize the recovery error data across multiple devices.\n */\n recoveryRatelimitCache?: RecoveryErrorData;\n };\n\n// Actions\nexport type SeedlessOnboardingControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerActions =\n SeedlessOnboardingControllerGetStateAction;\n\nexport type AllowedActions = never;\n\n// Events\nexport type SeedlessOnboardingControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerEvents =\n SeedlessOnboardingControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type SeedlessOnboardingControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n SeedlessOnboardingControllerActions | AllowedActions,\n SeedlessOnboardingControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Encryptor interface for encrypting and decrypting seedless onboarding vault.\n */\nexport type VaultEncryptor<EncryptionKey> = Omit<\n ExportableKeyEncryptor<EncryptionKey>,\n 'encryptWithKey'\n>;\n\n/**\n * Additional key deriver for the TOPRF client.\n *\n * This is a function that takes a seed and salt and returns a key in bytes (Uint8Array).\n * It is used as an additional step during key derivation. This can be used, for example, to inject a slow key\n * derivation step to protect against local brute force attacks on the password.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\nexport type ToprfKeyDeriver = {\n /**\n * Derive a key from a seed and salt.\n *\n * @param seed - The seed to derive the key from.\n * @param salt - The salt to derive the key from.\n * @returns The derived key.\n */\n deriveKey: (seed: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;\n};\n\n/**\n * Seedless Onboarding Controller Options.\n *\n * @param messenger - The messenger to use for this controller.\n * @param state - The initial state to set on this controller.\n * @param encryptor - The encryptor to use for encrypting and decrypting seedless onboarding vault.\n */\nexport type SeedlessOnboardingControllerOptions<EncryptionKey> = {\n messenger: SeedlessOnboardingControllerMessenger;\n\n /**\n * Initial state to set on this controller.\n */\n state?: Partial<SeedlessOnboardingControllerState>;\n\n /**\n * Encryptor to use for encrypting and decrypting seedless onboarding vault.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n encryptor: VaultEncryptor<EncryptionKey>;\n\n /**\n * Optional key derivation interface for the TOPRF client.\n *\n * If provided, it will be used as an additional step during\n * key derivation. This can be used, for example, to inject a slow key\n * derivation step to protect against local brute force attacks on the\n * password.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n toprfKeyDeriver?: ToprfKeyDeriver;\n\n /**\n * Type of Web3Auth network to be used for the Seedless Onboarding flow.\n *\n * @default Web3AuthNetwork.Mainnet\n */\n network?: Web3AuthNetwork;\n};\n\n/**\n * A function executed within a mutually exclusive lock, with\n * a mutex releaser in its option bag.\n *\n * @param releaseLock - A function to release the lock.\n */\nexport type MutuallyExclusiveCallback<Result> = ({\n releaseLock,\n}: {\n releaseLock: MutexInterface.Releaser;\n}) => Promise<Result>;\n\n/**\n * The structure of the data which is serialized and stored in the vault.\n */\nexport type VaultData = {\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n */\n authTokens: NodeAuthTokens;\n /**\n * The encryption key to encrypt the seed phrase.\n */\n toprfEncryptionKey: string;\n /**\n * The authentication key pair to authenticate the TOPRF.\n */\n toprfAuthKeyPair: string;\n};\n\nexport type SecretDataType = Uint8Array | string | number;\n\n/**\n * The constructor options for the seed phrase metadata.\n */\nexport type SecretMetadataOptions = {\n /**\n * The timestamp when the seed phrase was created.\n */\n timestamp: number;\n /**\n * The type of the seed phrase.\n */\n type: SecretType;\n /**\n * The version of the seed phrase metadata.\n */\n version: SecretMetadataVersion;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -45,6 +45,19 @@ export type SRPBackedUpUserDetails = {
45
45
  */
46
46
  authPubKey: string;
47
47
  };
48
+ /**
49
+ * The data of the recovery error.
50
+ */
51
+ export type RecoveryErrorData = {
52
+ /**
53
+ * The remaining time in seconds before the user can try again.
54
+ */
55
+ remainingTime: number;
56
+ /**
57
+ * The number of attempts made by the user.
58
+ */
59
+ numberOfAttempts: number;
60
+ };
48
61
  export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & Partial<SRPBackedUpUserDetails> & {
49
62
  /**
50
63
  * Encrypted array of serialized keyrings data.
@@ -72,6 +85,13 @@ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails
72
85
  isExpiredPwd: boolean;
73
86
  timestamp: number;
74
87
  };
88
+ /**
89
+ * The cached data of the recovery error.
90
+ *
91
+ * This data is used to cache the recovery error data to retrieve the accurate ratelimit remainingTime and numberOfAttempts.
92
+ * And it also helps to synchronize the recovery error data across multiple devices.
93
+ */
94
+ recoveryRatelimitCache?: RecoveryErrorData;
75
95
  };
76
96
  export type SeedlessOnboardingControllerGetStateAction = ControllerGetStateAction<typeof controllerName, SeedlessOnboardingControllerState>;
77
97
  export type SeedlessOnboardingControllerActions = SeedlessOnboardingControllerGetStateAction;
@@ -84,6 +104,25 @@ export type SeedlessOnboardingControllerMessenger = RestrictedMessenger<typeof c
84
104
  * Encryptor interface for encrypting and decrypting seedless onboarding vault.
85
105
  */
86
106
  export type VaultEncryptor<EncryptionKey> = Omit<ExportableKeyEncryptor<EncryptionKey>, 'encryptWithKey'>;
107
+ /**
108
+ * Additional key deriver for the TOPRF client.
109
+ *
110
+ * This is a function that takes a seed and salt and returns a key in bytes (Uint8Array).
111
+ * It is used as an additional step during key derivation. This can be used, for example, to inject a slow key
112
+ * derivation step to protect against local brute force attacks on the password.
113
+ *
114
+ * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
115
+ */
116
+ export type ToprfKeyDeriver = {
117
+ /**
118
+ * Derive a key from a seed and salt.
119
+ *
120
+ * @param seed - The seed to derive the key from.
121
+ * @param salt - The salt to derive the key from.
122
+ * @returns The derived key.
123
+ */
124
+ deriveKey: (seed: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;
125
+ };
87
126
  /**
88
127
  * Seedless Onboarding Controller Options.
89
128
  *
@@ -103,6 +142,17 @@ export type SeedlessOnboardingControllerOptions<EncryptionKey> = {
103
142
  * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
104
143
  */
105
144
  encryptor: VaultEncryptor<EncryptionKey>;
145
+ /**
146
+ * Optional key derivation interface for the TOPRF client.
147
+ *
148
+ * If provided, it will be used as an additional step during
149
+ * key derivation. This can be used, for example, to inject a slow key
150
+ * derivation step to protect against local brute force attacks on the
151
+ * password.
152
+ *
153
+ * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
154
+ */
155
+ toprfKeyDeriver?: ToprfKeyDeriver;
106
156
  /**
107
157
  * Type of Web3Auth network to be used for the Seedless Onboarding flow.
108
158
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAAkC;AAC1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,kCAAkC;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E,UAAU,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC"}
package/dist/types.d.mts CHANGED
@@ -45,6 +45,19 @@ export type SRPBackedUpUserDetails = {
45
45
  */
46
46
  authPubKey: string;
47
47
  };
48
+ /**
49
+ * The data of the recovery error.
50
+ */
51
+ export type RecoveryErrorData = {
52
+ /**
53
+ * The remaining time in seconds before the user can try again.
54
+ */
55
+ remainingTime: number;
56
+ /**
57
+ * The number of attempts made by the user.
58
+ */
59
+ numberOfAttempts: number;
60
+ };
48
61
  export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & Partial<SRPBackedUpUserDetails> & {
49
62
  /**
50
63
  * Encrypted array of serialized keyrings data.
@@ -72,6 +85,13 @@ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails
72
85
  isExpiredPwd: boolean;
73
86
  timestamp: number;
74
87
  };
88
+ /**
89
+ * The cached data of the recovery error.
90
+ *
91
+ * This data is used to cache the recovery error data to retrieve the accurate ratelimit remainingTime and numberOfAttempts.
92
+ * And it also helps to synchronize the recovery error data across multiple devices.
93
+ */
94
+ recoveryRatelimitCache?: RecoveryErrorData;
75
95
  };
76
96
  export type SeedlessOnboardingControllerGetStateAction = ControllerGetStateAction<typeof controllerName, SeedlessOnboardingControllerState>;
77
97
  export type SeedlessOnboardingControllerActions = SeedlessOnboardingControllerGetStateAction;
@@ -84,6 +104,25 @@ export type SeedlessOnboardingControllerMessenger = RestrictedMessenger<typeof c
84
104
  * Encryptor interface for encrypting and decrypting seedless onboarding vault.
85
105
  */
86
106
  export type VaultEncryptor<EncryptionKey> = Omit<ExportableKeyEncryptor<EncryptionKey>, 'encryptWithKey'>;
107
+ /**
108
+ * Additional key deriver for the TOPRF client.
109
+ *
110
+ * This is a function that takes a seed and salt and returns a key in bytes (Uint8Array).
111
+ * It is used as an additional step during key derivation. This can be used, for example, to inject a slow key
112
+ * derivation step to protect against local brute force attacks on the password.
113
+ *
114
+ * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
115
+ */
116
+ export type ToprfKeyDeriver = {
117
+ /**
118
+ * Derive a key from a seed and salt.
119
+ *
120
+ * @param seed - The seed to derive the key from.
121
+ * @param salt - The salt to derive the key from.
122
+ * @returns The derived key.
123
+ */
124
+ deriveKey: (seed: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;
125
+ };
87
126
  /**
88
127
  * Seedless Onboarding Controller Options.
89
128
  *
@@ -103,6 +142,17 @@ export type SeedlessOnboardingControllerOptions<EncryptionKey> = {
103
142
  * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
104
143
  */
105
144
  encryptor: VaultEncryptor<EncryptionKey>;
145
+ /**
146
+ * Optional key derivation interface for the TOPRF client.
147
+ *
148
+ * If provided, it will be used as an additional step during
149
+ * key derivation. This can be used, for example, to inject a slow key
150
+ * derivation step to protect against local brute force attacks on the
151
+ * password.
152
+ *
153
+ * @default browser-passworder @link https://github.com/MetaMask/browser-passworder
154
+ */
155
+ toprfKeyDeriver?: ToprfKeyDeriver;
106
156
  /**
107
157
  * Type of Web3Auth network to be used for the Seedless Onboarding flow.
108
158
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAAkC;AAC1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,kCAAkC;AAC5E,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC7B,qCAAqC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,sCAAsC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB;AAElD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,eAAe,EAChB,wBAAoB;AAErB,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EA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,UAAU,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,CAAC,aAAa,IAAI;IAC/D,SAAS,EAAE,qCAAqC,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAEnD;;;;OAIG;IACH,SAAS,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAEzC;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,CAAC,MAAM,IAAI,CAAC,EAC/C,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC;CACtC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RestrictedMessenger } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type {\n ExportableKeyEncryptor,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n} from '@metamask/keyring-controller';\nimport type { NodeAuthTokens } from '@metamask/toprf-secure-backup';\nimport type { MutexInterface } from 'async-mutex';\n\nimport type {\n AuthConnection,\n controllerName,\n SecretMetadataVersion,\n SecretType,\n Web3AuthNetwork,\n} from './constants';\n\nexport type SocialBackupsMetadata = {\n id: string;\n hash: string;\n};\n\nexport type AuthenticatedUserDetails = {\n /**\n * Type of social login provider.\n */\n authConnection: AuthConnection;\n\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n *\n * This values are used to authenticate users when they go through the Seedless Onboarding flow.\n */\n nodeAuthTokens: NodeAuthTokens;\n\n /**\n * OAuth connection id from web3auth dashboard.\n */\n authConnectionId: string;\n\n /**\n * The optional grouped authConnectionId to authenticate the user with Web3Auth network.\n */\n groupedAuthConnectionId?: string;\n\n /**\n * The user email or ID from Social login.\n */\n userId: string;\n\n /**\n * The user email from Social login.\n */\n socialLoginEmail: string;\n};\n\nexport type SRPBackedUpUserDetails = {\n /**\n * The public key of the authentication key pair in base64 format.\n *\n * This value is used to check if the password is outdated compare to the global password and find backed up old password.\n */\n authPubKey: string;\n};\n\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> &\n Partial<SRPBackedUpUserDetails> & {\n /**\n * Encrypted array of serialized keyrings data.\n */\n vault?: string;\n\n /**\n * The hashes of the seed phrase backups.\n *\n * This is to facilitate the UI to display backup status of the seed phrases.\n */\n socialBackupsMetadata: SocialBackupsMetadata[];\n\n /**\n * The encryption key derived from the password and used to encrypt\n * the vault.\n */\n vaultEncryptionKey?: string;\n\n /**\n * The salt used to derive the encryption key from the password.\n */\n vaultEncryptionSalt?: string;\n\n /**\n * Cache for checkIsPasswordOutdated result and timestamp.\n */\n passwordOutdatedCache?: { isExpiredPwd: boolean; timestamp: number };\n };\n\n// Actions\nexport type SeedlessOnboardingControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerActions =\n SeedlessOnboardingControllerGetStateAction;\n\nexport type AllowedActions = never;\n\n// Events\nexport type SeedlessOnboardingControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerEvents =\n SeedlessOnboardingControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type SeedlessOnboardingControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n SeedlessOnboardingControllerActions | AllowedActions,\n SeedlessOnboardingControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Encryptor interface for encrypting and decrypting seedless onboarding vault.\n */\nexport type VaultEncryptor<EncryptionKey> = Omit<\n ExportableKeyEncryptor<EncryptionKey>,\n 'encryptWithKey'\n>;\n\n/**\n * Seedless Onboarding Controller Options.\n *\n * @param messenger - The messenger to use for this controller.\n * @param state - The initial state to set on this controller.\n * @param encryptor - The encryptor to use for encrypting and decrypting seedless onboarding vault.\n */\nexport type SeedlessOnboardingControllerOptions<EncryptionKey> = {\n messenger: SeedlessOnboardingControllerMessenger;\n\n /**\n * Initial state to set on this controller.\n */\n state?: Partial<SeedlessOnboardingControllerState>;\n\n /**\n * Encryptor to use for encrypting and decrypting seedless onboarding vault.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n encryptor: VaultEncryptor<EncryptionKey>;\n\n /**\n * Type of Web3Auth network to be used for the Seedless Onboarding flow.\n *\n * @default Web3AuthNetwork.Mainnet\n */\n network?: Web3AuthNetwork;\n};\n\n/**\n * A function executed within a mutually exclusive lock, with\n * a mutex releaser in its option bag.\n *\n * @param releaseLock - A function to release the lock.\n */\nexport type MutuallyExclusiveCallback<Result> = ({\n releaseLock,\n}: {\n releaseLock: MutexInterface.Releaser;\n}) => Promise<Result>;\n\n/**\n * The structure of the data which is serialized and stored in the vault.\n */\nexport type VaultData = {\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n */\n authTokens: NodeAuthTokens;\n /**\n * The encryption key to encrypt the seed phrase.\n */\n toprfEncryptionKey: string;\n /**\n * The authentication key pair to authenticate the TOPRF.\n */\n toprfAuthKeyPair: string;\n};\n\nexport type SecretDataType = Uint8Array | string | number;\n\n/**\n * The constructor options for the seed phrase metadata.\n */\nexport type SecretMetadataOptions = {\n /**\n * The timestamp when the seed phrase was created.\n */\n timestamp: number;\n /**\n * The type of the seed phrase.\n */\n type: SecretType;\n /**\n * The version of the seed phrase metadata.\n */\n version: SecretMetadataVersion;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RestrictedMessenger } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type {\n ExportableKeyEncryptor,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n} from '@metamask/keyring-controller';\nimport type { NodeAuthTokens } from '@metamask/toprf-secure-backup';\nimport type { MutexInterface } from 'async-mutex';\n\nimport type {\n AuthConnection,\n controllerName,\n SecretMetadataVersion,\n SecretType,\n Web3AuthNetwork,\n} from './constants';\n\nexport type SocialBackupsMetadata = {\n id: string;\n hash: string;\n};\n\nexport type AuthenticatedUserDetails = {\n /**\n * Type of social login provider.\n */\n authConnection: AuthConnection;\n\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n *\n * This values are used to authenticate users when they go through the Seedless Onboarding flow.\n */\n nodeAuthTokens: NodeAuthTokens;\n\n /**\n * OAuth connection id from web3auth dashboard.\n */\n authConnectionId: string;\n\n /**\n * The optional grouped authConnectionId to authenticate the user with Web3Auth network.\n */\n groupedAuthConnectionId?: string;\n\n /**\n * The user email or ID from Social login.\n */\n userId: string;\n\n /**\n * The user email from Social login.\n */\n socialLoginEmail: string;\n};\n\nexport type SRPBackedUpUserDetails = {\n /**\n * The public key of the authentication key pair in base64 format.\n *\n * This value is used to check if the password is outdated compare to the global password and find backed up old password.\n */\n authPubKey: string;\n};\n\n/**\n * The data of the recovery error.\n */\nexport type RecoveryErrorData = {\n /**\n * The remaining time in seconds before the user can try again.\n */\n remainingTime: number;\n\n /**\n * The number of attempts made by the user.\n */\n numberOfAttempts: number;\n};\n\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> &\n Partial<SRPBackedUpUserDetails> & {\n /**\n * Encrypted array of serialized keyrings data.\n */\n vault?: string;\n\n /**\n * The hashes of the seed phrase backups.\n *\n * This is to facilitate the UI to display backup status of the seed phrases.\n */\n socialBackupsMetadata: SocialBackupsMetadata[];\n\n /**\n * The encryption key derived from the password and used to encrypt\n * the vault.\n */\n vaultEncryptionKey?: string;\n\n /**\n * The salt used to derive the encryption key from the password.\n */\n vaultEncryptionSalt?: string;\n\n /**\n * Cache for checkIsPasswordOutdated result and timestamp.\n */\n passwordOutdatedCache?: { isExpiredPwd: boolean; timestamp: number };\n\n /**\n * The cached data of the recovery error.\n *\n * This data is used to cache the recovery error data to retrieve the accurate ratelimit remainingTime and numberOfAttempts.\n * And it also helps to synchronize the recovery error data across multiple devices.\n */\n recoveryRatelimitCache?: RecoveryErrorData;\n };\n\n// Actions\nexport type SeedlessOnboardingControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerActions =\n SeedlessOnboardingControllerGetStateAction;\n\nexport type AllowedActions = never;\n\n// Events\nexport type SeedlessOnboardingControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n SeedlessOnboardingControllerState\n >;\nexport type SeedlessOnboardingControllerEvents =\n SeedlessOnboardingControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type SeedlessOnboardingControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n SeedlessOnboardingControllerActions | AllowedActions,\n SeedlessOnboardingControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Encryptor interface for encrypting and decrypting seedless onboarding vault.\n */\nexport type VaultEncryptor<EncryptionKey> = Omit<\n ExportableKeyEncryptor<EncryptionKey>,\n 'encryptWithKey'\n>;\n\n/**\n * Additional key deriver for the TOPRF client.\n *\n * This is a function that takes a seed and salt and returns a key in bytes (Uint8Array).\n * It is used as an additional step during key derivation. This can be used, for example, to inject a slow key\n * derivation step to protect against local brute force attacks on the password.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\nexport type ToprfKeyDeriver = {\n /**\n * Derive a key from a seed and salt.\n *\n * @param seed - The seed to derive the key from.\n * @param salt - The salt to derive the key from.\n * @returns The derived key.\n */\n deriveKey: (seed: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;\n};\n\n/**\n * Seedless Onboarding Controller Options.\n *\n * @param messenger - The messenger to use for this controller.\n * @param state - The initial state to set on this controller.\n * @param encryptor - The encryptor to use for encrypting and decrypting seedless onboarding vault.\n */\nexport type SeedlessOnboardingControllerOptions<EncryptionKey> = {\n messenger: SeedlessOnboardingControllerMessenger;\n\n /**\n * Initial state to set on this controller.\n */\n state?: Partial<SeedlessOnboardingControllerState>;\n\n /**\n * Encryptor to use for encrypting and decrypting seedless onboarding vault.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n encryptor: VaultEncryptor<EncryptionKey>;\n\n /**\n * Optional key derivation interface for the TOPRF client.\n *\n * If provided, it will be used as an additional step during\n * key derivation. This can be used, for example, to inject a slow key\n * derivation step to protect against local brute force attacks on the\n * password.\n *\n * @default browser-passworder @link https://github.com/MetaMask/browser-passworder\n */\n toprfKeyDeriver?: ToprfKeyDeriver;\n\n /**\n * Type of Web3Auth network to be used for the Seedless Onboarding flow.\n *\n * @default Web3AuthNetwork.Mainnet\n */\n network?: Web3AuthNetwork;\n};\n\n/**\n * A function executed within a mutually exclusive lock, with\n * a mutex releaser in its option bag.\n *\n * @param releaseLock - A function to release the lock.\n */\nexport type MutuallyExclusiveCallback<Result> = ({\n releaseLock,\n}: {\n releaseLock: MutexInterface.Releaser;\n}) => Promise<Result>;\n\n/**\n * The structure of the data which is serialized and stored in the vault.\n */\nexport type VaultData = {\n /**\n * The node auth tokens from OAuth User authentication after the Social login.\n */\n authTokens: NodeAuthTokens;\n /**\n * The encryption key to encrypt the seed phrase.\n */\n toprfEncryptionKey: string;\n /**\n * The authentication key pair to authenticate the TOPRF.\n */\n toprfAuthKeyPair: string;\n};\n\nexport type SecretDataType = Uint8Array | string | number;\n\n/**\n * The constructor options for the seed phrase metadata.\n */\nexport type SecretMetadataOptions = {\n /**\n * The timestamp when the seed phrase was created.\n */\n timestamp: number;\n /**\n * The type of the seed phrase.\n */\n type: SecretType;\n /**\n * The version of the seed phrase metadata.\n */\n version: SecretMetadataVersion;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/seedless-onboarding-controller",
3
- "version": "0.0.0-preview-e9f8bc88",
3
+ "version": "1.0.0-preview-39fa8d37",
4
4
  "description": "Backup and rehydrate SRP(s) using social login and password",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -47,9 +47,9 @@
47
47
  "since-latest-release": "../../scripts/since-latest-release.sh"
48
48
  },
49
49
  "dependencies": {
50
- "@metamask/auth-network-utils": "^0.1.0",
50
+ "@metamask/auth-network-utils": "^0.3.0",
51
51
  "@metamask/base-controller": "^8.0.1",
52
- "@metamask/toprf-secure-backup": "^0.1.0",
52
+ "@metamask/toprf-secure-backup": "^0.3.1",
53
53
  "@metamask/utils": "^11.2.0",
54
54
  "async-mutex": "^0.5.0"
55
55
  },
@@ -58,7 +58,7 @@
58
58
  "@lavamoat/preinstall-always-fail": "^2.1.0",
59
59
  "@metamask/auto-changelog": "^3.4.4",
60
60
  "@metamask/browser-passworder": "^4.3.0",
61
- "@metamask/keyring-controller": "^22.0.0",
61
+ "@metamask/keyring-controller": "^22.0.1",
62
62
  "@noble/ciphers": "^0.5.2",
63
63
  "@noble/curves": "^1.2.0",
64
64
  "@noble/hashes": "^1.4.0",