@metamask/profile-sync-controller 30.0.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -1
- package/dist/controllers/authentication/{AuthenticationController-method-action-types.d.mts → AuthenticationController-method-action-types.d.ts} +11 -3
- 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} +15 -10
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -0
- package/dist/controllers/authentication/AuthenticationController.js +666 -0
- 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.mts → UserStorageController.d.ts} +18 -14
- package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -0
- package/dist/controllers/user-storage/UserStorageController.js +439 -0
- package/dist/controllers/user-storage/UserStorageController.js.map +1 -0
- package/dist/controllers/user-storage/constants.d.ts +16 -0
- package/dist/controllers/user-storage/constants.d.ts.map +1 -0
- package/dist/controllers/user-storage/{constants.mjs → constants.js} +2 -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.mts → 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} +3 -3
- 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.js +99 -0
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-srp.d.mts → 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.js +258 -0
- 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.cjs.map → services.js.map} +1 -1
- 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.js +104 -0
- 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} +5 -4
- 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.js +364 -0
- 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} +4 -4
- 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.js +202 -0
- 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} +2 -4
- 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 +29 -63
- 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 -596
- package/dist/controllers/authentication/AuthenticationController.cjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +0 -149
- 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 +0 -592
- 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 -135
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +0 -69
- 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 +0 -182
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +0 -408
- 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 +0 -37
- package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
- 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 +0 -110
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +0 -293
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +0 -45
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +0 -266
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +0 -443
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts +0 -120
- 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 -133
- 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 -136
- package/dist/sdk/authentication.cjs.map +0 -1
- package/dist/sdk/authentication.d.cts.map +0 -1
- package/dist/sdk/authentication.d.mts +0 -39
- package/dist/sdk/authentication.d.mts.map +0 -1
- package/dist/sdk/authentication.mjs +0 -116
- package/dist/sdk/authentication.mjs.map +0 -1
- package/dist/sdk/constants.cjs +0 -8
- package/dist/sdk/constants.cjs.map +0 -1
- package/dist/sdk/constants.d.cts.map +0 -1
- package/dist/sdk/constants.d.mts +0 -5
- package/dist/sdk/constants.d.mts.map +0 -1
- package/dist/sdk/constants.mjs.map +0 -1
- package/dist/sdk/errors.cjs +0 -89
- package/dist/sdk/errors.cjs.map +0 -1
- package/dist/sdk/errors.d.cts.map +0 -1
- package/dist/sdk/errors.d.mts +0 -43
- 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 -93
- 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 -80
- 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 +0 -358
- 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 +0 -205
- 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
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
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");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
|
-
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_identifierTypeFromSeedlessState, _AuthenticationController_trySocialPairing, _AuthenticationController_clearNeedsSocialPairing, _AuthenticationController_tryClearNeedsProfilePairing, _AuthenticationController_doPair, _AuthenticationController_pairSrpProfiles, _AuthenticationController_propagateCanonical, _AuthenticationController_getCanonicalProfileId, _AuthenticationController_invalidateSrpSession, _AuthenticationController_getHdKeyringSeed, _AuthenticationController_getPublicKey, _AuthenticationController__signMessageCache, _AuthenticationController_scopedCacheKey, _AuthenticationController_signMessage;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AuthenticationController = exports.defaultState = void 0;
|
|
16
|
-
const base_controller_1 = require("@metamask/base-controller");
|
|
17
|
-
const index_js_1 = require("../../sdk/index.cjs");
|
|
18
|
-
const entropy_source_js_1 = require("../../shared/utils/entropy-source.cjs");
|
|
19
|
-
const hd_keyring_seed_js_1 = require("../../shared/utils/hd-keyring-seed.cjs");
|
|
20
|
-
const message_signing_js_1 = require("../../shared/utils/message-signing.cjs");
|
|
21
|
-
const controllerName = 'AuthenticationController';
|
|
22
|
-
exports.defaultState = {
|
|
23
|
-
isSignedIn: false,
|
|
24
|
-
needsProfilePairing: true,
|
|
25
|
-
needsSocialPairing: true,
|
|
26
|
-
};
|
|
27
|
-
const metadata = {
|
|
28
|
-
isSignedIn: {
|
|
29
|
-
includeInStateLogs: true,
|
|
30
|
-
persist: true,
|
|
31
|
-
includeInDebugSnapshot: true,
|
|
32
|
-
usedInUi: true,
|
|
33
|
-
},
|
|
34
|
-
needsProfilePairing: {
|
|
35
|
-
includeInStateLogs: true,
|
|
36
|
-
persist: true,
|
|
37
|
-
includeInDebugSnapshot: true,
|
|
38
|
-
usedInUi: true,
|
|
39
|
-
},
|
|
40
|
-
needsSocialPairing: {
|
|
41
|
-
includeInStateLogs: true,
|
|
42
|
-
persist: true,
|
|
43
|
-
includeInDebugSnapshot: true,
|
|
44
|
-
usedInUi: true,
|
|
45
|
-
},
|
|
46
|
-
srpSessionData: {
|
|
47
|
-
// Remove access token from state logs
|
|
48
|
-
includeInStateLogs: (srpSessionData) => {
|
|
49
|
-
// Unreachable branch, included just to fix a type error for the case where this property is
|
|
50
|
-
// unset. The type gets collapsed to include `| undefined` even though `undefined` is never
|
|
51
|
-
// set here, because we don't yet use `exactOptionalPropertyTypes`.
|
|
52
|
-
// TODO: Remove branch after enabling `exactOptionalPropertyTypes`
|
|
53
|
-
// ref: https://github.com/MetaMask/core/issues/6565
|
|
54
|
-
if (srpSessionData === null || srpSessionData === undefined) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return Object.entries(srpSessionData).reduce((sanitizedSrpSessionData, [key, value]) => {
|
|
58
|
-
const { accessToken: _unused, ...tokenWithoutAccessToken } = value.token;
|
|
59
|
-
sanitizedSrpSessionData[key] = {
|
|
60
|
-
...value,
|
|
61
|
-
token: tokenWithoutAccessToken,
|
|
62
|
-
};
|
|
63
|
-
return sanitizedSrpSessionData;
|
|
64
|
-
}, {});
|
|
65
|
-
},
|
|
66
|
-
persist: true,
|
|
67
|
-
includeInDebugSnapshot: false,
|
|
68
|
-
usedInUi: true,
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const MESSENGER_EXPOSED_METHODS = [
|
|
72
|
-
'performSignIn',
|
|
73
|
-
'performSignOut',
|
|
74
|
-
'getBearerToken',
|
|
75
|
-
'getSessionProfile',
|
|
76
|
-
'refreshCanonicalProfileId',
|
|
77
|
-
'getUserProfileLineage',
|
|
78
|
-
'getCustomerServiceToken',
|
|
79
|
-
'isSignedIn',
|
|
80
|
-
'requestProfilePairing',
|
|
81
|
-
];
|
|
82
|
-
/**
|
|
83
|
-
* Controller that enables authentication for restricted endpoints.
|
|
84
|
-
* Used for Backup & Sync, Notifications, and other services.
|
|
85
|
-
*/
|
|
86
|
-
class AuthenticationController extends base_controller_1.BaseController {
|
|
87
|
-
constructor({ messenger, state, config, metametrics, }) {
|
|
88
|
-
super({
|
|
89
|
-
messenger,
|
|
90
|
-
metadata,
|
|
91
|
-
name: controllerName,
|
|
92
|
-
state: { ...exports.defaultState, ...state },
|
|
93
|
-
});
|
|
94
|
-
_AuthenticationController_instances.add(this);
|
|
95
|
-
_AuthenticationController_metametrics.set(this, void 0);
|
|
96
|
-
_AuthenticationController_auth.set(this, void 0);
|
|
97
|
-
_AuthenticationController_config.set(this, {
|
|
98
|
-
env: index_js_1.Env.PRD,
|
|
99
|
-
isSocialPairingEnabled: () => false,
|
|
100
|
-
});
|
|
101
|
-
_AuthenticationController_isUnlocked.set(this, false);
|
|
102
|
-
// Bumped by `requestProfilePairing`. `performSignIn` snapshots this
|
|
103
|
-
// before its first await; if it changes mid-flight we must NOT clear
|
|
104
|
-
// `needsProfilePairing` (the rearm signal wins).
|
|
105
|
-
_AuthenticationController_profilePairingRequestEpoch.set(this, 0);
|
|
106
|
-
_AuthenticationController_keyringController.set(this, {
|
|
107
|
-
setupLockedStateSubscriptions: () => {
|
|
108
|
-
const { isUnlocked } = this.messenger.call('KeyringController:getState');
|
|
109
|
-
__classPrivateFieldSet(this, _AuthenticationController_isUnlocked, isUnlocked, "f");
|
|
110
|
-
this.messenger.subscribe('KeyringController:unlock', () => {
|
|
111
|
-
__classPrivateFieldSet(this, _AuthenticationController_isUnlocked, true, "f");
|
|
112
|
-
});
|
|
113
|
-
this.messenger.subscribe('KeyringController:lock', () => {
|
|
114
|
-
__classPrivateFieldSet(this, _AuthenticationController_isUnlocked, false, "f");
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
_AuthenticationController__signMessageCache.set(this, {});
|
|
119
|
-
if (!metametrics) {
|
|
120
|
-
throw new Error('`metametrics` field is required');
|
|
121
|
-
}
|
|
122
|
-
__classPrivateFieldSet(this, _AuthenticationController_config, {
|
|
123
|
-
...__classPrivateFieldGet(this, _AuthenticationController_config, "f"),
|
|
124
|
-
...config,
|
|
125
|
-
isSocialPairingEnabled: config?.isSocialPairingEnabled ?? __classPrivateFieldGet(this, _AuthenticationController_config, "f").isSocialPairingEnabled,
|
|
126
|
-
}, "f");
|
|
127
|
-
__classPrivateFieldSet(this, _AuthenticationController_metametrics, metametrics, "f");
|
|
128
|
-
__classPrivateFieldSet(this, _AuthenticationController_auth, new index_js_1.JwtBearerAuth({
|
|
129
|
-
env: __classPrivateFieldGet(this, _AuthenticationController_config, "f").env,
|
|
130
|
-
platform: metametrics.agent,
|
|
131
|
-
type: index_js_1.AuthType.SRP,
|
|
132
|
-
}, {
|
|
133
|
-
storage: {
|
|
134
|
-
getLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginResponseFromState).bind(this),
|
|
135
|
-
setLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_setLoginResponseToState).bind(this),
|
|
136
|
-
},
|
|
137
|
-
signing: {
|
|
138
|
-
getIdentifier: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPublicKey).bind(this),
|
|
139
|
-
signMessage: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_signMessage).bind(this),
|
|
140
|
-
},
|
|
141
|
-
getLoginTag: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginTag).bind(this),
|
|
142
|
-
getLoginIdentifierType: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginIdentifierType).bind(this),
|
|
143
|
-
metametrics: __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f"),
|
|
144
|
-
}), "f");
|
|
145
|
-
__classPrivateFieldGet(this, _AuthenticationController_keyringController, "f").setupLockedStateSubscriptions();
|
|
146
|
-
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
147
|
-
}
|
|
148
|
-
async performSignIn() {
|
|
149
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'performSignIn');
|
|
150
|
-
const epochAtStart = __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f");
|
|
151
|
-
const entropySourceIds = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringEntropySourceIds).call(this);
|
|
152
|
-
const accessTokens = [];
|
|
153
|
-
// We iterate sequentially in order to be sure that the first entry
|
|
154
|
-
// is the primary SRP LoginResponse.
|
|
155
|
-
for (const entropySourceId of entropySourceIds) {
|
|
156
|
-
const accessToken = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(entropySourceId);
|
|
157
|
-
accessTokens.push(accessToken);
|
|
158
|
-
}
|
|
159
|
-
if (entropySourceIds.length < 2) {
|
|
160
|
-
// Single-SRP wallet: nothing to pair.
|
|
161
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// Pair failures must not break sign-in; the gate stays `true` for retry.
|
|
165
|
-
try {
|
|
166
|
-
await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_doPair).call(this, accessTokens, epochAtStart);
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
// noop
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
try {
|
|
173
|
-
await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_trySocialPairing).call(this, accessTokens[0]);
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
// noop
|
|
177
|
-
}
|
|
178
|
-
return accessTokens;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Marks profile pairing as needed. Clients call this when the SRP set
|
|
182
|
-
* changes (e.g. a new keyring was added) so the next auto-sign-in cycle
|
|
183
|
-
* re-runs `performSignIn` and re-pairs.
|
|
184
|
-
*/
|
|
185
|
-
requestProfilePairing() {
|
|
186
|
-
__classPrivateFieldSet(this, _AuthenticationController_profilePairingRequestEpoch, __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") + 1, "f");
|
|
187
|
-
if (!this.state.needsProfilePairing) {
|
|
188
|
-
this.update((state) => {
|
|
189
|
-
state.needsProfilePairing = true;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
performSignOut() {
|
|
194
|
-
this.update((state) => {
|
|
195
|
-
state.isSignedIn = false;
|
|
196
|
-
state.srpSessionData = undefined;
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Returns a bearer token for the specified SRP, logging in if needed.
|
|
201
|
-
*
|
|
202
|
-
* When called without `entropySourceId`, returns the primary (first) SRP's
|
|
203
|
-
* access token, which is effectively the canonical
|
|
204
|
-
* profile's token that can be used by alias-aware consumers for cross-SRP
|
|
205
|
-
* operations.
|
|
206
|
-
*
|
|
207
|
-
* @param entropySourceId - The entropy source ID. Omit for the primary SRP.
|
|
208
|
-
* @returns The OIDC access token.
|
|
209
|
-
*/
|
|
210
|
-
async getBearerToken(entropySourceId) {
|
|
211
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getBearerToken');
|
|
212
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
213
|
-
return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(resolvedId);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Returns the cached session profile, logging in if no session exists.
|
|
217
|
-
*
|
|
218
|
-
* The returned `canonicalProfileId` reflects the value from the most recent
|
|
219
|
-
* login or pairing. In the rare event where a canonical changed because of
|
|
220
|
-
* a pairing that happened on another device, the cached value may be stale
|
|
221
|
-
* until the next login. For guaranteed freshness, call
|
|
222
|
-
* `refreshCanonicalProfileId()` before reading `canonicalProfileId`.
|
|
223
|
-
*
|
|
224
|
-
* @param entropySourceId - The entropy source ID used to derive the key,
|
|
225
|
-
* when multiple sources are available (Multi-SRP).
|
|
226
|
-
* @returns profile for the session.
|
|
227
|
-
*/
|
|
228
|
-
async getSessionProfile(entropySourceId) {
|
|
229
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getSessionProfile');
|
|
230
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
231
|
-
return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfile(resolvedId);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Forces a fresh retrieval of the canonical profile ID from the server
|
|
235
|
-
* and propagates it to all cached SRP sessions.
|
|
236
|
-
*
|
|
237
|
-
* This method invalidates the primary SRP's cached session and forces a
|
|
238
|
-
* re-login. Use it before operations that require a guaranteed-fresh
|
|
239
|
-
* canonical (e.g. storage key derivation for Accounts ADR 0005). For
|
|
240
|
-
* best-effort reads, use
|
|
241
|
-
* `getSessionProfile().canonicalProfileId` instead.
|
|
242
|
-
*
|
|
243
|
-
* Only the primary SRP is re-logged-in regardless of how many SRPs exist —
|
|
244
|
-
* the server returns the current canonical for the entire pairing group
|
|
245
|
-
* from any single SRP login.
|
|
246
|
-
*
|
|
247
|
-
* @returns The refreshed canonical profile ID.
|
|
248
|
-
*/
|
|
249
|
-
async refreshCanonicalProfileId() {
|
|
250
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'refreshCanonicalProfileId');
|
|
251
|
-
const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
252
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_invalidateSrpSession).call(this, primaryEntropySourceId);
|
|
253
|
-
await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(primaryEntropySourceId);
|
|
254
|
-
const canonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
|
|
255
|
-
if (!canonical) {
|
|
256
|
-
throw new Error('refreshCanonicalProfileId - Unable to resolve canonical profile ID');
|
|
257
|
-
}
|
|
258
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonical);
|
|
259
|
-
return canonical;
|
|
260
|
-
}
|
|
261
|
-
async getUserProfileLineage(entropySourceId) {
|
|
262
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getUserProfileLineage');
|
|
263
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
264
|
-
return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfileLineage(resolvedId);
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Returns a Customer Service specific access token for the specified SRP,
|
|
268
|
-
* logging in if needed.
|
|
269
|
-
*
|
|
270
|
-
* Exchanges the OIDC access token for a short-lived token scoped to the
|
|
271
|
-
* customer-service audience. Customer Service tooling consumes this token to
|
|
272
|
-
* identify and authenticate the user.
|
|
273
|
-
*
|
|
274
|
-
* @param entropySourceId - The entropy source ID. Omit for the primary SRP.
|
|
275
|
-
* @returns The customer-service access token.
|
|
276
|
-
*/
|
|
277
|
-
async getCustomerServiceToken(entropySourceId) {
|
|
278
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getCustomerServiceToken');
|
|
279
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
280
|
-
return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getCustomerServiceToken(resolvedId);
|
|
281
|
-
}
|
|
282
|
-
isSignedIn() {
|
|
283
|
-
return this.state.isSignedIn;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
exports.AuthenticationController = AuthenticationController;
|
|
287
|
-
_AuthenticationController_metametrics = new WeakMap(), _AuthenticationController_auth = new WeakMap(), _AuthenticationController_config = new WeakMap(), _AuthenticationController_isUnlocked = new WeakMap(), _AuthenticationController_profilePairingRequestEpoch = new WeakMap(), _AuthenticationController_keyringController = new WeakMap(), _AuthenticationController__signMessageCache = new WeakMap(), _AuthenticationController_instances = new WeakSet(), _AuthenticationController_getLoginResponseFromState = async function _AuthenticationController_getLoginResponseFromState(entropySourceId) {
|
|
288
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
289
|
-
if (!this.state.srpSessionData?.[resolvedId]) {
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
return this.state.srpSessionData[resolvedId];
|
|
293
|
-
}, _AuthenticationController_setLoginResponseToState = async function _AuthenticationController_setLoginResponseToState(loginResponse, entropySourceId) {
|
|
294
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
295
|
-
const metaMetricsId = await __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f").getMetaMetricsId();
|
|
296
|
-
this.update((state) => {
|
|
297
|
-
state.isSignedIn = true;
|
|
298
|
-
if (!state.srpSessionData) {
|
|
299
|
-
state.srpSessionData = {};
|
|
300
|
-
}
|
|
301
|
-
state.srpSessionData[resolvedId] = {
|
|
302
|
-
...loginResponse,
|
|
303
|
-
profile: {
|
|
304
|
-
...loginResponse.profile,
|
|
305
|
-
metaMetricsId,
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
});
|
|
309
|
-
}, _AuthenticationController_assertIsUnlocked = function _AuthenticationController_assertIsUnlocked(methodName) {
|
|
310
|
-
if (!__classPrivateFieldGet(this, _AuthenticationController_isUnlocked, "f")) {
|
|
311
|
-
throw new Error(`${methodName} - unable to proceed, wallet is locked`);
|
|
312
|
-
}
|
|
313
|
-
}, _AuthenticationController_getHdKeyringEntropySourceIds = function _AuthenticationController_getHdKeyringEntropySourceIds() {
|
|
314
|
-
const { keyrings } = this.messenger.call('KeyringController:getState');
|
|
315
|
-
return (0, entropy_source_js_1.getHdKeyringEntropySourceIds)(keyrings);
|
|
316
|
-
}, _AuthenticationController_getPrimaryEntropySourceId = function _AuthenticationController_getPrimaryEntropySourceId() {
|
|
317
|
-
const { keyrings } = this.messenger.call('KeyringController:getState');
|
|
318
|
-
return (0, entropy_source_js_1.getPrimaryHdKeyringEntropySourceId)(keyrings);
|
|
319
|
-
}, _AuthenticationController_getLoginTag =
|
|
320
|
-
/**
|
|
321
|
-
* Resolves the SRP login tag for `raw_message`.
|
|
322
|
-
*
|
|
323
|
-
* - `primary` for the first HD entropy source
|
|
324
|
-
* - `secondary` for any other entropy source
|
|
325
|
-
*
|
|
326
|
-
* @param entropySourceId - Entropy source for this login attempt.
|
|
327
|
-
* @returns The login tag to append to the signed message.
|
|
328
|
-
*/
|
|
329
|
-
async function _AuthenticationController_getLoginTag(entropySourceId) {
|
|
330
|
-
const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
331
|
-
const resolvedId = entropySourceId ?? primaryEntropySourceId;
|
|
332
|
-
return resolvedId === primaryEntropySourceId ? 'primary' : 'secondary';
|
|
333
|
-
}, _AuthenticationController_getLoginIdentifierType =
|
|
334
|
-
/**
|
|
335
|
-
* Resolves metametrics `identifier_type` for `/srp/login`
|
|
336
|
-
* (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`).
|
|
337
|
-
*
|
|
338
|
-
* This is the auth method for the entropy source, independent of
|
|
339
|
-
* {@link SrpLoginTag} (`primary` / `secondary`).
|
|
340
|
-
*
|
|
341
|
-
* SeedlessOnboarding currently exposes a single vault-level
|
|
342
|
-
* `authConnection`, which always backs the primary entropy source. Non-
|
|
343
|
-
* primary sources therefore return `SRP`. If social identities become
|
|
344
|
-
* per-entropy later, resolve from that metadata instead of assuming
|
|
345
|
-
* primary === social.
|
|
346
|
-
*
|
|
347
|
-
* Soft-fails to `SRP` when SeedlessOnboarding is not registered.
|
|
348
|
-
*
|
|
349
|
-
* @param entropySourceId - Entropy source for this login attempt.
|
|
350
|
-
* @returns The login identifier type.
|
|
351
|
-
*/
|
|
352
|
-
async function _AuthenticationController_getLoginIdentifierType(entropySourceId) {
|
|
353
|
-
const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
354
|
-
const resolvedId = entropySourceId ?? primaryEntropySourceId;
|
|
355
|
-
// Social vault authConnection is only associated with the primary source.
|
|
356
|
-
if (resolvedId !== primaryEntropySourceId) {
|
|
357
|
-
return 'SRP';
|
|
358
|
-
}
|
|
359
|
-
return __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_resolveSocialIdentifierType).call(this);
|
|
360
|
-
}, _AuthenticationController_resolveSocialIdentifierType = function _AuthenticationController_resolveSocialIdentifierType() {
|
|
361
|
-
try {
|
|
362
|
-
return __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_identifierTypeFromSeedlessState).call(this, this.messenger.call('SeedlessOnboardingController:getState'));
|
|
363
|
-
}
|
|
364
|
-
catch {
|
|
365
|
-
return 'SRP';
|
|
366
|
-
}
|
|
367
|
-
}, _AuthenticationController_identifierTypeFromSeedlessState = function _AuthenticationController_identifierTypeFromSeedlessState(state) {
|
|
368
|
-
if (state.vault === null || state.vault === undefined) {
|
|
369
|
-
return 'SRP';
|
|
370
|
-
}
|
|
371
|
-
// Match provider strings from SeedlessOnboarding state rather than
|
|
372
|
-
// importing AuthConnection — a value import would load that package
|
|
373
|
-
// (and its heavy deps) whenever this controller is imported.
|
|
374
|
-
switch (state.authConnection) {
|
|
375
|
-
case 'google':
|
|
376
|
-
return 'GOOGLE';
|
|
377
|
-
case 'apple':
|
|
378
|
-
return 'APPLE';
|
|
379
|
-
case 'telegram':
|
|
380
|
-
return 'TELEGRAM';
|
|
381
|
-
default:
|
|
382
|
-
return 'SRP';
|
|
383
|
-
}
|
|
384
|
-
}, _AuthenticationController_trySocialPairing =
|
|
385
|
-
/**
|
|
386
|
-
* Attaches a Google/Apple/Telegram social identifier to the primary SRP
|
|
387
|
-
* profile via `POST /api/v2/profile/pair/identifier`.
|
|
388
|
-
*
|
|
389
|
-
* Runs only when `isSocialPairingEnabled()` is true and
|
|
390
|
-
* `needsSocialPairing` is not `false` (`undefined` is treated as true).
|
|
391
|
-
* No social provider (`authConnection` unset) → clear the flag (nothing
|
|
392
|
-
* to pair). Social provider set but vault missing → skip (onboarding
|
|
393
|
-
* still in flight). Google without email → skip (API requires it).
|
|
394
|
-
* Telegram never sends `email` (the field holds a display name, not an
|
|
395
|
-
* address). Missing social JWT → skip. 409 Conflict → clear the flag
|
|
396
|
-
* (identifier already owned; retry is pointless). Other errors
|
|
397
|
-
* propagate so the caller can swallow them and leave the flag set for
|
|
398
|
-
* retry.
|
|
399
|
-
*
|
|
400
|
-
* @param primaryAccessToken - Primary SRP OIDC access token used as the
|
|
401
|
-
* Bearer credential. The profile associated with this JWT becomes the
|
|
402
|
-
* canonical owner of the social identifier.
|
|
403
|
-
*/
|
|
404
|
-
async function _AuthenticationController_trySocialPairing(primaryAccessToken) {
|
|
405
|
-
if (!__classPrivateFieldGet(this, _AuthenticationController_config, "f").isSocialPairingEnabled() ||
|
|
406
|
-
this.state.needsSocialPairing === false ||
|
|
407
|
-
!primaryAccessToken) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
let seedlessState;
|
|
411
|
-
try {
|
|
412
|
-
seedlessState = this.messenger.call('SeedlessOnboardingController:getState');
|
|
413
|
-
}
|
|
414
|
-
catch {
|
|
415
|
-
// Controller missing or getState failed — retry next performSignIn.
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
// `SRP` here does not describe the vault: it is the mapping's "no social
|
|
419
|
-
// identity" result, returned when there is no seedless vault or the
|
|
420
|
-
// provider is unrecognised. In both cases there is nothing to pair.
|
|
421
|
-
const identifierType = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_identifierTypeFromSeedlessState).call(this, seedlessState);
|
|
422
|
-
if (identifierType === 'SRP') {
|
|
423
|
-
const { vault, authConnection } = seedlessState;
|
|
424
|
-
// Vault not written yet but a social provider is already known —
|
|
425
|
-
// onboarding is still in flight. Do not clear; retry next sign-in.
|
|
426
|
-
if ((vault === null || vault === undefined) && Boolean(authConnection)) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
// Email policy follows the API contract: GOOGLE requires `email` (400
|
|
433
|
-
// without it), APPLE accepts it optionally, TELEGRAM must not send it
|
|
434
|
-
// (clients store a display name in `socialLoginEmail` for Telegram).
|
|
435
|
-
// Clients request the `email` scope for Google, so a missing value is a
|
|
436
|
-
// defensive case rather than an expected one; returning here leaves
|
|
437
|
-
// `needsSocialPairing` set so the next sign-in retries instead of
|
|
438
|
-
// sending a request that would fail.
|
|
439
|
-
const { socialLoginEmail } = seedlessState;
|
|
440
|
-
let email;
|
|
441
|
-
if (identifierType === 'GOOGLE') {
|
|
442
|
-
if (!socialLoginEmail) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
email = socialLoginEmail;
|
|
446
|
-
}
|
|
447
|
-
else if (identifierType === 'APPLE') {
|
|
448
|
-
email = socialLoginEmail;
|
|
449
|
-
}
|
|
450
|
-
const socialJwt = await this.messenger.call('SeedlessOnboardingController:getAccessToken');
|
|
451
|
-
if (socialJwt === undefined || socialJwt === '') {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
try {
|
|
455
|
-
await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").pairSocialIdentifier({
|
|
456
|
-
identifierType,
|
|
457
|
-
socialJwt,
|
|
458
|
-
...(email ? { email } : {}),
|
|
459
|
-
}, primaryAccessToken);
|
|
460
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
|
|
461
|
-
}
|
|
462
|
-
catch (error) {
|
|
463
|
-
if (error instanceof index_js_1.PairConflictError) {
|
|
464
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
throw error;
|
|
468
|
-
}
|
|
469
|
-
}, _AuthenticationController_clearNeedsSocialPairing = function _AuthenticationController_clearNeedsSocialPairing() {
|
|
470
|
-
if (this.state.needsSocialPairing !== false) {
|
|
471
|
-
this.update((state) => {
|
|
472
|
-
state.needsSocialPairing = false;
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}, _AuthenticationController_tryClearNeedsProfilePairing = function _AuthenticationController_tryClearNeedsProfilePairing(epochAtStart) {
|
|
476
|
-
if (__classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") !== epochAtStart) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
if (this.state.needsProfilePairing) {
|
|
480
|
-
this.update((state) => {
|
|
481
|
-
state.needsProfilePairing = false;
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
}, _AuthenticationController_doPair =
|
|
485
|
-
/**
|
|
486
|
-
* Pairs all SRPs via `POST /profile/pair`, propagates the canonical
|
|
487
|
-
* profile ID, clears `needsProfilePairing`, and emits
|
|
488
|
-
* `AuthenticationController:profileSignIn` when the canonical changes or
|
|
489
|
-
* new aliases are returned. Throws on failure.
|
|
490
|
-
*
|
|
491
|
-
* @param accessTokens - Per-SRP access tokens, primary first.
|
|
492
|
-
* @param epochAtStart - Pairing-request epoch captured by the caller.
|
|
493
|
-
* Used to skip the gate clear if `requestProfilePairing` ran while the
|
|
494
|
-
* pair API call was in-flight.
|
|
495
|
-
*/
|
|
496
|
-
async function _AuthenticationController_doPair(accessTokens, epochAtStart) {
|
|
497
|
-
const previousCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
|
|
498
|
-
const profileAliases = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_pairSrpProfiles).call(this, accessTokens);
|
|
499
|
-
const newCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
|
|
500
|
-
// If somehow we cannot compute the new canonical profile ID after pairing,
|
|
501
|
-
// we just return now and do not update the `needsProfilePairing` flag.
|
|
502
|
-
if (!newCanonical) {
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
|
|
506
|
-
const profileIdChanged = previousCanonical !== newCanonical;
|
|
507
|
-
const shouldEmitProfileSignInEvent = profileIdChanged || profileAliases.length > 0;
|
|
508
|
-
if (shouldEmitProfileSignInEvent) {
|
|
509
|
-
this.messenger.publish('AuthenticationController:profileSignIn', {
|
|
510
|
-
profileId: newCanonical,
|
|
511
|
-
profileAliases,
|
|
512
|
-
profileIdChanged,
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
}, _AuthenticationController_pairSrpProfiles = async function _AuthenticationController_pairSrpProfiles(accessTokens) {
|
|
516
|
-
if (accessTokens.length < 2) {
|
|
517
|
-
return [];
|
|
518
|
-
}
|
|
519
|
-
const primaryAccessToken = accessTokens[0]; // Associated with primary SRP.
|
|
520
|
-
const { profileAliases, profile: { canonicalProfileId }, } = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").pairSrpProfiles(accessTokens, primaryAccessToken);
|
|
521
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonicalProfileId);
|
|
522
|
-
return profileAliases;
|
|
523
|
-
}, _AuthenticationController_propagateCanonical = function _AuthenticationController_propagateCanonical(canonicalProfileId) {
|
|
524
|
-
const { srpSessionData } = this.state;
|
|
525
|
-
if (!srpSessionData) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
this.update((state) => {
|
|
529
|
-
for (const entry of Object.values(state.srpSessionData ?? {})) {
|
|
530
|
-
if (entry?.profile) {
|
|
531
|
-
entry.profile.canonicalProfileId = canonicalProfileId;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
}, _AuthenticationController_getCanonicalProfileId = function _AuthenticationController_getCanonicalProfileId() {
|
|
536
|
-
const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
537
|
-
return (this.state.srpSessionData?.[primaryEntropySourceId]?.profile
|
|
538
|
-
?.canonicalProfileId ?? null);
|
|
539
|
-
}, _AuthenticationController_invalidateSrpSession = function _AuthenticationController_invalidateSrpSession(entropySourceId) {
|
|
540
|
-
this.update((state) => {
|
|
541
|
-
const entry = state.srpSessionData?.[entropySourceId];
|
|
542
|
-
if (entry?.profile) {
|
|
543
|
-
// Setting canonicalProfileId to '' forces a re-fetch on the next
|
|
544
|
-
// #getAuthSession call. The falsy check (!auth.profile.canonicalProfileId)
|
|
545
|
-
// treats '' the same as undefined/null — all signal an invalid session.
|
|
546
|
-
entry.profile.canonicalProfileId = '';
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
}, _AuthenticationController_getHdKeyringSeed =
|
|
550
|
-
/**
|
|
551
|
-
* Reads the BIP-39 seed for an HD entropy source from KeyringController.
|
|
552
|
-
*
|
|
553
|
-
* @param entropySourceId - Entropy source ID. Defaults to the primary HD
|
|
554
|
-
* keyring.
|
|
555
|
-
* @returns The HD keyring seed.
|
|
556
|
-
*/
|
|
557
|
-
async function _AuthenticationController_getHdKeyringSeed(entropySourceId) {
|
|
558
|
-
const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
|
|
559
|
-
return (0, hd_keyring_seed_js_1.getHdKeyringSeed)(this.messenger, resolvedId);
|
|
560
|
-
}, _AuthenticationController_getPublicKey =
|
|
561
|
-
/**
|
|
562
|
-
* Returns the message-signing public key via native SIP-6 derivation
|
|
563
|
-
* (same key as `@metamask/message-signing-snap` with empty salt).
|
|
564
|
-
*
|
|
565
|
-
* @param entropySourceId - The entropy source ID used to derive the key,
|
|
566
|
-
* when multiple sources are available (Multi-SRP).
|
|
567
|
-
* @returns The public key hex.
|
|
568
|
-
*/
|
|
569
|
-
async function _AuthenticationController_getPublicKey(entropySourceId) {
|
|
570
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#getPublicKey');
|
|
571
|
-
const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
|
|
572
|
-
return (0, message_signing_js_1.getMessageSigningPublicKey)(seed);
|
|
573
|
-
}, _AuthenticationController_scopedCacheKey = function _AuthenticationController_scopedCacheKey(message, entropySourceId) {
|
|
574
|
-
return `${entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this)}:${message}`;
|
|
575
|
-
}, _AuthenticationController_signMessage =
|
|
576
|
-
/**
|
|
577
|
-
* Signs a `metamask:…` message with the native SIP-6 message-signing key.
|
|
578
|
-
*
|
|
579
|
-
* @param message - A specific tagged message to sign.
|
|
580
|
-
* @param entropySourceId - The entropy source ID used to derive the key,
|
|
581
|
-
* when multiple sources are available (Multi-SRP).
|
|
582
|
-
* @returns Compact secp256k1 signature hex.
|
|
583
|
-
*/
|
|
584
|
-
async function _AuthenticationController_signMessage(message, entropySourceId) {
|
|
585
|
-
(0, index_js_1.assertMessageStartsWithMetamask)(message);
|
|
586
|
-
__classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#signMessage');
|
|
587
|
-
const cacheKey = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_scopedCacheKey).call(this, message, entropySourceId);
|
|
588
|
-
if (__classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey]) {
|
|
589
|
-
return __classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey];
|
|
590
|
-
}
|
|
591
|
-
const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
|
|
592
|
-
const result = await (0, message_signing_js_1.signMessageWithMessageSigningKey)(message, seed);
|
|
593
|
-
__classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey] = result;
|
|
594
|
-
return result;
|
|
595
|
-
};
|
|
596
|
-
//# sourceMappingURL=AuthenticationController.cjs.map
|