@metamask-previews/profile-sync-controller 29.0.0-preview-3e34650c2 → 29.0.0-preview-4f4c98e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/controllers/authentication/{AuthenticationController-method-action-types.d.mts → AuthenticationController-method-action-types.d.ts} +2 -2
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController-method-action-types.mjs → AuthenticationController-method-action-types.js} +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController.d.mts → AuthenticationController.d.ts} +10 -10
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController.mjs → AuthenticationController.js} +11 -11
- package/dist/controllers/authentication/AuthenticationController.js.map +1 -0
- package/dist/controllers/authentication/{index.d.cts → index.d.ts} +5 -5
- package/dist/controllers/authentication/index.d.ts.map +1 -0
- package/dist/controllers/authentication/index.js +6 -0
- package/dist/controllers/authentication/index.js.map +1 -0
- package/dist/controllers/authentication/mocks/index.d.ts +2 -0
- package/dist/controllers/authentication/mocks/index.d.ts.map +1 -0
- package/dist/controllers/authentication/mocks/index.js +2 -0
- package/dist/controllers/authentication/mocks/index.js.map +1 -0
- package/dist/controllers/authentication/mocks/{mockResponses.d.mts → mockResponses.d.ts} +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +1 -0
- package/dist/controllers/authentication/mocks/{mockResponses.mjs → mockResponses.js} +2 -2
- package/dist/controllers/authentication/mocks/mockResponses.js.map +1 -0
- package/dist/controllers/index.d.ts +3 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/index.js +3 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController-method-action-types.d.mts → UserStorageController-method-action-types.d.ts} +2 -2
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.ts.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController-method-action-types.mjs → UserStorageController-method-action-types.js} +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.js.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController.d.cts → UserStorageController.d.ts} +14 -14
- package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController.mjs → UserStorageController.js} +15 -15
- package/dist/controllers/user-storage/UserStorageController.js.map +1 -0
- package/dist/controllers/user-storage/constants.d.ts +15 -0
- package/dist/controllers/user-storage/constants.d.ts.map +1 -0
- package/dist/controllers/user-storage/{constants.mjs → constants.js} +1 -1
- package/dist/controllers/user-storage/constants.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{constants.d.cts → constants.d.ts} +1 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{constants.mjs → constants.js} +1 -1
- package/dist/controllers/user-storage/contact-syncing/constants.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{controller-integration.d.cts → controller-integration.d.ts} +3 -3
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{controller-integration.mjs → controller-integration.js} +6 -6
- package/dist/controllers/user-storage/contact-syncing/controller-integration.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.d.cts → setup-subscriptions.d.ts} +2 -2
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.mjs → setup-subscriptions.js} +4 -4
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{sync-utils.d.cts → sync-utils.d.ts} +2 -2
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{sync-utils.mjs → sync-utils.js} +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{types.d.cts → types.d.ts} +6 -6
- package/dist/controllers/user-storage/contact-syncing/types.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.js +2 -0
- package/dist/controllers/user-storage/contact-syncing/types.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{utils.d.mts → utils.d.ts} +3 -3
- package/dist/controllers/user-storage/contact-syncing/utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{utils.mjs → utils.js} +2 -2
- package/dist/controllers/user-storage/contact-syncing/utils.js.map +1 -0
- package/dist/controllers/user-storage/{index.d.cts → index.d.ts} +8 -8
- package/dist/controllers/user-storage/index.d.ts.map +1 -0
- package/dist/controllers/user-storage/index.js +9 -0
- package/dist/controllers/user-storage/index.js.map +1 -0
- package/dist/controllers/user-storage/mocks/index.d.ts +3 -0
- package/dist/controllers/user-storage/mocks/index.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/index.js +3 -0
- package/dist/controllers/user-storage/mocks/index.js.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockResponses.d.mts → mockResponses.d.ts} +3 -3
- package/dist/controllers/user-storage/mocks/mockResponses.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockResponses.mjs → mockResponses.js} +4 -4
- package/dist/controllers/user-storage/mocks/mockResponses.js.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockStorage.d.cts → mockStorage.d.ts} +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockStorage.mjs → mockStorage.js} +2 -2
- package/dist/controllers/user-storage/mocks/mockStorage.js.map +1 -0
- package/dist/controllers/user-storage/{types.d.cts → types.d.ts} +3 -3
- package/dist/controllers/user-storage/types.d.ts.map +1 -0
- package/dist/controllers/user-storage/types.js +2 -0
- package/dist/controllers/user-storage/types.js.map +1 -0
- package/dist/controllers/user-storage/{utils.d.cts → utils.d.ts} +1 -1
- package/dist/controllers/user-storage/utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/{utils.mjs → utils.js} +1 -1
- package/dist/controllers/user-storage/utils.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-siwe.d.cts → flow-siwe.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-siwe.mjs → flow-siwe.js} +5 -5
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-srp.d.cts → flow-srp.d.ts} +5 -5
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-srp.mjs → flow-srp.js} +8 -8
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{services.d.cts → services.d.ts} +5 -5
- package/dist/sdk/authentication-jwt-bearer/services.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{services.mjs → services.js} +6 -6
- package/dist/sdk/authentication-jwt-bearer/services.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{types.d.cts → types.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/types.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{types.mjs → types.js} +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{identifier.d.cts → identifier.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{identifier.mjs → identifier.js} +2 -2
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{time.d.cts → time.d.ts} +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{time.mjs → time.js} +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.js.map +1 -0
- package/dist/sdk/{authentication.d.cts → authentication.d.ts} +9 -9
- package/dist/sdk/authentication.d.ts.map +1 -0
- package/dist/sdk/{authentication.mjs → authentication.js} +9 -9
- package/dist/sdk/authentication.js.map +1 -0
- package/dist/sdk/{constants.d.cts → constants.d.ts} +1 -1
- package/dist/sdk/constants.d.ts.map +1 -0
- package/dist/sdk/{constants.mjs → constants.js} +1 -1
- package/dist/sdk/constants.js.map +1 -0
- package/dist/sdk/{errors.d.cts → errors.d.ts} +1 -1
- package/dist/sdk/errors.d.ts.map +1 -0
- package/dist/sdk/{errors.mjs → errors.js} +2 -2
- package/dist/sdk/errors.js.map +1 -0
- package/dist/sdk/index.d.ts +8 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +8 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/mocks/{auth.d.cts → auth.d.ts} +2 -2
- package/dist/sdk/mocks/auth.d.ts.map +1 -0
- package/dist/sdk/mocks/{auth.mjs → auth.js} +3 -3
- package/dist/sdk/mocks/auth.js.map +1 -0
- package/dist/sdk/mocks/{userstorage.d.cts → userstorage.d.ts} +1 -1
- package/dist/sdk/mocks/userstorage.d.ts.map +1 -0
- package/dist/sdk/mocks/{userstorage.mjs → userstorage.js} +5 -5
- package/dist/sdk/mocks/userstorage.js.map +1 -0
- package/dist/sdk/{user-storage.d.mts → user-storage.d.ts} +5 -5
- package/dist/sdk/user-storage.d.ts.map +1 -0
- package/dist/sdk/{user-storage.mjs → user-storage.js} +6 -6
- package/dist/sdk/user-storage.js.map +1 -0
- package/dist/sdk/utils/{eip-6963-metamask-provider.d.cts → eip-6963-metamask-provider.d.ts} +2 -2
- package/dist/sdk/utils/eip-6963-metamask-provider.d.ts.map +1 -0
- package/dist/sdk/utils/{eip-6963-metamask-provider.mjs → eip-6963-metamask-provider.js} +1 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.js.map +1 -0
- package/dist/sdk/utils/{messaging-signing-snap-requests.d.cts → messaging-signing-snap-requests.d.ts} +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.ts.map +1 -0
- package/dist/sdk/utils/{messaging-signing-snap-requests.mjs → messaging-signing-snap-requests.js} +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.js.map +1 -0
- package/dist/sdk/utils/{validate-login-response.d.mts → validate-login-response.d.ts} +2 -2
- package/dist/sdk/utils/validate-login-response.d.ts.map +1 -0
- package/dist/sdk/utils/{validate-login-response.mjs → validate-login-response.js} +1 -1
- package/dist/sdk/utils/validate-login-response.js.map +1 -0
- package/dist/sdk/utils/{validate-pair-response.d.cts → validate-pair-response.d.ts} +1 -1
- package/dist/sdk/utils/validate-pair-response.d.ts.map +1 -0
- package/dist/sdk/utils/{validate-pair-response.mjs → validate-pair-response.js} +1 -1
- package/dist/sdk/utils/validate-pair-response.js.map +1 -0
- package/dist/shared/encryption/{cache.d.cts → cache.d.ts} +1 -1
- package/dist/shared/encryption/cache.d.ts.map +1 -0
- package/dist/shared/encryption/{cache.mjs → cache.js} +3 -3
- package/dist/shared/encryption/cache.js.map +1 -0
- package/dist/shared/encryption/{constants.d.cts → constants.d.ts} +2 -2
- package/dist/shared/encryption/constants.d.ts.map +1 -0
- package/dist/shared/encryption/{constants.mjs → constants.js} +1 -1
- package/dist/shared/encryption/constants.js.map +1 -0
- package/dist/shared/encryption/{encryption.d.cts → encryption.d.ts} +3 -3
- package/dist/shared/encryption/encryption.d.ts.map +1 -0
- package/dist/shared/encryption/{encryption.mjs → encryption.js} +9 -9
- package/dist/shared/encryption/encryption.js.map +1 -0
- package/dist/shared/encryption/index.d.ts +5 -0
- package/dist/shared/encryption/index.d.ts.map +1 -0
- package/dist/shared/encryption/index.js +5 -0
- package/dist/shared/encryption/index.js.map +1 -0
- package/dist/shared/encryption/{utils.d.cts → utils.d.ts} +3 -3
- package/dist/shared/encryption/utils.d.ts.map +1 -0
- package/dist/shared/encryption/{utils.mjs → utils.js} +1 -1
- package/dist/shared/encryption/utils.js.map +1 -0
- package/dist/shared/{env.d.cts → env.d.ts} +1 -1
- package/dist/shared/env.d.ts.map +1 -0
- package/dist/shared/{env.mjs → env.js} +1 -1
- package/dist/shared/env.js.map +1 -0
- package/dist/shared/{storage-schema.d.mts → storage-schema.d.ts} +1 -1
- package/dist/shared/storage-schema.d.ts.map +1 -0
- package/dist/shared/{storage-schema.mjs → storage-schema.js} +2 -2
- package/dist/shared/storage-schema.js.map +1 -0
- package/dist/shared/types/{encryption.d.cts → encryption.d.ts} +1 -1
- package/dist/shared/types/encryption.d.ts.map +1 -0
- package/dist/shared/types/encryption.js +2 -0
- package/dist/shared/types/encryption.js.map +1 -0
- package/dist/shared/types/{services.d.cts → services.d.ts} +2 -2
- package/dist/shared/types/services.d.ts.map +1 -0
- package/dist/shared/types/services.js +2 -0
- package/dist/shared/types/services.js.map +1 -0
- package/dist/shared/utils/{entropy-source.d.cts → entropy-source.d.ts} +2 -2
- package/dist/shared/utils/entropy-source.d.ts.map +1 -0
- package/dist/shared/utils/{entropy-source.mjs → entropy-source.js} +2 -2
- package/dist/shared/utils/entropy-source.js.map +1 -0
- package/dist/shared/utils/{event-queue.d.cts → event-queue.d.ts} +1 -1
- package/dist/shared/utils/event-queue.d.ts.map +1 -0
- package/dist/shared/utils/{event-queue.mjs → event-queue.js} +1 -1
- package/dist/shared/utils/event-queue.js.map +1 -0
- package/dist/shared/utils/{hd-keyring-seed.d.mts → hd-keyring-seed.d.ts} +3 -3
- package/dist/shared/utils/hd-keyring-seed.d.ts.map +1 -0
- package/dist/shared/utils/{hd-keyring-seed.mjs → hd-keyring-seed.js} +1 -1
- package/dist/shared/utils/hd-keyring-seed.js.map +1 -0
- package/dist/shared/utils/{message-signing.d.mts → message-signing.d.ts} +1 -1
- package/dist/shared/utils/message-signing.d.ts.map +1 -0
- package/dist/shared/utils/{message-signing.mjs → message-signing.js} +7 -7
- package/dist/shared/utils/message-signing.js.map +1 -0
- package/package.json +22 -56
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs +0 -7
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +0 -102
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.cjs +0 -489
- package/dist/controllers/authentication/AuthenticationController.cjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +0 -130
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.mjs.map +0 -1
- package/dist/controllers/authentication/index.cjs +0 -35
- package/dist/controllers/authentication/index.cjs.map +0 -1
- package/dist/controllers/authentication/index.d.cts.map +0 -1
- package/dist/controllers/authentication/index.d.mts +0 -7
- package/dist/controllers/authentication/index.d.mts.map +0 -1
- package/dist/controllers/authentication/index.mjs +0 -6
- package/dist/controllers/authentication/index.mjs.map +0 -1
- package/dist/controllers/authentication/mocks/index.cjs +0 -18
- package/dist/controllers/authentication/mocks/index.cjs.map +0 -1
- package/dist/controllers/authentication/mocks/index.d.cts +0 -2
- package/dist/controllers/authentication/mocks/index.d.cts.map +0 -1
- package/dist/controllers/authentication/mocks/index.d.mts +0 -2
- package/dist/controllers/authentication/mocks/index.d.mts.map +0 -1
- package/dist/controllers/authentication/mocks/index.mjs +0 -2
- package/dist/controllers/authentication/mocks/index.mjs.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.cjs +0 -126
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +0 -58
- package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +0 -1
- package/dist/controllers/index.cjs +0 -29
- package/dist/controllers/index.cjs.map +0 -1
- package/dist/controllers/index.d.cts +0 -3
- package/dist/controllers/index.d.cts.map +0 -1
- package/dist/controllers/index.d.mts +0 -3
- package/dist/controllers/index.d.mts.map +0 -1
- package/dist/controllers/index.mjs +0 -3
- package/dist/controllers/index.mjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs +0 -7
- package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts +0 -137
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +0 -412
- package/dist/controllers/user-storage/UserStorageController.cjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +0 -182
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.mjs.map +0 -1
- package/dist/controllers/user-storage/constants.cjs +0 -19
- package/dist/controllers/user-storage/constants.cjs.map +0 -1
- package/dist/controllers/user-storage/constants.d.cts +0 -15
- package/dist/controllers/user-storage/constants.d.cts.map +0 -1
- package/dist/controllers/user-storage/constants.d.mts +0 -15
- package/dist/controllers/user-storage/constants.d.mts.map +0 -1
- package/dist/controllers/user-storage/constants.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.cjs +0 -12
- package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts +0 -9
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +0 -346
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +0 -47
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +0 -50
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +0 -8
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +0 -23
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +0 -9
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.cjs +0 -3
- package/dist/controllers/user-storage/contact-syncing/types.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.mts +0 -37
- package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.mjs +0 -2
- package/dist/controllers/user-storage/contact-syncing/types.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.cjs +0 -64
- package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts +0 -36
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +0 -1
- package/dist/controllers/user-storage/index.cjs +0 -38
- package/dist/controllers/user-storage/index.cjs.map +0 -1
- package/dist/controllers/user-storage/index.d.cts.map +0 -1
- package/dist/controllers/user-storage/index.d.mts +0 -10
- package/dist/controllers/user-storage/index.d.mts.map +0 -1
- package/dist/controllers/user-storage/index.mjs +0 -9
- package/dist/controllers/user-storage/index.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/index.cjs +0 -19
- package/dist/controllers/user-storage/mocks/index.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/index.d.cts +0 -3
- package/dist/controllers/user-storage/mocks/index.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/index.d.mts +0 -3
- package/dist/controllers/user-storage/mocks/index.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/index.mjs +0 -3
- package/dist/controllers/user-storage/mocks/index.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.cjs +0 -113
- package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.cts +0 -66
- package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.cjs +0 -36
- package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.mts +0 -5
- package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +0 -1
- package/dist/controllers/user-storage/types.cjs +0 -3
- package/dist/controllers/user-storage/types.cjs.map +0 -1
- package/dist/controllers/user-storage/types.d.cts.map +0 -1
- package/dist/controllers/user-storage/types.d.mts +0 -23
- package/dist/controllers/user-storage/types.d.mts.map +0 -1
- package/dist/controllers/user-storage/types.mjs +0 -2
- package/dist/controllers/user-storage/types.mjs.map +0 -1
- package/dist/controllers/user-storage/utils.cjs +0 -32
- package/dist/controllers/user-storage/utils.cjs.map +0 -1
- package/dist/controllers/user-storage/utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/utils.d.mts +0 -19
- package/dist/controllers/user-storage/utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/utils.mjs.map +0 -1
- package/dist/index.cjs +0 -30
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -4
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +0 -114
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +0 -25
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +0 -290
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +0 -44
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +0 -400
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts +0 -105
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs +0 -12
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +0 -114
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +0 -27
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +0 -13
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.cjs +0 -17
- package/dist/sdk/authentication-jwt-bearer/utils/time.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts +0 -8
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.mjs.map +0 -1
- package/dist/sdk/authentication.cjs +0 -132
- package/dist/sdk/authentication.cjs.map +0 -1
- package/dist/sdk/authentication.d.cts.map +0 -1
- package/dist/sdk/authentication.d.mts +0 -38
- package/dist/sdk/authentication.d.mts.map +0 -1
- package/dist/sdk/authentication.mjs.map +0 -1
- package/dist/sdk/constants.cjs +0 -7
- package/dist/sdk/constants.cjs.map +0 -1
- package/dist/sdk/constants.d.cts.map +0 -1
- package/dist/sdk/constants.d.mts +0 -4
- package/dist/sdk/constants.d.mts.map +0 -1
- package/dist/sdk/constants.mjs.map +0 -1
- package/dist/sdk/errors.cjs +0 -76
- package/dist/sdk/errors.cjs.map +0 -1
- package/dist/sdk/errors.d.cts.map +0 -1
- package/dist/sdk/errors.d.mts +0 -34
- package/dist/sdk/errors.d.mts.map +0 -1
- package/dist/sdk/errors.mjs.map +0 -1
- package/dist/sdk/index.cjs +0 -24
- package/dist/sdk/index.cjs.map +0 -1
- package/dist/sdk/index.d.cts +0 -8
- package/dist/sdk/index.d.cts.map +0 -1
- package/dist/sdk/index.d.mts +0 -8
- package/dist/sdk/index.d.mts.map +0 -1
- package/dist/sdk/index.mjs +0 -8
- package/dist/sdk/index.mjs.map +0 -1
- package/dist/sdk/mocks/auth.cjs +0 -82
- package/dist/sdk/mocks/auth.cjs.map +0 -1
- package/dist/sdk/mocks/auth.d.cts.map +0 -1
- package/dist/sdk/mocks/auth.d.mts +0 -69
- package/dist/sdk/mocks/auth.d.mts.map +0 -1
- package/dist/sdk/mocks/auth.mjs.map +0 -1
- package/dist/sdk/mocks/userstorage.cjs +0 -43
- package/dist/sdk/mocks/userstorage.cjs.map +0 -1
- package/dist/sdk/mocks/userstorage.d.cts.map +0 -1
- package/dist/sdk/mocks/userstorage.d.mts +0 -10
- package/dist/sdk/mocks/userstorage.d.mts.map +0 -1
- package/dist/sdk/mocks/userstorage.mjs.map +0 -1
- package/dist/sdk/user-storage.cjs +0 -386
- package/dist/sdk/user-storage.cjs.map +0 -1
- package/dist/sdk/user-storage.d.cts +0 -47
- package/dist/sdk/user-storage.d.cts.map +0 -1
- package/dist/sdk/user-storage.d.mts.map +0 -1
- package/dist/sdk/user-storage.mjs.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.cjs +0 -70
- package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +0 -25
- package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs +0 -96
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +0 -41
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +0 -1
- package/dist/sdk/utils/validate-login-response.cjs +0 -49
- package/dist/sdk/utils/validate-login-response.cjs.map +0 -1
- package/dist/sdk/utils/validate-login-response.d.cts +0 -14
- package/dist/sdk/utils/validate-login-response.d.cts.map +0 -1
- package/dist/sdk/utils/validate-login-response.d.mts.map +0 -1
- package/dist/sdk/utils/validate-login-response.mjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.cjs +0 -29
- package/dist/sdk/utils/validate-pair-response.cjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.cts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.mts +0 -26
- package/dist/sdk/utils/validate-pair-response.d.mts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.mjs.map +0 -1
- package/dist/shared/encryption/cache.cjs +0 -77
- package/dist/shared/encryption/cache.cjs.map +0 -1
- package/dist/shared/encryption/cache.d.cts.map +0 -1
- package/dist/shared/encryption/cache.d.mts +0 -32
- package/dist/shared/encryption/cache.d.mts.map +0 -1
- package/dist/shared/encryption/cache.mjs.map +0 -1
- package/dist/shared/encryption/constants.cjs +0 -17
- package/dist/shared/encryption/constants.cjs.map +0 -1
- package/dist/shared/encryption/constants.d.cts.map +0 -1
- package/dist/shared/encryption/constants.d.mts +0 -9
- package/dist/shared/encryption/constants.d.mts.map +0 -1
- package/dist/shared/encryption/constants.mjs.map +0 -1
- package/dist/shared/encryption/encryption.cjs +0 -209
- package/dist/shared/encryption/encryption.cjs.map +0 -1
- package/dist/shared/encryption/encryption.d.cts.map +0 -1
- package/dist/shared/encryption/encryption.d.mts +0 -30
- package/dist/shared/encryption/encryption.d.mts.map +0 -1
- package/dist/shared/encryption/encryption.mjs.map +0 -1
- package/dist/shared/encryption/index.cjs +0 -25
- package/dist/shared/encryption/index.cjs.map +0 -1
- package/dist/shared/encryption/index.d.cts +0 -5
- package/dist/shared/encryption/index.d.cts.map +0 -1
- package/dist/shared/encryption/index.d.mts +0 -5
- package/dist/shared/encryption/index.d.mts.map +0 -1
- package/dist/shared/encryption/index.mjs +0 -5
- package/dist/shared/encryption/index.mjs.map +0 -1
- package/dist/shared/encryption/utils.cjs +0 -21
- package/dist/shared/encryption/utils.cjs.map +0 -1
- package/dist/shared/encryption/utils.d.cts.map +0 -1
- package/dist/shared/encryption/utils.d.mts +0 -5
- package/dist/shared/encryption/utils.d.mts.map +0 -1
- package/dist/shared/encryption/utils.mjs.map +0 -1
- package/dist/shared/env.cjs +0 -85
- package/dist/shared/env.cjs.map +0 -1
- package/dist/shared/env.d.cts.map +0 -1
- package/dist/shared/env.d.mts +0 -34
- package/dist/shared/env.d.mts.map +0 -1
- package/dist/shared/env.mjs.map +0 -1
- package/dist/shared/storage-schema.cjs +0 -42
- package/dist/shared/storage-schema.cjs.map +0 -1
- package/dist/shared/storage-schema.d.cts +0 -34
- package/dist/shared/storage-schema.d.cts.map +0 -1
- package/dist/shared/storage-schema.d.mts.map +0 -1
- package/dist/shared/storage-schema.mjs.map +0 -1
- package/dist/shared/types/encryption.cjs +0 -3
- package/dist/shared/types/encryption.cjs.map +0 -1
- package/dist/shared/types/encryption.d.cts.map +0 -1
- package/dist/shared/types/encryption.d.mts +0 -2
- package/dist/shared/types/encryption.d.mts.map +0 -1
- package/dist/shared/types/encryption.mjs +0 -2
- package/dist/shared/types/encryption.mjs.map +0 -1
- package/dist/shared/types/services.cjs +0 -3
- package/dist/shared/types/services.cjs.map +0 -1
- package/dist/shared/types/services.d.cts.map +0 -1
- package/dist/shared/types/services.d.mts +0 -17
- package/dist/shared/types/services.d.mts.map +0 -1
- package/dist/shared/types/services.mjs +0 -2
- package/dist/shared/types/services.mjs.map +0 -1
- package/dist/shared/utils/entropy-source.cjs +0 -37
- package/dist/shared/utils/entropy-source.cjs.map +0 -1
- package/dist/shared/utils/entropy-source.d.cts.map +0 -1
- package/dist/shared/utils/entropy-source.d.mts +0 -22
- package/dist/shared/utils/entropy-source.d.mts.map +0 -1
- package/dist/shared/utils/entropy-source.mjs.map +0 -1
- package/dist/shared/utils/event-queue.cjs +0 -24
- package/dist/shared/utils/event-queue.cjs.map +0 -1
- package/dist/shared/utils/event-queue.d.cts.map +0 -1
- package/dist/shared/utils/event-queue.d.mts +0 -6
- package/dist/shared/utils/event-queue.d.mts.map +0 -1
- package/dist/shared/utils/event-queue.mjs.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.cjs +0 -49
- package/dist/shared/utils/hd-keyring-seed.cjs.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.d.cts +0 -27
- package/dist/shared/utils/hd-keyring-seed.d.cts.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.d.mts.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.mjs.map +0 -1
- package/dist/shared/utils/message-signing.cjs +0 -147
- package/dist/shared/utils/message-signing.cjs.map +0 -1
- package/dist/shared/utils/message-signing.d.cts +0 -73
- package/dist/shared/utils/message-signing.d.cts.map +0 -1
- package/dist/shared/utils/message-signing.d.mts.map +0 -1
- package/dist/shared/utils/message-signing.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
|
+
- **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
|
|
12
13
|
- **BREAKING:** Derive auth and user-storage message-signing keys natively via SIP-6 from HD keyring seeds instead of calling `@metamask/message-signing-snap` through `SnapController`. `AuthenticationController` and `UserStorageController` now require `KeyringController:withKeyringV2Unsafe` and no longer call `SnapController:handleRequest`. The message-signing snap remains for Portfolio / external origins ([#9824](https://github.com/MetaMask/core/pull/9824))
|
|
13
14
|
- Derive native SIP-6 keys with `@noble/hashes` HMAC-SHA-512 instead of Web Crypto, so auth works on React Native, whose SubtleCrypto cannot HMAC.
|
|
14
15
|
- Resolve HD entropy source IDs from `KeyringController` instead of the message-signing snap (`getBearerToken` primary ID, `performSignIn` SRP enumeration) ([#9794](https://github.com/MetaMask/core/pull/9794))
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { AuthenticationController } from
|
|
5
|
+
import type { AuthenticationController } from './AuthenticationController.js';
|
|
6
6
|
export type AuthenticationControllerPerformSignInAction = {
|
|
7
7
|
type: `AuthenticationController:performSignIn`;
|
|
8
8
|
handler: AuthenticationController['performSignIn'];
|
|
@@ -99,4 +99,4 @@ export type AuthenticationControllerIsSignedInAction = {
|
|
|
99
99
|
* Union of all AuthenticationController action types.
|
|
100
100
|
*/
|
|
101
101
|
export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerGetCustomerServiceTokenAction | AuthenticationControllerIsSignedInAction;
|
|
102
|
-
//# sourceMappingURL=AuthenticationController-method-action-types.d.
|
|
102
|
+
//# sourceMappingURL=AuthenticationController-method-action-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationController-method-action-types.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,mDAAmD,GACnD,4CAA4C,GAC5C,4CAA4C,GAC5C,+CAA+C,GAC/C,uDAAuD,GACvD,mDAAmD,GACnD,qDAAqD,GACrD,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationController-method-action-types.js","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController.js';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\n/**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\nexport type AuthenticationControllerRequestProfilePairingAction = {\n type: `AuthenticationController:requestProfilePairing`;\n handler: AuthenticationController['requestProfilePairing'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\n/**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\nexport type AuthenticationControllerRefreshCanonicalProfileIdAction = {\n type: `AuthenticationController:refreshCanonicalProfileId`;\n handler: AuthenticationController['refreshCanonicalProfileId'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BaseController } from
|
|
2
|
-
import type { ControllerGetStateAction, ControllerStateChangeEvent } from
|
|
3
|
-
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from
|
|
4
|
-
import type { Messenger } from
|
|
5
|
-
import type { SeedlessOnboardingControllerGetStateAction } from
|
|
6
|
-
import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage } from
|
|
7
|
-
import { Env } from
|
|
8
|
-
import type { MetaMetricsAuth } from
|
|
9
|
-
import { AuthenticationControllerMethodActions } from
|
|
1
|
+
import { BaseController } from '@metamask/base-controller';
|
|
2
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
|
|
3
|
+
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from '@metamask/keyring-controller';
|
|
4
|
+
import type { Messenger } from '@metamask/messenger';
|
|
5
|
+
import type { SeedlessOnboardingControllerGetStateAction } from '@metamask/seedless-onboarding-controller';
|
|
6
|
+
import type { LoginResponse, ProfileAlias, UserProfile, UserProfileLineage } from '../../sdk/index.js';
|
|
7
|
+
import { Env } from '../../sdk/index.js';
|
|
8
|
+
import type { MetaMetricsAuth } from '../../shared/types/services.js';
|
|
9
|
+
import { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types.js';
|
|
10
10
|
declare const controllerName = "AuthenticationController";
|
|
11
11
|
export type AuthenticationControllerState = {
|
|
12
12
|
isSignedIn: boolean;
|
|
@@ -127,4 +127,4 @@ export declare class AuthenticationController extends BaseController<typeof cont
|
|
|
127
127
|
isSignedIn(): boolean;
|
|
128
128
|
}
|
|
129
129
|
export {};
|
|
130
|
-
//# sourceMappingURL=AuthenticationController.d.
|
|
130
|
+
//# sourceMappingURL=AuthenticationController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,0CAA0C,EAC3C,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,0CAA0C,CAAC;AAG3G,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EAGZ,WAAW,EACX,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,GAAG,EAEJ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAA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CACvB,CAAC;AAEF;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,cAAc,CAC1D,OAAO,cAAc,EACrB,6BAA6B,EAC7B,iCAAiC,CAClC;;IA+BC,YAAY,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,iCAAiC,CAAC;QAC7C,KAAK,CAAC,EAAE,6BAA6B,CAAC;QACtC,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACnC;;;WAGG;QACH,WAAW,EAAE,eAAe,CAAC;KAC9B,EA8CA;IAmJY,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CA2B9C;IAED;;;;OAIG;IACI,qBAAqB,IAAI,IAAI,CAOnC;IAuGM,cAAc,IAAI,IAAI,CAK5B;IAED;;;;;;;;;;OAUG;IACU,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIrE;IAED;;;;;;;;;;;;OAYG;IACU,iBAAiB,CAC5B,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,WAAW,CAAC,CAItB;IAED;;;;;;;;;;;;;;;OAeG;IACU,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAgBxD;IAcY,qBAAqB,CAChC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAI7B;IAED;;;;;;;;;;OAUG;IACU,uBAAuB,CAClC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAIjB;IAEM,UAAU,IAAI,OAAO,CAE3B;CA8EF"}
|
package/dist/controllers/authentication/{AuthenticationController.mjs → AuthenticationController.js}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
1
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
2
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
3
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
4
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
5
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
6
|
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
12
|
var _AuthenticationController_instances, _AuthenticationController_metametrics, _AuthenticationController_auth, _AuthenticationController_config, _AuthenticationController_isUnlocked, _AuthenticationController_profilePairingRequestEpoch, _AuthenticationController_keyringController, _AuthenticationController_getLoginResponseFromState, _AuthenticationController_setLoginResponseToState, _AuthenticationController_assertIsUnlocked, _AuthenticationController_getHdKeyringEntropySourceIds, _AuthenticationController_getPrimaryEntropySourceId, _AuthenticationController_getLoginTag, _AuthenticationController_getLoginIdentifierType, _AuthenticationController_resolveSocialIdentifierType, _AuthenticationController_tryClearNeedsProfilePairing, _AuthenticationController_doPair, _AuthenticationController_pairSrpProfiles, _AuthenticationController_propagateCanonical, _AuthenticationController_getCanonicalProfileId, _AuthenticationController_invalidateSrpSession, _AuthenticationController_getHdKeyringSeed, _AuthenticationController_getPublicKey, _AuthenticationController__signMessageCache, _AuthenticationController_scopedCacheKey, _AuthenticationController_signMessage;
|
|
13
|
-
import { BaseController } from
|
|
14
|
-
import { assertMessageStartsWithMetamask, AuthType, Env, JwtBearerAuth } from
|
|
15
|
-
import { getHdKeyringEntropySourceIds, getPrimaryHdKeyringEntropySourceId } from
|
|
16
|
-
import { getHdKeyringSeed } from
|
|
17
|
-
import { getMessageSigningPublicKey, signMessageWithMessageSigningKey } from
|
|
13
|
+
import { BaseController } from '@metamask/base-controller';
|
|
14
|
+
import { assertMessageStartsWithMetamask, AuthType, Env, JwtBearerAuth, } from '../../sdk/index.js';
|
|
15
|
+
import { getHdKeyringEntropySourceIds, getPrimaryHdKeyringEntropySourceId, } from '../../shared/utils/entropy-source.js';
|
|
16
|
+
import { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';
|
|
17
|
+
import { getMessageSigningPublicKey, signMessageWithMessageSigningKey, } from '../../shared/utils/message-signing.js';
|
|
18
18
|
const controllerName = 'AuthenticationController';
|
|
19
19
|
export const defaultState = {
|
|
20
20
|
isSignedIn: false,
|
|
@@ -482,4 +482,4 @@ async function _AuthenticationController_signMessage(message, entropySourceId) {
|
|
|
482
482
|
__classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey] = result;
|
|
483
483
|
return result;
|
|
484
484
|
};
|
|
485
|
-
//# sourceMappingURL=AuthenticationController.
|
|
485
|
+
//# sourceMappingURL=AuthenticationController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationController.js","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAyB3D,OAAO,EACL,+BAA+B,EAC/B,QAAQ,EACR,GAAG,EACH,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAC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AAG,eAAe,IAAI,uBAAA,IAAI,gGAA2B,MAA/B,IAAI,CAA6B,IAAI,OAAO,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,gDACH,OAAe,EACf,eAAwB;IAExB,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACzC,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,cAAc,CAAC,CAAC;IAEvC,MAAM,QAAQ,GAAG,uBAAA,IAAI,qFAAgB,MAApB,IAAI,EAAiB,OAAO,EAAE,eAAe,CAAC,CAAC;IAChE,IAAI,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,OAAO,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,eAAe,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAErE,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n KeyringControllerWithKeyringV2UnsafeAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { SeedlessOnboardingControllerGetStateAction } from '@metamask/seedless-onboarding-controller';\nimport type { Json } from '@metamask/utils';\n\nimport type {\n LoginIdentifierType,\n LoginResponse,\n ProfileAlias,\n SRPInterface,\n SrpLoginTag,\n UserProfile,\n UserProfileLineage,\n} from '../../sdk/index.js';\nimport {\n assertMessageStartsWithMetamask,\n AuthType,\n Env,\n JwtBearerAuth,\n} from '../../sdk/index.js';\nimport type { MetaMetricsAuth } from '../../shared/types/services.js';\nimport {\n getHdKeyringEntropySourceIds,\n getPrimaryHdKeyringEntropySourceId,\n} from '../../shared/utils/entropy-source.js';\nimport { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';\nimport {\n getMessageSigningPublicKey,\n signMessageWithMessageSigningKey,\n} from '../../shared/utils/message-signing.js';\nimport { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types.js';\n\nconst controllerName = 'AuthenticationController';\n\n// State\nexport type AuthenticationControllerState = {\n isSignedIn: boolean;\n srpSessionData?: Record<string, LoginResponse>;\n /**\n * Client gate for profile pairing. Defaults to `true` (fresh install /\n * upgrade), set to `false` after a successful `performSignIn` pair, set\n * back to `true` via `requestProfilePairing()` when the SRP set changes,\n * and left `true` on pair failure so the next state shift retries.\n *\n * Optional in the type so partial-state selectors stay assignable to\n * `AuthenticationControllerState`. The controller seeds it via\n * `defaultState` at construction; consumers should read `undefined` as\n * `true` to mirror that runtime default.\n */\n needsProfilePairing?: boolean;\n};\nexport const defaultState: AuthenticationControllerState = {\n isSignedIn: false,\n needsProfilePairing: true,\n};\nconst metadata: StateMetadata<AuthenticationControllerState> = {\n isSignedIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n needsProfilePairing: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n srpSessionData: {\n // Remove access token from state logs\n includeInStateLogs: (srpSessionData) => {\n // Unreachable branch, included just to fix a type error for the case where this property is\n // unset. The type gets collapsed to include `| undefined` even though `undefined` is never\n // set here, because we don't yet use `exactOptionalPropertyTypes`.\n // TODO: Remove branch after enabling `exactOptionalPropertyTypes`\n // ref: https://github.com/MetaMask/core/issues/6565\n if (srpSessionData === null || srpSessionData === undefined) {\n return null;\n }\n return Object.entries(srpSessionData).reduce<Record<string, Json>>(\n (sanitizedSrpSessionData, [key, value]) => {\n const { accessToken: _unused, ...tokenWithoutAccessToken } =\n value.token;\n sanitizedSrpSessionData[key] = {\n ...value,\n token: tokenWithoutAccessToken,\n };\n return sanitizedSrpSessionData;\n },\n {},\n );\n },\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\ntype ControllerConfig = {\n env: Env;\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'performSignIn',\n 'performSignOut',\n 'getBearerToken',\n 'getSessionProfile',\n 'refreshCanonicalProfileId',\n 'getUserProfileLineage',\n 'getCustomerServiceToken',\n 'isSignedIn',\n 'requestProfilePairing',\n] as const;\n\nexport type Actions =\n | AuthenticationControllerGetStateAction\n | AuthenticationControllerMethodActions;\n\nexport type AuthenticationControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n AuthenticationControllerState\n>;\n\nexport type AuthenticationControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n AuthenticationControllerState\n >;\n\nexport type ProfileSignInInfo = {\n profileId: string;\n profileAliases: ProfileAlias[];\n profileIdChanged: boolean;\n};\n\nexport type AuthenticationControllerProfileSignInEvent = {\n type: `${typeof controllerName}:profileSignIn`;\n payload: [ProfileSignInInfo];\n};\n\nexport type Events =\n | AuthenticationControllerStateChangeEvent\n | AuthenticationControllerProfileSignInEvent;\n\n// Allowed Actions\ntype AllowedActions =\n | KeyringControllerGetStateAction\n | KeyringControllerWithKeyringV2UnsafeAction\n | SeedlessOnboardingControllerGetStateAction;\n\ntype AllowedEvents = KeyringControllerLockEvent | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type AuthenticationControllerMessenger = Messenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents\n>;\n\n/**\n * Controller that enables authentication for restricted endpoints.\n * Used for Backup & Sync, Notifications, and other services.\n */\nexport class AuthenticationController extends BaseController<\n typeof controllerName,\n AuthenticationControllerState,\n AuthenticationControllerMessenger\n> {\n readonly #metametrics: MetaMetricsAuth;\n\n readonly #auth: SRPInterface;\n\n readonly #config: ControllerConfig = {\n env: Env.PRD,\n };\n\n #isUnlocked = false;\n\n // Bumped by `requestProfilePairing`. `performSignIn` snapshots this\n // before its first await; if it changes mid-flight we must NOT clear\n // `needsProfilePairing` (the rearm signal wins).\n #profilePairingRequestEpoch = 0;\n\n readonly #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messenger.call('KeyringController:getState');\n this.#isUnlocked = isUnlocked;\n\n this.messenger.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n });\n\n this.messenger.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n constructor({\n messenger,\n state,\n config,\n metametrics,\n }: {\n messenger: AuthenticationControllerMessenger;\n state?: AuthenticationControllerState;\n config?: Partial<ControllerConfig>;\n /**\n * Not using the Messaging System as we\n * do not want to tie this strictly to extension\n */\n metametrics: MetaMetricsAuth;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n if (!metametrics) {\n throw new Error('`metametrics` field is required');\n }\n\n this.#config = {\n ...this.#config,\n ...config,\n };\n\n this.#metametrics = metametrics;\n\n this.#auth = new JwtBearerAuth(\n {\n env: this.#config.env,\n platform: metametrics.agent,\n type: AuthType.SRP,\n },\n {\n storage: {\n getLoginResponse: this.#getLoginResponseFromState.bind(this),\n setLoginResponse: this.#setLoginResponseToState.bind(this),\n },\n signing: {\n getIdentifier: this.#getPublicKey.bind(this),\n signMessage: this.#signMessage.bind(this),\n },\n getLoginTag: this.#getLoginTag.bind(this),\n getLoginIdentifierType: this.#getLoginIdentifierType.bind(this),\n metametrics: this.#metametrics,\n },\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n async #getLoginResponseFromState(\n entropySourceId?: string,\n ): Promise<LoginResponse | null> {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n if (!this.state.srpSessionData?.[resolvedId]) {\n return null;\n }\n return this.state.srpSessionData[resolvedId];\n }\n\n async #setLoginResponseToState(\n loginResponse: LoginResponse,\n entropySourceId?: string,\n ) {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n const metaMetricsId = await this.#metametrics.getMetaMetricsId();\n this.update((state) => {\n state.isSignedIn = true;\n if (!state.srpSessionData) {\n state.srpSessionData = {};\n }\n state.srpSessionData[resolvedId] = {\n ...loginResponse,\n profile: {\n ...loginResponse.profile,\n metaMetricsId,\n },\n };\n });\n }\n\n #assertIsUnlocked(methodName: string): void {\n if (!this.#isUnlocked) {\n throw new Error(`${methodName} - unable to proceed, wallet is locked`);\n }\n }\n\n /**\n * Reads the HD keyring entropy source IDs from KeyringController.\n *\n * @returns The HD keyring metadata IDs, primary first.\n */\n #getHdKeyringEntropySourceIds(): string[] {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getHdKeyringEntropySourceIds(keyrings);\n }\n\n /**\n * Resolves the primary SRP's entropy source ID from KeyringController rather\n * than the message-signing snap, so callers like `getBearerToken()` are not\n * blocked on snap boot.\n *\n * @returns The primary HD keyring metadata ID.\n * @throws If no HD keyring is available; callers must only resolve while\n * the wallet is unlocked.\n */\n #getPrimaryEntropySourceId(): string {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getPrimaryHdKeyringEntropySourceId(keyrings);\n }\n\n /**\n * Resolves the SRP login tag for `raw_message`.\n *\n * - `primary` for the first HD entropy source\n * - `secondary` for any other entropy source\n *\n * @param entropySourceId - Entropy source for this login attempt.\n * @returns The login tag to append to the signed message.\n */\n async #getLoginTag(entropySourceId?: string): Promise<SrpLoginTag> {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n const resolvedId = entropySourceId ?? primaryEntropySourceId;\n\n return resolvedId === primaryEntropySourceId ? 'primary' : 'secondary';\n }\n\n /**\n * Resolves metametrics `identifier_type` for `/srp/login`\n * (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`).\n *\n * This is the auth method for the entropy source, independent of\n * {@link SrpLoginTag} (`primary` / `secondary`).\n *\n * SeedlessOnboarding currently exposes a single vault-level\n * `authConnection`, which always backs the primary entropy source. Non-\n * primary sources therefore return `SRP`. If social identities become\n * per-entropy later, resolve from that metadata instead of assuming\n * primary === social.\n *\n * Soft-fails to `SRP` when SeedlessOnboarding is not registered.\n *\n * @param entropySourceId - Entropy source for this login attempt.\n * @returns The login identifier type.\n */\n async #getLoginIdentifierType(\n entropySourceId?: string,\n ): Promise<LoginIdentifierType> {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n const resolvedId = entropySourceId ?? primaryEntropySourceId;\n\n // Social vault authConnection is only associated with the primary source.\n if (resolvedId !== primaryEntropySourceId) {\n return 'SRP';\n }\n\n return this.#resolveSocialIdentifierType();\n }\n\n /**\n * Maps `SeedlessOnboardingController.state.authConnection` to a login\n * identifier type when a social vault is present.\n *\n * Returns `SRP` if there is no vault, the provider is unrecognized, or\n * SeedlessOnboardingController is unavailable on the messenger.\n *\n * @returns The social provider identifier type, or `SRP`.\n */\n #resolveSocialIdentifierType(): LoginIdentifierType {\n try {\n const { vault, authConnection } = this.messenger.call(\n 'SeedlessOnboardingController:getState',\n );\n if (vault === null || vault === undefined) {\n return 'SRP';\n }\n\n // Match provider strings from SeedlessOnboarding state rather than\n // importing AuthConnection — a value import would load that package\n // (and its heavy deps) whenever this controller is imported.\n switch (authConnection) {\n case 'google':\n return 'GOOGLE';\n case 'apple':\n return 'APPLE';\n case 'telegram':\n return 'TELEGRAM';\n default:\n return 'SRP';\n }\n } catch {\n return 'SRP';\n }\n }\n\n public async performSignIn(): Promise<string[]> {\n this.#assertIsUnlocked('performSignIn');\n\n const epochAtStart = this.#profilePairingRequestEpoch;\n const entropySourceIds = this.#getHdKeyringEntropySourceIds();\n const accessTokens: string[] = [];\n\n // We iterate sequentially in order to be sure that the first entry\n // is the primary SRP LoginResponse.\n for (const entropySourceId of entropySourceIds) {\n const accessToken = await this.#auth.getAccessToken(entropySourceId);\n accessTokens.push(accessToken);\n }\n\n if (entropySourceIds.length < 2) {\n // Single-SRP wallet: nothing to pair.\n this.#tryClearNeedsProfilePairing(epochAtStart);\n } else {\n // Pair failures must not break sign-in; the gate stays `true` for retry.\n try {\n await this.#doPair(accessTokens, epochAtStart);\n } catch {\n // noop\n }\n }\n\n return accessTokens;\n }\n\n /**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\n public requestProfilePairing(): void {\n this.#profilePairingRequestEpoch += 1;\n if (!this.state.needsProfilePairing) {\n this.update((state) => {\n state.needsProfilePairing = true;\n });\n }\n }\n\n /**\n * Clears `needsProfilePairing` only if no `requestProfilePairing` call\n * landed since `epochAtStart` was captured. Prevents `performSignIn`\n * from silently overwriting a concurrent rearm.\n *\n * @param epochAtStart - Epoch value captured at the start of `performSignIn`.\n */\n #tryClearNeedsProfilePairing(epochAtStart: number): void {\n if (this.#profilePairingRequestEpoch !== epochAtStart) {\n return;\n }\n if (this.state.needsProfilePairing) {\n this.update((state) => {\n state.needsProfilePairing = false;\n });\n }\n }\n\n /**\n * Pairs all SRPs via `POST /profile/pair`, propagates the canonical\n * profile ID, clears `needsProfilePairing`, and emits\n * `AuthenticationController:profileSignIn` when the canonical changes or\n * new aliases are returned. Throws on failure.\n *\n * @param accessTokens - Per-SRP access tokens, primary first.\n * @param epochAtStart - Pairing-request epoch captured by the caller.\n * Used to skip the gate clear if `requestProfilePairing` ran while the\n * pair API call was in-flight.\n */\n async #doPair(accessTokens: string[], epochAtStart: number): Promise<void> {\n const previousCanonical = this.#getCanonicalProfileId();\n\n const profileAliases = await this.#pairSrpProfiles(accessTokens);\n const newCanonical = this.#getCanonicalProfileId();\n\n // If somehow we cannot compute the new canonical profile ID after pairing,\n // we just return now and do not update the `needsProfilePairing` flag.\n if (!newCanonical) {\n return;\n }\n\n this.#tryClearNeedsProfilePairing(epochAtStart);\n\n const profileIdChanged = previousCanonical !== newCanonical;\n const shouldEmitProfileSignInEvent =\n profileIdChanged || profileAliases.length > 0;\n\n if (shouldEmitProfileSignInEvent) {\n this.messenger.publish('AuthenticationController:profileSignIn', {\n profileId: newCanonical,\n profileAliases,\n profileIdChanged,\n });\n }\n }\n\n async #pairSrpProfiles(accessTokens: string[]): Promise<ProfileAlias[]> {\n if (accessTokens.length < 2) {\n return [];\n }\n const primaryAccessToken = accessTokens[0]; // Associated with primary SRP.\n const {\n profileAliases,\n profile: { canonicalProfileId },\n } = await this.#auth.pairSrpProfiles(accessTokens, primaryAccessToken);\n this.#propagateCanonical(canonicalProfileId);\n return profileAliases;\n }\n\n #propagateCanonical(canonicalProfileId: string): void {\n const { srpSessionData } = this.state;\n if (!srpSessionData) {\n return;\n }\n\n this.update((state) => {\n for (const entry of Object.values(state.srpSessionData ?? {})) {\n if (entry?.profile) {\n entry.profile.canonicalProfileId = canonicalProfileId;\n }\n }\n });\n }\n\n /**\n * Returns the canonical profile id from the primary SRP's cached session.\n * Returns `null` when no session exists yet for the primary SRP.\n *\n * Always reads from the primary SRP because the canonical is shared across\n * all paired SRPs after `#propagateCanonical`.\n *\n * @returns The canonical profile id, or `null` if unavailable.\n */\n #getCanonicalProfileId(): string | null {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n return (\n this.state.srpSessionData?.[primaryEntropySourceId]?.profile\n ?.canonicalProfileId ?? null\n );\n }\n\n public performSignOut(): void {\n this.update((state) => {\n state.isSignedIn = false;\n state.srpSessionData = undefined;\n });\n }\n\n /**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\n public async getBearerToken(entropySourceId?: string): Promise<string> {\n this.#assertIsUnlocked('getBearerToken');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getAccessToken(resolvedId);\n }\n\n /**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\n public async getSessionProfile(\n entropySourceId?: string,\n ): Promise<UserProfile> {\n this.#assertIsUnlocked('getSessionProfile');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getUserProfile(resolvedId);\n }\n\n /**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\n public async refreshCanonicalProfileId(): Promise<string> {\n this.#assertIsUnlocked('refreshCanonicalProfileId');\n\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n this.#invalidateSrpSession(primaryEntropySourceId);\n await this.#auth.getAccessToken(primaryEntropySourceId);\n\n const canonical = this.#getCanonicalProfileId();\n if (!canonical) {\n throw new Error(\n 'refreshCanonicalProfileId - Unable to resolve canonical profile ID',\n );\n }\n\n this.#propagateCanonical(canonical);\n return canonical;\n }\n\n #invalidateSrpSession(entropySourceId: string): void {\n this.update((state) => {\n const entry = state.srpSessionData?.[entropySourceId];\n if (entry?.profile) {\n // Setting canonicalProfileId to '' forces a re-fetch on the next\n // #getAuthSession call. The falsy check (!auth.profile.canonicalProfileId)\n // treats '' the same as undefined/null — all signal an invalid session.\n entry.profile.canonicalProfileId = '';\n }\n });\n }\n\n public async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n this.#assertIsUnlocked('getUserProfileLineage');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getUserProfileLineage(resolvedId);\n }\n\n /**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\n public async getCustomerServiceToken(\n entropySourceId?: string,\n ): Promise<string> {\n this.#assertIsUnlocked('getCustomerServiceToken');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getCustomerServiceToken(resolvedId);\n }\n\n public isSignedIn(): boolean {\n return this.state.isSignedIn;\n }\n\n /**\n * Reads the BIP-39 seed for an HD entropy source from KeyringController.\n *\n * @param entropySourceId - Entropy source ID. Defaults to the primary HD\n * keyring.\n * @returns The HD keyring seed.\n */\n async #getHdKeyringSeed(entropySourceId?: string): Promise<Uint8Array> {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return getHdKeyringSeed(this.messenger, resolvedId);\n }\n\n /**\n * Returns the message-signing public key via native SIP-6 derivation\n * (same key as `@metamask/message-signing-snap` with empty salt).\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns The public key hex.\n */\n async #getPublicKey(entropySourceId?: string): Promise<string> {\n this.#assertIsUnlocked('#getPublicKey');\n const seed = await this.#getHdKeyringSeed(entropySourceId);\n return getMessageSigningPublicKey(seed);\n }\n\n #_signMessageCache: Record<string, string> = {};\n\n /**\n * Builds a cache key scoped to a specific entropy source, so each SRP's\n * signature stays isolated (same pattern as `UserStorageController`).\n *\n * When `entropySourceId` is omitted (primary SRP), it is resolved to the\n * primary HD keyring's metadata ID rather than a stable literal. Because that\n * ID is randomly regenerated whenever the vault is recreated (e.g. on\n * restore), the cached entry is naturally invalidated across vaults — a\n * different SRP can never inherit the previous primary's cached signature.\n *\n * @param message - The tagged message used for signing.\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The scoped cache key.\n */\n #scopedCacheKey(\n message: `metamask:${string}`,\n entropySourceId?: string,\n ): string {\n return `${entropySourceId ?? this.#getPrimaryEntropySourceId()}:${message}`;\n }\n\n /**\n * Signs a `metamask:…` message with the native SIP-6 message-signing key.\n *\n * @param message - A specific tagged message to sign.\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns Compact secp256k1 signature hex.\n */\n async #signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n assertMessageStartsWithMetamask(message);\n this.#assertIsUnlocked('#signMessage');\n\n const cacheKey = this.#scopedCacheKey(message, entropySourceId);\n if (this.#_signMessageCache[cacheKey]) {\n return this.#_signMessageCache[cacheKey];\n }\n\n const seed = await this.#getHdKeyringSeed(entropySourceId);\n const result = await signMessageWithMessageSigningKey(message, seed);\n\n this.#_signMessageCache[cacheKey] = result;\n\n return result;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AuthenticationController } from
|
|
1
|
+
import { AuthenticationController } from './AuthenticationController.js';
|
|
2
2
|
export { AuthenticationController as Controller };
|
|
3
3
|
export default AuthenticationController;
|
|
4
|
-
export * from
|
|
5
|
-
export * as Mocks from
|
|
6
|
-
export type { AuthenticationControllerPerformSignInAction, AuthenticationControllerPerformSignOutAction, AuthenticationControllerGetBearerTokenAction, AuthenticationControllerGetSessionProfileAction, AuthenticationControllerRefreshCanonicalProfileIdAction, AuthenticationControllerGetUserProfileLineageAction, AuthenticationControllerIsSignedInAction, AuthenticationControllerRequestProfilePairingAction, } from
|
|
7
|
-
//# sourceMappingURL=index.d.
|
|
4
|
+
export * from './AuthenticationController.js';
|
|
5
|
+
export * as Mocks from './mocks/index.js';
|
|
6
|
+
export type { AuthenticationControllerPerformSignInAction, AuthenticationControllerPerformSignOutAction, AuthenticationControllerGetBearerTokenAction, AuthenticationControllerGetSessionProfileAction, AuthenticationControllerRefreshCanonicalProfileIdAction, AuthenticationControllerGetUserProfileLineageAction, AuthenticationControllerIsSignedInAction, AuthenticationControllerRequestProfilePairingAction, } from './AuthenticationController-method-action-types.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/authentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,wBAAwB,IAAI,UAAU,EAAE,CAAC;eACnC,wBAAwB;AACvC,cAAc,+BAA+B,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,YAAY,EACV,2CAA2C,EAC3C,4CAA4C,EAC5C,4CAA4C,EAC5C,+CAA+C,EAC/C,uDAAuD,EACvD,mDAAmD,EACnD,wCAAwC,EACxC,mDAAmD,GACpD,MAAM,mDAAmD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AuthenticationController } from './AuthenticationController.js';
|
|
2
|
+
export { AuthenticationController as Controller };
|
|
3
|
+
export default AuthenticationController;
|
|
4
|
+
export * from './AuthenticationController.js';
|
|
5
|
+
export * as Mocks from './mocks/index.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/authentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,wBAAwB,IAAI,UAAU,EAAE,CAAC;AAClD,eAAe,wBAAwB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC","sourcesContent":["import { AuthenticationController } from './AuthenticationController.js';\n\nexport { AuthenticationController as Controller };\nexport default AuthenticationController;\nexport * from './AuthenticationController.js';\nexport * as Mocks from './mocks/index.js';\n\nexport type {\n AuthenticationControllerPerformSignInAction,\n AuthenticationControllerPerformSignOutAction,\n AuthenticationControllerGetBearerTokenAction,\n AuthenticationControllerGetSessionProfileAction,\n AuthenticationControllerRefreshCanonicalProfileIdAction,\n AuthenticationControllerGetUserProfileLineageAction,\n AuthenticationControllerIsSignedInAction,\n AuthenticationControllerRequestProfilePairingAction,\n} from './AuthenticationController-method-action-types.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './mockResponses.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAcA,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAA0B,CAAC;AAC3D,eAAO,MAAM,UAAU,QAA4B,CAAC;AACpD,eAAO,MAAM,QAAQ,upBAAe,CAAC;AAErC,eAAO,MAAM,wBAAwB,QAAO,YAqB3C,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;CAA8B,CAAC;AAE/D,eAAO,MAAM,wBAAwB,QAAO,YA0B3C,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAA+B,CAAC;AAoBrE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,UAAW,MAAM,KAAG,MAavD,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;CAAkC,CAAC;AAE3E,eAAO,MAAM,uBAAuB,QAAO,YAM1C,CAAC;AAEF,eAAO,MAAM,8BAA8B,QAAO,YAmBjD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;CACP,CAAC;AAE3C,eAAO,MAAM,mCAAmC,QAAO,YAMtD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MOCK_NONCE_RESPONSE as SDK_MOCK_NONCE_RESPONSE, MOCK_JWT as SDK_MOCK_JWT, MOCK_SRP_LOGIN_RESPONSE as SDK_MOCK_SRP_LOGIN_RESPONSE, MOCK_OIDC_TOKEN_RESPONSE as SDK_MOCK_OIDC_TOKEN_RESPONSE, MOCK_PAIR_PROFILES_RESPONSE as SDK_MOCK_PAIR_PROFILES_RESPONSE, MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE as SDK_MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE, MOCK_NONCE_URL, MOCK_SRP_LOGIN_URL, MOCK_OIDC_TOKEN_URL, MOCK_PAIR_PROFILES_URL, MOCK_CUSTOMER_SERVICE_TOKEN_URL } from
|
|
1
|
+
import { MOCK_NONCE_RESPONSE as SDK_MOCK_NONCE_RESPONSE, MOCK_JWT as SDK_MOCK_JWT, MOCK_SRP_LOGIN_RESPONSE as SDK_MOCK_SRP_LOGIN_RESPONSE, MOCK_OIDC_TOKEN_RESPONSE as SDK_MOCK_OIDC_TOKEN_RESPONSE, MOCK_PAIR_PROFILES_RESPONSE as SDK_MOCK_PAIR_PROFILES_RESPONSE, MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE as SDK_MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE, MOCK_NONCE_URL, MOCK_SRP_LOGIN_URL, MOCK_OIDC_TOKEN_URL, MOCK_PAIR_PROFILES_URL, MOCK_CUSTOMER_SERVICE_TOKEN_URL, } from '../../../sdk/mocks/auth.js';
|
|
2
2
|
export const MOCK_NONCE_RESPONSE = SDK_MOCK_NONCE_RESPONSE;
|
|
3
3
|
export const MOCK_NONCE = MOCK_NONCE_RESPONSE.nonce;
|
|
4
4
|
export const MOCK_JWT = SDK_MOCK_JWT;
|
|
@@ -114,4 +114,4 @@ export const getMockCustomerServiceTokenResponse = () => {
|
|
|
114
114
|
response: MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE,
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=mockResponses.
|
|
117
|
+
//# sourceMappingURL=mockResponses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponses.js","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,QAAQ,IAAI,YAAY,EACxB,uBAAuB,IAAI,2BAA2B,EACtD,wBAAwB,IAAI,4BAA4B,EACxD,2BAA2B,IAAI,+BAA+B,EAC9D,oCAAoC,IAAI,wCAAwC,EAChF,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAQpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAiB,EAAE;IACzD,OAAO;QACL,GAAG,EAAE,cAAc;QACnB,aAAa,EAA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CAAC,MAAM,8BAA8B,GAAG,GAAiB,EAAE;IAC/D,OAAO;QACL,GAAG,EAAE,mBAAmB;QACxB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,CAAC,eAAwB,EAAmC,EAAE;YACtE,2EAA2E;YAC3E,4EAA4E;YAC5E,MAAM,aAAa,GAAG,IAAI,eAAe,CAAC,eAAe,CAAC,CAAC,GAAG,CAC5D,WAAW,CACZ,CAAC;YAEF,OAAO;gBACL,GAAG,wBAAwB;gBAC3B,YAAY,EAAE,aAAa;oBACzB,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC;oBAC9B,CAAC,CAAC,wBAAwB,CAAC,YAAY;aAC1C,CAAC;QACJ,CAAC;KACqB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAC/C,wCAAwC,CAAC;AAE3C,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAiB,EAAE;IACpE,OAAO;QACL,GAAG,EAAE,+BAA+B;QACpC,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,oCAAoC;KACxB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import {\n MOCK_NONCE_RESPONSE as SDK_MOCK_NONCE_RESPONSE,\n MOCK_JWT as SDK_MOCK_JWT,\n MOCK_SRP_LOGIN_RESPONSE as SDK_MOCK_SRP_LOGIN_RESPONSE,\n MOCK_OIDC_TOKEN_RESPONSE as SDK_MOCK_OIDC_TOKEN_RESPONSE,\n MOCK_PAIR_PROFILES_RESPONSE as SDK_MOCK_PAIR_PROFILES_RESPONSE,\n MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE as SDK_MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE,\n MOCK_NONCE_URL,\n MOCK_SRP_LOGIN_URL,\n MOCK_OIDC_TOKEN_URL,\n MOCK_PAIR_PROFILES_URL,\n MOCK_CUSTOMER_SERVICE_TOKEN_URL,\n} from '../../../sdk/mocks/auth.js';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_NONCE_RESPONSE = SDK_MOCK_NONCE_RESPONSE;\nexport const MOCK_NONCE = MOCK_NONCE_RESPONSE.nonce;\nexport const MOCK_JWT = SDK_MOCK_JWT;\n\nexport const getMockAuthNonceResponse = (): MockResponse => {\n return {\n url: MOCK_NONCE_URL,\n requestMethod: 'GET',\n response: (\n _?: unknown,\n path?: string,\n getE2ESrpIdentifierForPublicKey?: (publicKey: string) => string,\n ): typeof MOCK_NONCE_RESPONSE => {\n // The goal here is to have this identifier bubble all the way up to being the access token\n // That way, we can use it to segregate data in the test environment\n const identifier = path?.split('?identifier=')[1];\n const e2eIdentifier = getE2ESrpIdentifierForPublicKey?.(identifier ?? '');\n\n return {\n ...MOCK_NONCE_RESPONSE,\n nonce: e2eIdentifier ?? MOCK_NONCE_RESPONSE.nonce,\n identifier: MOCK_NONCE_RESPONSE.identifier,\n };\n },\n } satisfies MockResponse;\n};\n\nexport const MOCK_LOGIN_RESPONSE = SDK_MOCK_SRP_LOGIN_RESPONSE;\n\nexport const getMockAuthLoginResponse = (): MockResponse => {\n return {\n url: MOCK_SRP_LOGIN_URL,\n requestMethod: 'POST',\n // In case this mock is used in an E2E test, we populate token, profile_id and identifier_id with the e2eIdentifier\n // to make it easier to segregate data in the test environment.\n response: (requestJsonBody?: {\n raw_message: string;\n }): typeof MOCK_LOGIN_RESPONSE => {\n // Format: metamask:<nonce>:<pubkey>[:<tag>]. Nonce (index 1) carries the\n // e2e identifier set by getMockAuthNonceResponse — stable across the\n // optional login tag segment.\n const e2eIdentifier = requestJsonBody?.raw_message.split(':')[1];\n\n return {\n ...MOCK_LOGIN_RESPONSE,\n token: e2eIdentifier ?? MOCK_LOGIN_RESPONSE.token,\n profile: {\n ...MOCK_LOGIN_RESPONSE.profile,\n profile_id: e2eIdentifier ?? MOCK_LOGIN_RESPONSE.profile.profile_id,\n identifier_id:\n e2eIdentifier ?? MOCK_LOGIN_RESPONSE.profile.identifier_id,\n },\n };\n },\n } satisfies MockResponse;\n};\n\nexport const MOCK_OATH_TOKEN_RESPONSE = SDK_MOCK_OIDC_TOKEN_RESPONSE;\n\nconst MOCK_JWT_FAR_FUTURE_EXP = 4102444800; // 2100-01-01\n\n/**\n * Wraps a plain-text identifier in a minimal JWT so that client-side\n * JWT validation (exp check) passes in E2E tests. The identifier is\n * stored in the `sub` claim and can be extracted via {@link getE2EIdentifierFromJwt}.\n *\n * @param identifier - The plain-text E2E identifier to wrap.\n * @returns A JWT-shaped string containing the identifier.\n */\nconst wrapInMockJwt = (identifier: string): string => {\n const header = btoa(JSON.stringify({ alg: 'none', typ: 'JWT' }));\n const payload = btoa(\n JSON.stringify({ sub: identifier, exp: MOCK_JWT_FAR_FUTURE_EXP }),\n );\n return `${header}.${payload}.mock`;\n};\n\n/**\n * Extracts the E2E identifier (`sub` claim) from a mock JWT created\n * by {@link wrapInMockJwt}. Falls back to returning the raw token if\n * decoding fails (backward compatibility with raw-identifier headers).\n *\n * @param token - A bearer token string (JWT or raw identifier).\n * @returns The decoded identifier, or the original token as-is.\n */\nexport const getE2EIdentifierFromJwt = (token: string): string => {\n try {\n const parts = token.split('.');\n if (parts.length === 3) {\n const { sub } = JSON.parse(atob(parts[1]));\n if (typeof sub === 'string' && sub.length > 0) {\n return sub;\n }\n }\n } catch {\n // not a JWT — fall through\n }\n return token;\n};\n\nexport const MOCK_PAIR_PROFILES_RESPONSE = SDK_MOCK_PAIR_PROFILES_RESPONSE;\n\nexport const getMockAuthPairResponse = (): MockResponse => {\n return {\n url: MOCK_PAIR_PROFILES_URL,\n requestMethod: 'POST',\n response: MOCK_PAIR_PROFILES_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockAuthAccessTokenResponse = (): MockResponse => {\n return {\n url: MOCK_OIDC_TOKEN_URL,\n requestMethod: 'POST',\n response: (requestJsonBody?: string): typeof MOCK_OATH_TOKEN_RESPONSE => {\n // We wrap the e2eIdentifier in a JWT so client-side JWT validation passes.\n // The mock server extracts the identifier back via getE2EIdentifierFromJwt.\n const e2eIdentifier = new URLSearchParams(requestJsonBody).get(\n 'assertion',\n );\n\n return {\n ...MOCK_OATH_TOKEN_RESPONSE,\n access_token: e2eIdentifier\n ? wrapInMockJwt(e2eIdentifier)\n : MOCK_OATH_TOKEN_RESPONSE.access_token,\n };\n },\n } satisfies MockResponse;\n};\n\nexport const MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE =\n SDK_MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE;\n\nexport const getMockCustomerServiceTokenResponse = (): MockResponse => {\n return {\n url: MOCK_CUSTOMER_SERVICE_TOKEN_URL,\n requestMethod: 'POST',\n response: MOCK_CUSTOMER_SERVICE_TOKEN_RESPONSE,\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC","sourcesContent":["export * as Authentication from './authentication/index.js';\nexport * as UserStorage from './user-storage/index.js';\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { UserStorageController } from
|
|
5
|
+
import type { UserStorageController } from './UserStorageController.js';
|
|
6
6
|
/**
|
|
7
7
|
* Allows retrieval of stored data. Data stored is string formatted.
|
|
8
8
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
@@ -134,4 +134,4 @@ export type UserStorageControllerSyncContactsWithUserStorageAction = {
|
|
|
134
134
|
* Union of all UserStorageController action types.
|
|
135
135
|
*/
|
|
136
136
|
export type UserStorageControllerMethodActions = UserStorageControllerPerformGetStorageAction | UserStorageControllerPerformGetStorageAllFeatureEntriesAction | UserStorageControllerPerformSetStorageAction | UserStorageControllerPerformBatchSetStorageAction | UserStorageControllerPerformDeleteStorageAction | UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction | UserStorageControllerPerformBatchDeleteStorageAction | UserStorageControllerGetStorageKeyAction | UserStorageControllerListEntropySourcesAction | UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction | UserStorageControllerSetIsContactSyncingInProgressAction | UserStorageControllerSyncContactsWithUserStorageAction;
|
|
137
|
-
//# sourceMappingURL=UserStorageController-method-action-types.d.
|
|
137
|
+
//# sourceMappingURL=UserStorageController-method-action-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStorageController-method-action-types.d.ts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6DAA6D,GAAG;IAC1E,IAAI,EAAE,0DAA0D,CAAC;IACjE,OAAO,EAAE,qBAAqB,CAAC,oCAAoC,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;GAQG;AACH,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,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C,4CAA4C,GAC5C,6DAA6D,GAC7D,4CAA4C,GAC5C,iDAAiD,GACjD,+CAA+C,GAC/C,gEAAgE,GAChE,oDAAoD,GACpD,wCAAwC,GACxC,6CAA6C,GAC7C,2DAA2D,GAC3D,wDAAwD,GACxD,sDAAsD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStorageController-method-action-types.js","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { UserStorageController } from './UserStorageController.js';\n\n/**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\nexport type UserStorageControllerPerformGetStorageAction = {\n type: `UserStorageController:performGetStorage`;\n handler: UserStorageController['performGetStorage'];\n};\n\n/**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\nexport type UserStorageControllerPerformGetStorageAllFeatureEntriesAction = {\n type: `UserStorageController:performGetStorageAllFeatureEntries`;\n handler: UserStorageController['performGetStorageAllFeatureEntries'];\n};\n\n/**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\nexport type UserStorageControllerPerformSetStorageAction = {\n type: `UserStorageController:performSetStorage`;\n handler: UserStorageController['performSetStorage'];\n};\n\n/**\n * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\nexport type UserStorageControllerPerformBatchSetStorageAction = {\n type: `UserStorageController:performBatchSetStorage`;\n handler: UserStorageController['performBatchSetStorage'];\n};\n\n/**\n * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\nexport type UserStorageControllerPerformDeleteStorageAction = {\n type: `UserStorageController:performDeleteStorage`;\n handler: UserStorageController['performDeleteStorage'];\n};\n\n/**\n * Allows deletion of all user data entries for a specific feature.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\nexport type UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction = {\n type: `UserStorageController:performDeleteStorageAllFeatureEntries`;\n handler: UserStorageController['performDeleteStorageAllFeatureEntries'];\n};\n\n/**\n * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of entryKey[]\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\nexport type UserStorageControllerPerformBatchDeleteStorageAction = {\n type: `UserStorageController:performBatchDeleteStorage`;\n handler: UserStorageController['performBatchDeleteStorage'];\n};\n\n/**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\nexport type UserStorageControllerGetStorageKeyAction = {\n type: `UserStorageController:getStorageKey`;\n handler: UserStorageController['getStorageKey'];\n};\n\n/**\n * Lists all the available HD keyring metadata IDs.\n * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.\n *\n * @returns A promise that resolves to an array of HD keyring metadata IDs.\n */\nexport type UserStorageControllerListEntropySourcesAction = {\n type: `UserStorageController:listEntropySources`;\n handler: UserStorageController['listEntropySources'];\n};\n\nexport type UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction = {\n type: `UserStorageController:setIsBackupAndSyncFeatureEnabled`;\n handler: UserStorageController['setIsBackupAndSyncFeatureEnabled'];\n};\n\n/**\n * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization\n *\n * @param isContactSyncingInProgress - Whether contact syncing is in progress\n */\nexport type UserStorageControllerSetIsContactSyncingInProgressAction = {\n type: `UserStorageController:setIsContactSyncingInProgress`;\n handler: UserStorageController['setIsContactSyncingInProgress'];\n};\n\n/**\n * Syncs the address book list with the user storage address book list.\n * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.\n * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.\n */\nexport type UserStorageControllerSyncContactsWithUserStorageAction = {\n type: `UserStorageController:syncContactsWithUserStorage`;\n handler: UserStorageController['syncContactsWithUserStorage'];\n};\n\n/**\n * Union of all UserStorageController action types.\n */\nexport type UserStorageControllerMethodActions =\n | UserStorageControllerPerformGetStorageAction\n | UserStorageControllerPerformGetStorageAllFeatureEntriesAction\n | UserStorageControllerPerformSetStorageAction\n | UserStorageControllerPerformBatchSetStorageAction\n | UserStorageControllerPerformDeleteStorageAction\n | UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction\n | UserStorageControllerPerformBatchDeleteStorageAction\n | UserStorageControllerGetStorageKeyAction\n | UserStorageControllerListEntropySourcesAction\n | UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction\n | UserStorageControllerSetIsContactSyncingInProgressAction\n | UserStorageControllerSyncContactsWithUserStorageAction;\n"]}
|
package/dist/controllers/user-storage/{UserStorageController.d.cts → UserStorageController.d.ts}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from
|
|
2
|
-
import { BaseController } from
|
|
3
|
-
import type { ControllerGetStateAction, ControllerStateChangeEvent } from
|
|
4
|
-
import type { TraceCallback } from
|
|
5
|
-
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from
|
|
6
|
-
import type { Messenger } from
|
|
7
|
-
import type { UserStorageGenericFeatureKey, UserStorageGenericPathWithFeatureAndKey, UserStorageGenericPathWithFeatureOnly } from
|
|
8
|
-
import { Env } from
|
|
9
|
-
import type { NativeScrypt } from
|
|
10
|
-
import { EventQueue } from
|
|
11
|
-
import type { AuthenticationControllerGetBearerTokenAction, AuthenticationControllerGetSessionProfileAction, AuthenticationControllerIsSignedInAction, AuthenticationControllerPerformSignInAction } from
|
|
12
|
-
import { BACKUPANDSYNC_FEATURES } from
|
|
13
|
-
import type { UserStorageControllerMethodActions } from
|
|
1
|
+
import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from '@metamask/address-book-controller';
|
|
2
|
+
import { BaseController } from '@metamask/base-controller';
|
|
3
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
|
|
4
|
+
import type { TraceCallback } from '@metamask/controller-utils';
|
|
5
|
+
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from '@metamask/keyring-controller';
|
|
6
|
+
import type { Messenger } from '@metamask/messenger';
|
|
7
|
+
import type { UserStorageGenericFeatureKey, UserStorageGenericPathWithFeatureAndKey, UserStorageGenericPathWithFeatureOnly } from '../../sdk/index.js';
|
|
8
|
+
import { Env } from '../../sdk/index.js';
|
|
9
|
+
import type { NativeScrypt } from '../../shared/types/encryption.js';
|
|
10
|
+
import { EventQueue } from '../../shared/utils/event-queue.js';
|
|
11
|
+
import type { AuthenticationControllerGetBearerTokenAction, AuthenticationControllerGetSessionProfileAction, AuthenticationControllerIsSignedInAction, AuthenticationControllerPerformSignInAction } from '../authentication/AuthenticationController-method-action-types.js';
|
|
12
|
+
import { BACKUPANDSYNC_FEATURES } from './constants.js';
|
|
13
|
+
import type { UserStorageControllerMethodActions } from './UserStorageController-method-action-types.js';
|
|
14
14
|
declare const controllerName = "UserStorageController";
|
|
15
15
|
export type UserStorageControllerState = {
|
|
16
16
|
/**
|
|
@@ -179,4 +179,4 @@ export declare class UserStorageController extends BaseController<typeof control
|
|
|
179
179
|
syncContactsWithUserStorage(): Promise<void>;
|
|
180
180
|
}
|
|
181
181
|
export {};
|
|
182
|
-
//# sourceMappingURL=UserStorageController.d.
|
|
182
|
+
//# sourceMappingURL=UserStorageController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.ts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,aAAa,E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ACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ5C;IAmFY,gCAAgC,CAC3C,OAAO,EAAE,MAAM,OAAO,sBAAsB,EAC5C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAmCf;IAUD;;;;OAIG;IACG,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CAIf;IAED;;;;OAIG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CA2BjD;CACF"}
|
package/dist/controllers/user-storage/{UserStorageController.mjs → UserStorageController.js}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
1
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
2
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
3
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
4
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
5
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
6
|
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
12
|
var _UserStorageController_instances, _UserStorageController_userStorage, _UserStorageController_auth, _UserStorageController_config, _UserStorageController_trace, _UserStorageController_isUnlocked, _UserStorageController_storageKeyCache, _UserStorageController_signMessageCache, _UserStorageController_keyringController, _UserStorageController_nativeScryptCrypto, _UserStorageController_getHdKeyringEntropySourceIds, _UserStorageController_getPrimaryEntropySourceId, _UserStorageController_scopedCacheKey, _UserStorageController_signMessage, _UserStorageController_setIsBackupAndSyncUpdateLoading;
|
|
13
|
-
import { BaseController } from
|
|
14
|
-
import { Env, UserStorage } from
|
|
15
|
-
import { getHdKeyringEntropySourceIds, getPrimaryHdKeyringEntropySourceId } from
|
|
16
|
-
import { EventQueue } from
|
|
17
|
-
import { getHdKeyringSeed } from
|
|
18
|
-
import { signMessageWithMessageSigningKey } from
|
|
19
|
-
import { BACKUPANDSYNC_FEATURES } from
|
|
20
|
-
import { syncContactsWithUserStorage } from
|
|
21
|
-
import { setupContactSyncingSubscriptions } from
|
|
13
|
+
import { BaseController } from '@metamask/base-controller';
|
|
14
|
+
import { Env, UserStorage } from '../../sdk/index.js';
|
|
15
|
+
import { getHdKeyringEntropySourceIds, getPrimaryHdKeyringEntropySourceId, } from '../../shared/utils/entropy-source.js';
|
|
16
|
+
import { EventQueue } from '../../shared/utils/event-queue.js';
|
|
17
|
+
import { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';
|
|
18
|
+
import { signMessageWithMessageSigningKey } from '../../shared/utils/message-signing.js';
|
|
19
|
+
import { BACKUPANDSYNC_FEATURES } from './constants.js';
|
|
20
|
+
import { syncContactsWithUserStorage } from './contact-syncing/controller-integration.js';
|
|
21
|
+
import { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions.js';
|
|
22
22
|
const controllerName = 'UserStorageController';
|
|
23
23
|
export const defaultState = {
|
|
24
24
|
isBackupAndSyncEnabled: true,
|
|
@@ -405,4 +405,4 @@ async function _UserStorageController_signMessage(message, entropySourceId) {
|
|
|
405
405
|
state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;
|
|
406
406
|
});
|
|
407
407
|
};
|
|
408
|
-
//# sourceMappingURL=UserStorageController.
|
|
408
|
+
//# sourceMappingURL=UserStorageController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStorageController.js","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAwB3D,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAOzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC1F,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAG5F,MAAM,cAAc,GAAG,uBAAuB,CAAC;AA0B/C,MAAM,CAAC,MAAM,YAAY,GAA+B;IACtD,sBAAsB,EAAE,IAAI;IAC5B,4BAA4B,EAAE,KAAK;IACnC,uBAAuB,EAAE,IAAI;IAC7B,uBAAuB,EAAE,IAAI;IAC7B,0BAA0B,EAAE,KAAK;CAClC,CAAC;AAEF,MAAM,QAAQ,GAA8C;IAC1D,sBAAsB,EAAE;QACtB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IA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erContactUpdatedEvent,\n AddressBookControllerContactDeletedEvent,\n AddressBookControllerActions,\n AddressBookControllerListAction,\n AddressBookControllerSetAction,\n AddressBookControllerDeleteAction,\n} from '@metamask/address-book-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport type {\n TraceCallback,\n TraceContext,\n TraceRequest,\n} from '@metamask/controller-utils';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n KeyringControllerWithKeyringV2UnsafeAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport type {\n UserStorageGenericFeatureKey,\n UserStorageGenericPathWithFeatureAndKey,\n UserStorageGenericPathWithFeatureOnly,\n} from '../../sdk/index.js';\nimport { Env, UserStorage } from '../../sdk/index.js';\nimport type { NativeScrypt } from '../../shared/types/encryption.js';\nimport {\n getHdKeyringEntropySourceIds,\n getPrimaryHdKeyringEntropySourceId,\n} from '../../shared/utils/entropy-source.js';\nimport { EventQueue } from '../../shared/utils/event-queue.js';\nimport { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';\nimport { signMessageWithMessageSigningKey } from '../../shared/utils/message-signing.js';\nimport type {\n AuthenticationControllerGetBearerTokenAction,\n AuthenticationControllerGetSessionProfileAction,\n AuthenticationControllerIsSignedInAction,\n AuthenticationControllerPerformSignInAction,\n} from '../authentication/AuthenticationController-method-action-types.js';\nimport { BACKUPANDSYNC_FEATURES } from './constants.js';\nimport { syncContactsWithUserStorage } from './contact-syncing/controller-integration.js';\nimport { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions.js';\nimport type { UserStorageControllerMethodActions } from './UserStorageController-method-action-types.js';\n\nconst controllerName = 'UserStorageController';\n\n// State\nexport type UserStorageControllerState = {\n /**\n * Condition used by UI and to determine if we can use some of the User Storage methods.\n */\n isBackupAndSyncEnabled: boolean;\n /**\n * Loading state for the backup and sync update\n */\n isBackupAndSyncUpdateLoading: boolean;\n /**\n * Condition used by UI to determine if account syncing is enabled.\n */\n isAccountSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is enabled.\n */\n isContactSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is in progress.\n */\n isContactSyncingInProgress: boolean;\n};\n\nexport const defaultState: UserStorageControllerState = {\n isBackupAndSyncEnabled: true,\n isBackupAndSyncUpdateLoading: false,\n isAccountSyncingEnabled: true,\n isContactSyncingEnabled: true,\n isContactSyncingInProgress: false,\n};\n\nconst metadata: StateMetadata<UserStorageControllerState> = {\n isBackupAndSyncEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isBackupAndSyncUpdateLoading: {\n includeInStateLogs: false,\n persist: false,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isAccountSyncingEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isContactSyncingEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isContactSyncingInProgress: {\n includeInStateLogs: false,\n persist: false,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\ntype ControllerConfig = {\n env: Env;\n contactSyncing?: {\n /**\n * Callback that fires when contact sync updates a contact.\n * This is used for analytics.\n */\n onContactUpdated?: (profileId: string) => void;\n\n /**\n * Callback that fires when contact sync deletes a contact.\n * This is used for analytics.\n */\n onContactDeleted?: (profileId: string) => void;\n\n /**\n * Callback that fires when an erroneous situation happens during contact sync.\n * This is used for analytics.\n */\n onContactSyncErroneousSituation?: (\n profileId: string,\n situationMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => void;\n };\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'performGetStorage',\n 'performGetStorageAllFeatureEntries',\n 'performSetStorage',\n 'performBatchSetStorage',\n 'performDeleteStorage',\n 'performBatchDeleteStorage',\n 'getStorageKey',\n 'performDeleteStorageAllFeatureEntries',\n 'listEntropySources',\n 'setIsBackupAndSyncFeatureEnabled',\n 'setIsContactSyncingInProgress',\n 'syncContactsWithUserStorage',\n] as const;\n\nexport type UserStorageControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Actions =\n | UserStorageControllerGetStateAction\n | UserStorageControllerMethodActions;\n\nexport type AllowedActions =\n // Keyring Requests\n | KeyringControllerGetStateAction\n | KeyringControllerWithKeyringV2UnsafeAction\n // Auth Requests\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerIsSignedInAction\n // Contact Syncing\n | AddressBookControllerListAction\n | AddressBookControllerSetAction\n | AddressBookControllerDeleteAction\n | AddressBookControllerActions;\n\n// Messenger events\nexport type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\n\nexport type Events = UserStorageControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n // Address Book Events\n | AddressBookControllerContactUpdatedEvent\n | AddressBookControllerContactDeletedEvent;\n\n// Messenger\nexport type UserStorageControllerMessenger = Messenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents\n>;\n\n/**\n * Reusable controller that allows any team to store synchronized data for a given user.\n * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.\n *\n * NOTE:\n * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.\n * - No one can access this data unless they are have the SRP and are able to run the signing snap.\n */\nexport class UserStorageController extends BaseController<\n typeof controllerName,\n UserStorageControllerState,\n UserStorageControllerMessenger\n> {\n readonly #userStorage: UserStorage;\n\n readonly #auth = {\n getProfileId: async (entropySourceId?: string) => {\n const sessionProfile = await this.messenger.call(\n 'AuthenticationController:getSessionProfile',\n entropySourceId,\n );\n return sessionProfile?.profileId;\n },\n isSignedIn: () => {\n return this.messenger.call('AuthenticationController:isSignedIn');\n },\n signIn: async () => {\n return await this.messenger.call(\n 'AuthenticationController:performSignIn',\n );\n },\n };\n\n readonly #config: ControllerConfig = {\n env: Env.PRD,\n };\n\n readonly #trace: TraceCallback;\n\n #isUnlocked = false;\n\n // Both caches are keyed by `${entropySourceId}:${message}` (the primary SRP\n // resolves to its HD keyring metadata ID) so two SRPs that transiently\n // resolve to the same `profileId` can never share a cached storage key /\n // signature and leak data across each other's user storage.\n #storageKeyCache: Record<string, string> = {};\n\n #signMessageCache: Record<string, string> = {};\n\n readonly #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messenger.call('KeyringController:getState');\n this.#isUnlocked = isUnlocked;\n\n this.messenger.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n });\n\n this.messenger.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n readonly #nativeScryptCrypto: NativeScrypt | undefined = undefined;\n\n eventQueue = new EventQueue();\n\n constructor({\n messenger,\n state,\n config,\n nativeScryptCrypto,\n trace,\n }: {\n messenger: UserStorageControllerMessenger;\n state?: UserStorageControllerState;\n config?: Partial<ControllerConfig>;\n nativeScryptCrypto?: NativeScrypt;\n trace?: TraceCallback;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#config = {\n ...this.#config,\n ...config,\n };\n this.#trace =\n trace ??\n (async <ReturnType>(\n _request: TraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n ): Promise<ReturnType> => {\n if (!fn) {\n return undefined as ReturnType;\n }\n return await Promise.resolve(fn());\n });\n\n this.#userStorage = new UserStorage(\n {\n env: this.#config.env,\n auth: {\n getAccessToken: (entropySourceId?: string) =>\n this.messenger.call(\n 'AuthenticationController:getBearerToken',\n entropySourceId,\n ),\n getUserProfile: async (entropySourceId?: string) => {\n return await this.messenger.call(\n 'AuthenticationController:getSessionProfile',\n entropySourceId,\n );\n },\n signMessage: (message: string, entropySourceId?: string) =>\n this.#signMessage(message, entropySourceId),\n },\n },\n {\n storage: {\n getStorageKey: async (message, entropySourceId) => {\n // No derived key can exist while locked (the KeyringController\n // clears its keyrings on lock, so the scope is unresolvable).\n if (!this.#isUnlocked) {\n return null;\n }\n return (\n this.#storageKeyCache[\n this.#scopedCacheKey(message, entropySourceId)\n ] ?? null\n );\n },\n // Only ever reached after a successful signature, i.e. while unlocked.\n setStorageKey: async (message, key, entropySourceId) => {\n this.#storageKeyCache[\n this.#scopedCacheKey(message, entropySourceId)\n ] = key;\n },\n },\n },\n );\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n this.#nativeScryptCrypto = nativeScryptCrypto;\n\n // Contact Syncing\n setupContactSyncingSubscriptions({\n getUserStorageControllerInstance: () => this,\n getMessenger: () => this.messenger,\n trace: this.#trace,\n });\n }\n\n /**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n entropySourceId?: string,\n ): Promise<string | null> {\n return await this.#userStorage.getItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorageAllFeatureEntries(\n path: UserStorageGenericPathWithFeatureOnly,\n entropySourceId?: string,\n ): Promise<string[] | null> {\n return await this.#userStorage.getAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performSetStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n value: string,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.setItem(path, value, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchSetStorage(\n path: UserStorageGenericPathWithFeatureOnly,\n values: [UserStorageGenericFeatureKey, string][],\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.batchSetItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.deleteItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows deletion of all user data entries for a specific feature.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorageAllFeatureEntries(\n path: UserStorageGenericPathWithFeatureOnly,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.deleteAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of entryKey[]\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchDeleteStorage(\n path: UserStorageGenericPathWithFeatureOnly,\n values: UserStorageGenericFeatureKey[],\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.batchDeleteItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\n public async getStorageKey(): Promise<string> {\n return await this.#userStorage.getStorageKey();\n }\n\n /**\n * Flushes the storage key cache.\n * CAUTION: This is only public for testing purposes.\n * It should not be used in production code.\n */\n public flushStorageKeyCache(): void {\n this.#storageKeyCache = {};\n }\n\n /**\n * Lists all the available HD keyring metadata IDs.\n * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.\n *\n * @returns A promise that resolves to an array of HD keyring metadata IDs.\n */\n async listEntropySources(): Promise<string[]> {\n if (!this.#isUnlocked) {\n throw new Error(\n 'listEntropySources - unable to list entropy sources, wallet is locked',\n );\n }\n\n return this.#getHdKeyringEntropySourceIds();\n }\n\n /**\n * Reads the HD keyring entropy source IDs from KeyringController.\n *\n * @returns The HD keyring metadata IDs, primary first.\n */\n #getHdKeyringEntropySourceIds(): string[] {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getHdKeyringEntropySourceIds(keyrings);\n }\n\n /**\n * Resolves the primary SRP's entropy source ID, used to scope the primary's\n * cache entries. The ID is randomly regenerated whenever the vault is\n * recreated (e.g. on restore), so a new primary can never inherit a previous\n * vault's cached key.\n *\n * @returns The primary HD keyring metadata ID.\n * @throws If no HD keyring is available; callers must only resolve the scope\n * while the wallet is unlocked.\n */\n #getPrimaryEntropySourceId(): string {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getPrimaryHdKeyringEntropySourceId(keyrings);\n }\n\n /**\n * Builds a cache key scoped to a specific entropy source, so each SRP's\n * signature/storage key derivation stays isolated even when two SRPs\n * transiently resolve to the same `profileId` (see `#storageKeyCache`).\n *\n * When `entropySourceId` is omitted (primary SRP), it is resolved to the\n * primary HD keyring's metadata ID rather than a stable literal. Because that\n * ID is randomly regenerated whenever the vault is recreated (e.g. on\n * restore), the cached entry is naturally invalidated across vaults — a\n * different SRP can never inherit the previous primary's cached key.\n *\n * @param message - The tagged message used for signing.\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The scoped cache key.\n */\n #scopedCacheKey(\n message: `metamask:${string}`,\n entropySourceId?: string,\n ): string {\n return `${entropySourceId ?? this.#getPrimaryEntropySourceId()}:${message}`;\n }\n\n /**\n * Signs a `metamask:…` message with the native SIP-6 message-signing key\n * (same key as `@metamask/message-signing-snap` with empty salt).\n *\n * @param message - A specific tagged message to sign.\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns Compact secp256k1 signature hex.\n */\n async #signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n if (!this.#isUnlocked) {\n throw new Error('#signMessage - unable to proceed, wallet is locked');\n }\n\n const cacheKey = this.#scopedCacheKey(\n message as `metamask:${string}`,\n entropySourceId,\n );\n if (this.#signMessageCache[cacheKey]) {\n return this.#signMessageCache[cacheKey];\n }\n\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n const seed = await getHdKeyringSeed(this.messenger, resolvedId);\n const result = await signMessageWithMessageSigningKey(message, seed);\n\n this.#signMessageCache[cacheKey] = result;\n\n return result;\n }\n\n public async setIsBackupAndSyncFeatureEnabled(\n feature: keyof typeof BACKUPANDSYNC_FEATURES,\n enabled: boolean,\n ): Promise<void> {\n try {\n this.#setIsBackupAndSyncUpdateLoading(true);\n\n if (enabled) {\n // If any of the features are enabled, we need to ensure the user is signed in\n const isSignedIn = this.#auth.isSignedIn();\n if (!isSignedIn) {\n await this.#auth.signIn();\n }\n }\n\n this.update((state) => {\n if (feature === BACKUPANDSYNC_FEATURES.main) {\n state.isBackupAndSyncEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.accountSyncing) {\n state.isAccountSyncingEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.contactSyncing) {\n state.isContactSyncingEnabled = enabled;\n }\n });\n } catch (e) {\n // istanbul ignore next\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n // istanbul ignore next\n throw new Error(\n `${controllerName} - failed to ${enabled ? 'enable' : 'disable'} ${feature} - ${errorMessage}`,\n );\n } finally {\n this.#setIsBackupAndSyncUpdateLoading(false);\n }\n }\n\n #setIsBackupAndSyncUpdateLoading(\n isBackupAndSyncUpdateLoading: boolean,\n ): void {\n this.update((state) => {\n state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;\n });\n }\n\n /**\n * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization\n *\n * @param isContactSyncingInProgress - Whether contact syncing is in progress\n */\n async setIsContactSyncingInProgress(\n isContactSyncingInProgress: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isContactSyncingInProgress = isContactSyncingInProgress;\n });\n }\n\n /**\n * Syncs the address book list with the user storage address book list.\n * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.\n * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.\n */\n async syncContactsWithUserStorage(): Promise<void> {\n const profileId = await this.#auth.getProfileId();\n\n const config = {\n onContactUpdated: () => {\n this.#config?.contactSyncing?.onContactUpdated?.(profileId);\n },\n onContactDeleted: () => {\n this.#config?.contactSyncing?.onContactDeleted?.(profileId);\n },\n onContactSyncErroneousSituation: (\n errorMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => {\n this.#config?.contactSyncing?.onContactSyncErroneousSituation?.(\n profileId,\n errorMessage,\n sentryContext,\n );\n },\n };\n\n await syncContactsWithUserStorage(config, {\n getMessenger: () => this.messenger,\n getUserStorageControllerInstance: () => this,\n trace: this.#trace,\n });\n }\n}\n"]}
|