@metamask-previews/seedless-onboarding-controller 0.0.0-preview-c4b7ea2e → 0.0.0-preview-e9f8bc88

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 (38) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/SecretMetadata.cjs.map +1 -1
  3. package/dist/SecretMetadata.d.cts +0 -5
  4. package/dist/SecretMetadata.d.cts.map +1 -1
  5. package/dist/SecretMetadata.d.mts +0 -5
  6. package/dist/SecretMetadata.d.mts.map +1 -1
  7. package/dist/SecretMetadata.mjs.map +1 -1
  8. package/dist/SeedlessOnboardingController.cjs +328 -117
  9. package/dist/SeedlessOnboardingController.cjs.map +1 -1
  10. package/dist/SeedlessOnboardingController.d.cts +47 -1
  11. package/dist/SeedlessOnboardingController.d.cts.map +1 -1
  12. package/dist/SeedlessOnboardingController.d.mts +47 -1
  13. package/dist/SeedlessOnboardingController.d.mts.map +1 -1
  14. package/dist/SeedlessOnboardingController.mjs +330 -119
  15. package/dist/SeedlessOnboardingController.mjs.map +1 -1
  16. package/dist/constants.cjs +5 -1
  17. package/dist/constants.cjs.map +1 -1
  18. package/dist/constants.d.cts +5 -1
  19. package/dist/constants.d.cts.map +1 -1
  20. package/dist/constants.d.mts +5 -1
  21. package/dist/constants.d.mts.map +1 -1
  22. package/dist/constants.mjs +4 -0
  23. package/dist/constants.mjs.map +1 -1
  24. package/dist/errors.cjs +26 -1
  25. package/dist/errors.cjs.map +1 -1
  26. package/dist/errors.d.cts +13 -0
  27. package/dist/errors.d.cts.map +1 -1
  28. package/dist/errors.d.mts +13 -0
  29. package/dist/errors.d.mts.map +1 -1
  30. package/dist/errors.mjs +24 -0
  31. package/dist/errors.mjs.map +1 -1
  32. package/dist/types.cjs.map +1 -1
  33. package/dist/types.d.cts +16 -1
  34. package/dist/types.d.cts.map +1 -1
  35. package/dist/types.d.mts +16 -1
  36. package/dist/types.d.mts.map +1 -1
  37. package/dist/types.mjs.map +1 -1
  38. package/package.json +1 -1
@@ -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\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> & {\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// 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// 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"]}
package/dist/types.d.cts CHANGED
@@ -37,7 +37,15 @@ export type AuthenticatedUserDetails = {
37
37
  */
38
38
  socialLoginEmail: string;
39
39
  };
40
- export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & {
40
+ export type SRPBackedUpUserDetails = {
41
+ /**
42
+ * The public key of the authentication key pair in base64 format.
43
+ *
44
+ * This value is used to check if the password is outdated compare to the global password and find backed up old password.
45
+ */
46
+ authPubKey: string;
47
+ };
48
+ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & Partial<SRPBackedUpUserDetails> & {
41
49
  /**
42
50
  * Encrypted array of serialized keyrings data.
43
51
  */
@@ -57,6 +65,13 @@ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails
57
65
  * The salt used to derive the encryption key from the password.
58
66
  */
59
67
  vaultEncryptionSalt?: string;
68
+ /**
69
+ * Cache for checkIsPasswordOutdated result and timestamp.
70
+ */
71
+ passwordOutdatedCache?: {
72
+ isExpiredPwd: boolean;
73
+ timestamp: number;
74
+ };
60
75
  };
61
76
  export type SeedlessOnboardingControllerGetStateAction = ControllerGetStateAction<typeof controllerName, SeedlessOnboardingControllerState>;
62
77
  export type SeedlessOnboardingControllerActions = SeedlessOnboardingControllerGetStateAction;
@@ -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;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,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,cAAc,EA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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"}
package/dist/types.d.mts CHANGED
@@ -37,7 +37,15 @@ export type AuthenticatedUserDetails = {
37
37
  */
38
38
  socialLoginEmail: string;
39
39
  };
40
- export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & {
40
+ export type SRPBackedUpUserDetails = {
41
+ /**
42
+ * The public key of the authentication key pair in base64 format.
43
+ *
44
+ * This value is used to check if the password is outdated compare to the global password and find backed up old password.
45
+ */
46
+ authPubKey: string;
47
+ };
48
+ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails> & Partial<SRPBackedUpUserDetails> & {
41
49
  /**
42
50
  * Encrypted array of serialized keyrings data.
43
51
  */
@@ -57,6 +65,13 @@ export type SeedlessOnboardingControllerState = Partial<AuthenticatedUserDetails
57
65
  * The salt used to derive the encryption key from the password.
58
66
  */
59
67
  vaultEncryptionSalt?: string;
68
+ /**
69
+ * Cache for checkIsPasswordOutdated result and timestamp.
70
+ */
71
+ passwordOutdatedCache?: {
72
+ isExpiredPwd: boolean;
73
+ timestamp: number;
74
+ };
60
75
  };
61
76
  export type SeedlessOnboardingControllerGetStateAction = ControllerGetStateAction<typeof controllerName, SeedlessOnboardingControllerState>;
62
77
  export type SeedlessOnboardingControllerActions = SeedlessOnboardingControllerGetStateAction;
@@ -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,EAC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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\n// State\nexport type SeedlessOnboardingControllerState =\n Partial<AuthenticatedUserDetails> & {\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// 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// 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/seedless-onboarding-controller",
3
- "version": "0.0.0-preview-c4b7ea2e",
3
+ "version": "0.0.0-preview-e9f8bc88",
4
4
  "description": "Backup and rehydrate SRP(s) using social login and password",
5
5
  "keywords": [
6
6
  "MetaMask",