@metamask-previews/profile-sync-controller 29.0.0-preview-b13d916 → 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
|
@@ -10,10 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _SIWEJwtBearerAuth_instances, _SIWEJwtBearerAuth_config, _SIWEJwtBearerAuth_options, _SIWEJwtBearerAuth_signer, _SIWEJwtBearerAuth_getAuthSession, _SIWEJwtBearerAuth_login, _SIWEJwtBearerAuth_createSiWELoginRawMessage, _SIWEJwtBearerAuth_assertSigner;
|
|
13
|
-
import { SiweMessage } from
|
|
14
|
-
import { ValidationError } from
|
|
15
|
-
import { validateLoginResponse } from
|
|
16
|
-
import { SIWE_LOGIN_URL, authenticate, authorizeOIDC, getCustomerServiceToken, getNonce, getUserProfileLineage } from
|
|
13
|
+
import { SiweMessage } from 'siwe';
|
|
14
|
+
import { ValidationError } from '../errors.js';
|
|
15
|
+
import { validateLoginResponse } from '../utils/validate-login-response.js';
|
|
16
|
+
import { SIWE_LOGIN_URL, authenticate, authorizeOIDC, getCustomerServiceToken, getNonce, getUserProfileLineage, } from './services.js';
|
|
17
17
|
export class SIWEJwtBearerAuth {
|
|
18
18
|
constructor(config, options) {
|
|
19
19
|
_SIWEJwtBearerAuth_instances.add(this);
|
|
@@ -107,4 +107,4 @@ async function _SIWEJwtBearerAuth_getAuthSession() {
|
|
|
107
107
|
throw new ValidationError(`you must call 'prepare()' before logging in`);
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
//# sourceMappingURL=flow-siwe.
|
|
110
|
+
//# sourceMappingURL=flow-siwe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-siwe.js","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-siwe.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,E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AAG,EAAE,cAAc,CAAC,uBAAA,IAAI,iCAAQ,CAAC,GAAG,CAAC;QACrC,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,uBAAA,IAAI,iCAAQ,EAAE,OAAO;QAC9B,KAAK;QACL,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACnC,CAAC,CAAC,cAAc,EAAE,CAAC;AACtB,CAAC,6EAGC,MAAkC;IAElC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,eAAe,CAAC,6CAA6C,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["import { SiweMessage } from 'siwe';\n\nimport { ValidationError } from '../errors.js';\nimport { validateLoginResponse } from '../utils/validate-login-response.js';\nimport {\n SIWE_LOGIN_URL,\n authenticate,\n authorizeOIDC,\n getCustomerServiceToken,\n getNonce,\n getUserProfileLineage,\n} from './services.js';\nimport type {\n AuthConfig,\n AuthStorageOptions,\n AuthType,\n IBaseAuth,\n LoginResponse,\n UserProfile,\n UserProfileLineage,\n} from './types.js';\n\ntype JwtBearerAuth_SIWE_Options = {\n storage: AuthStorageOptions;\n};\n\ntype JwtBearerAuth_SIWE_Signer = {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n};\n\nexport class SIWEJwtBearerAuth implements IBaseAuth {\n readonly #config: AuthConfig;\n\n readonly #options: JwtBearerAuth_SIWE_Options;\n\n #signer: JwtBearerAuth_SIWE_Signer | undefined;\n\n constructor(\n config: AuthConfig & { type: AuthType.SiWE },\n options: JwtBearerAuth_SIWE_Options,\n ) {\n this.#config = config;\n this.#options = options;\n }\n\n async getAccessToken(): Promise<string> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.token.accessToken;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.token.accessToken;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.profile;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.profile;\n }\n\n async getIdentifier(): Promise<string> {\n this.#assertSigner(this.#signer);\n return this.#signer.address;\n }\n\n async getUserProfileLineage(): Promise<UserProfileLineage> {\n const accessToken = await this.getAccessToken();\n return await getUserProfileLineage(this.#config.env, accessToken);\n }\n\n async getCustomerServiceToken(): Promise<string> {\n const accessToken = await this.getAccessToken();\n return await getCustomerServiceToken(this.#config.env, accessToken);\n }\n\n async signMessage(message: string): Promise<string> {\n this.#assertSigner(this.#signer);\n return await this.#signer.signMessage(message);\n }\n\n prepare(signer: JwtBearerAuth_SIWE_Signer) {\n this.#signer = signer;\n }\n\n // convert expiresIn from seconds to milliseconds and use 90% of expiresIn\n async #getAuthSession(): Promise<LoginResponse | null> {\n const auth = await this.#options.storage.getLoginResponse();\n if (!validateLoginResponse(auth)) {\n return null;\n }\n\n const currentTime = Date.now();\n const sessionAge = currentTime - auth.token.obtainedAt;\n const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;\n\n if (sessionAge < refreshThreshold) {\n return auth;\n }\n return null;\n }\n\n async #login(): Promise<LoginResponse> {\n this.#assertSigner(this.#signer);\n\n // Nonce\n const address = await this.getIdentifier();\n const nonceRes = await getNonce(address, this.#config.env);\n const rawMessage = this.#createSiWELoginRawMessage(nonceRes.nonce);\n const signature = await this.signMessage(rawMessage);\n\n // Authenticate\n const authResponse = await authenticate(\n rawMessage,\n signature,\n this.#config.type,\n this.#config.env,\n );\n\n // Authorize\n const tokenResponse = await authorizeOIDC(\n authResponse.token,\n this.#config.env,\n this.#config.platform,\n );\n\n // Save\n const result: LoginResponse = {\n profile: authResponse.profile,\n token: tokenResponse,\n };\n\n await this.#options.storage.setLoginResponse(result);\n\n return result;\n }\n\n #createSiWELoginRawMessage(nonce: string): string {\n this.#assertSigner(this.#signer);\n\n return new SiweMessage({\n domain: this.#signer?.domain,\n address: this.#signer?.address,\n uri: SIWE_LOGIN_URL(this.#config.env),\n version: '1',\n chainId: this.#signer?.chainId,\n nonce,\n issuedAt: new Date().toISOString(),\n }).prepareMessage();\n }\n\n #assertSigner(\n signer?: JwtBearerAuth_SIWE_Signer,\n ): asserts signer is JwtBearerAuth_SIWE_Signer {\n if (!signer) {\n throw new ValidationError(`you must call 'prepare()' before logging in`);\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Eip1193Provider } from
|
|
2
|
-
import type { MetaMetricsAuth } from
|
|
3
|
-
import type { PairProfilesResponse } from
|
|
4
|
-
import type { AuthConfig, AuthSigningOptions, AuthStorageOptions, AuthType, IBaseAuth, LoginIdentifierType, SrpLoginTag, UserProfile, UserProfileLineage } from
|
|
1
|
+
import type { Eip1193Provider } from 'ethers';
|
|
2
|
+
import type { MetaMetricsAuth } from '../../shared/types/services.js';
|
|
3
|
+
import type { PairProfilesResponse } from './services.js';
|
|
4
|
+
import type { AuthConfig, AuthSigningOptions, AuthStorageOptions, AuthType, IBaseAuth, LoginIdentifierType, SrpLoginTag, UserProfile, UserProfileLineage } from './types.js';
|
|
5
5
|
type JwtBearerAuth_SRP_Options = {
|
|
6
6
|
storage: AuthStorageOptions;
|
|
7
7
|
signing?: AuthSigningOptions;
|
|
@@ -41,4 +41,4 @@ export declare class SRPJwtBearerAuth implements IBaseAuth {
|
|
|
41
41
|
connectSnap(): Promise<string>;
|
|
42
42
|
}
|
|
43
43
|
export {};
|
|
44
|
-
//# sourceMappingURL=flow-srp.d.
|
|
44
|
+
//# sourceMappingURL=flow-srp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-srp.d.ts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAkBtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EACV,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B,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGvE;IAEK,eAAe,CACnB,YAAY,EAAE,MAAM,EAAE,EACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAqC/B;IAEK,WAAW,CACf,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;IAEK,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CASxC;IAEK,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAMnC;CAyKF"}
|
|
@@ -10,13 +10,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _SRPJwtBearerAuth_instances, _SRPJwtBearerAuth_config, _SRPJwtBearerAuth_options, _SRPJwtBearerAuth_metametrics, _SRPJwtBearerAuth_ongoingLogins, _SRPJwtBearerAuth_ongoingPairings, _SRPJwtBearerAuth_cooldownDefaultMs, _SRPJwtBearerAuth_maxLoginRetries, _SRPJwtBearerAuth_getLoginTag, _SRPJwtBearerAuth_getLoginIdentifierType, _SRPJwtBearerAuth_customProvider, _SRPJwtBearerAuth_getAuthSession, _SRPJwtBearerAuth_login, _SRPJwtBearerAuth_performLogin, _SRPJwtBearerAuth_deferredLogin, _SRPJwtBearerAuth_loginWithRetry, _SRPJwtBearerAuth_createSrpLoginRawMessage;
|
|
13
|
-
import { ValidationError, RateLimitedError } from
|
|
14
|
-
import { getMetaMaskProviderEIP6963 } from
|
|
15
|
-
import { MESSAGE_SIGNING_SNAP, assertMessageStartsWithMetamask, connectSnap, isSnapConnected } from
|
|
16
|
-
import { validateLoginResponse } from
|
|
17
|
-
import { authenticate, authorizeOIDC, getCustomerServiceToken, getNonce, getUserProfileLineage, pairProfiles } from
|
|
18
|
-
import { computeIdentifierId } from
|
|
19
|
-
import * as timeUtils from
|
|
13
|
+
import { ValidationError, RateLimitedError } from '../errors.js';
|
|
14
|
+
import { getMetaMaskProviderEIP6963 } from '../utils/eip-6963-metamask-provider.js';
|
|
15
|
+
import { MESSAGE_SIGNING_SNAP, assertMessageStartsWithMetamask, connectSnap, isSnapConnected, } from '../utils/messaging-signing-snap-requests.js';
|
|
16
|
+
import { validateLoginResponse } from '../utils/validate-login-response.js';
|
|
17
|
+
import { authenticate, authorizeOIDC, getCustomerServiceToken, getNonce, getUserProfileLineage, pairProfiles, } from './services.js';
|
|
18
|
+
import { computeIdentifierId } from './utils/identifier.js';
|
|
19
|
+
import * as timeUtils from './utils/time.js';
|
|
20
20
|
// How long a successful pairing result stays cached so identical payloads
|
|
21
21
|
// (concurrent or sequential retries) reuse it instead of re-hitting the endpoint.
|
|
22
22
|
export const PAIR_DEDUPE_TTL_MS = 30000;
|
|
@@ -260,4 +260,4 @@ async function _SRPJwtBearerAuth_getAuthSession(entropySourceId) {
|
|
|
260
260
|
}
|
|
261
261
|
return `metamask:${nonce}:${publicKey}`;
|
|
262
262
|
};
|
|
263
|
-
//# sourceMappingURL=flow-srp.
|
|
263
|
+
//# sourceMappingURL=flow-srp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-srp.js","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,WAAW,EACX,eAAe,GAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EACL,YAAY,EACZ,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,q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OAAO,MAAM,YAAY,CAAC;IAC5B,CAAC;YAAS,CAAC;QACT,sDAAsD;QACtD,uBAAA,IAAI,uCAAe,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,qCAED,KAAK,2CAAiB,eAAwB;IAC5C,uDAAuD;IACvD,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,uBAAA,IAAI,yCAAiB,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACxE,IAAI,CAAC;YACH,OAAO,MAAM,uBAAA,IAAI,mEAAc,MAAlB,IAAI,EAAe,eAAe,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,wCAAwC;YACxC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1C,MAAM,CAAC,CAAC;YACV,CAAC;YAED,uCAAuC;YACvC,IAAI,OAAO,IAAI,uBAAA,IAAI,yCAAiB,EAAE,CAAC;gBACrC,MAAM,CAAC,CAAC;YACV,CAAC;YAED,2CAA2C;YAC3C,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,IAAI,uBAAA,IAAI,2CAAmB,CAAC;YACzD,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAE9B,0BAA0B;QAC5B,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;AACrE,CAAC,mGAGC,KAAa,EACb,SAAiB,EACjB,GAAiB;IAIjB,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,YAAY,KAAK,IAAI,SAAS,IAAI,GAAG,EAAW,CAAC;IAC1D,CAAC;IACD,OAAO,YAAY,KAAK,IAAI,SAAS,EAAW,CAAC;AACnD,CAAC","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { MetaMetricsAuth } from '../../shared/types/services.js';\nimport { ValidationError, RateLimitedError } from '../errors.js';\nimport { getMetaMaskProviderEIP6963 } from '../utils/eip-6963-metamask-provider.js';\nimport {\n MESSAGE_SIGNING_SNAP,\n assertMessageStartsWithMetamask,\n connectSnap,\n isSnapConnected,\n} from '../utils/messaging-signing-snap-requests.js';\nimport { validateLoginResponse } from '../utils/validate-login-response.js';\nimport {\n authenticate,\n authorizeOIDC,\n getCustomerServiceToken,\n getNonce,\n getUserProfileLineage,\n pairProfiles,\n} from './services.js';\nimport type { PairProfilesResponse } from './services.js';\nimport type {\n AuthConfig,\n AuthSigningOptions,\n AuthStorageOptions,\n AuthType,\n IBaseAuth,\n LoginIdentifierType,\n LoginResponse,\n SrpLoginTag,\n UserProfile,\n UserProfileLineage,\n} from './types.js';\nimport { computeIdentifierId } from './utils/identifier.js';\nimport * as timeUtils from './utils/time.js';\n\ntype JwtBearerAuth_SRP_Options = {\n storage: AuthStorageOptions;\n signing?: AuthSigningOptions;\n /**\n * Resolves the login tag for a given entropy source.\n * When omitted, `raw_message` stays untagged (`metamask:<nonce>:<pubkey>`).\n */\n getLoginTag?: (entropySourceId?: string) => Promise<SrpLoginTag>;\n /**\n * Resolves the metametrics `identifier_type` for a given entropy source.\n * Defaults to `'SRP'` when omitted.\n */\n getLoginIdentifierType?: (\n entropySourceId?: string,\n ) => Promise<LoginIdentifierType>;\n rateLimitRetry?: {\n cooldownDefaultMs?: number; // default cooldown when 429 has no Retry-After\n maxLoginRetries?: number; // maximum number of login retries on rate limit\n };\n};\n\n// How long a successful pairing result stays cached so identical payloads\n// (concurrent or sequential retries) reuse it instead of re-hitting the endpoint.\nexport const PAIR_DEDUPE_TTL_MS = 30_000;\n\nconst getDefaultEIP6963Provider = async () => {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n throw new ValidationError('No MetaMask wallet connected');\n }\n return provider;\n};\n\nconst getDefaultEIP6963SigningOptions = (\n customProvider?: Eip1193Provider,\n): AuthSigningOptions => ({\n getIdentifier: async (entropySourceId?: string): Promise<string> => {\n const provider = customProvider ?? (await getDefaultEIP6963Provider());\n return await MESSAGE_SIGNING_SNAP.getPublicKey(provider, entropySourceId);\n },\n signMessage: async (\n message: string,\n entropySourceId?: string,\n ): Promise<string> => {\n const provider = customProvider ?? (await getDefaultEIP6963Provider());\n assertMessageStartsWithMetamask(message);\n return await MESSAGE_SIGNING_SNAP.signMessage(\n provider,\n message,\n entropySourceId,\n );\n },\n});\n\nexport class SRPJwtBearerAuth implements IBaseAuth {\n readonly #config: AuthConfig;\n\n readonly #options: {\n storage: AuthStorageOptions;\n signing: AuthSigningOptions;\n };\n\n readonly #metametrics?: MetaMetricsAuth;\n\n // Map to store ongoing login promises by entropySourceId\n readonly #ongoingLogins = new Map<\n string | undefined,\n Promise<LoginResponse>\n >();\n\n // Map to dedupe pairing calls by an order-insensitive token-set key.\n // Holds the in-flight promise (coalescing concurrent callers) and keeps it\n // for a short TTL after success (collapsing sequential retries).\n readonly #ongoingPairings = new Map<\n string,\n { promise: Promise<PairProfilesResponse>; expiresAt: number }\n >();\n\n // Default cooldown when 429 has no Retry-After header\n readonly #cooldownDefaultMs: number;\n\n // Maximum number of login retries on rate limit errors\n readonly #maxLoginRetries: number;\n\n readonly #getLoginTag?: (entropySourceId?: string) => Promise<SrpLoginTag>;\n\n readonly #getLoginIdentifierType?: (\n entropySourceId?: string,\n ) => Promise<LoginIdentifierType>;\n\n #customProvider?: Eip1193Provider;\n\n constructor(\n config: AuthConfig & { type: AuthType.SRP },\n options: JwtBearerAuth_SRP_Options & {\n customProvider?: Eip1193Provider;\n metametrics?: MetaMetricsAuth;\n },\n ) {\n this.#config = config;\n this.#customProvider = options.customProvider;\n this.#getLoginTag = options.getLoginTag;\n this.#getLoginIdentifierType = options.getLoginIdentifierType;\n this.#options = {\n storage: options.storage,\n signing:\n options.signing ??\n getDefaultEIP6963SigningOptions(this.#customProvider),\n };\n this.#metametrics = options.metametrics;\n\n // Apply rate limit retry config if provided\n this.#cooldownDefaultMs =\n options.rateLimitRetry?.cooldownDefaultMs ?? 10000;\n this.#maxLoginRetries = options.rateLimitRetry?.maxLoginRetries ?? 1;\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#customProvider = provider;\n this.#options.signing = getDefaultEIP6963SigningOptions(provider);\n }\n\n // TODO: might be easier to keep entropySourceId as a class param and use multiple SRPJwtBearerAuth instances where needed\n async getAccessToken(entropySourceId?: string): Promise<string> {\n const session = await this.#getAuthSession(entropySourceId);\n if (session) {\n return session.token.accessToken;\n }\n\n const loginResponse = await this.#login(entropySourceId);\n return loginResponse.token.accessToken;\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n const session = await this.#getAuthSession(entropySourceId);\n if (session) {\n return session.profile;\n }\n\n const loginResponse = await this.#login(entropySourceId);\n return loginResponse.profile;\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#options.signing.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n const accessToken = await this.getAccessToken(entropySourceId);\n return await getUserProfileLineage(this.#config.env, accessToken);\n }\n\n async getCustomerServiceToken(entropySourceId?: string): Promise<string> {\n const accessToken = await this.getAccessToken(entropySourceId);\n return await getCustomerServiceToken(this.#config.env, accessToken);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n // Order-insensitive key: the same token set in any order maps to the same\n // entry. Sort a copy so the request payload itself stays primary-first.\n const key = JSON.stringify([...accessTokens].sort());\n\n const cached = this.#ongoingPairings.get(key);\n if (cached && cached.expiresAt > Date.now()) {\n return await cached.promise;\n }\n\n const promise = pairProfiles(\n accessTokens,\n authAccessToken,\n this.#config.env,\n );\n // Store the in-flight promise immediately so concurrent callers coalesce\n // regardless of how long the request takes.\n this.#ongoingPairings.set(key, {\n promise,\n expiresAt: Number.MAX_SAFE_INTEGER,\n });\n\n try {\n const result = await promise;\n // Keep the resolved result cached for a short window so sequential\n // retries with the same payload reuse it.\n this.#ongoingPairings.set(key, {\n promise,\n expiresAt: Date.now() + PAIR_DEDUPE_TTL_MS,\n });\n return result;\n } catch (error) {\n // Never cache failures: the pairing retry loop must be able to re-hit\n // the endpoint on the next attempt.\n this.#ongoingPairings.delete(key);\n throw error;\n }\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#options.signing.signMessage(message, entropySourceId);\n }\n\n async isSnapConnected(): Promise<boolean> {\n const provider =\n this.#customProvider ?? (await getDefaultEIP6963Provider());\n if (!provider) {\n return false;\n }\n\n const isConnected = await isSnapConnected(provider);\n return isConnected;\n }\n\n async connectSnap(): Promise<string> {\n const provider =\n this.#customProvider ?? (await getDefaultEIP6963Provider());\n\n const res = await connectSnap(provider);\n return res;\n }\n\n // convert expiresIn from seconds to milliseconds and use 90% of expiresIn\n async #getAuthSession(\n entropySourceId?: string,\n ): Promise<LoginResponse | null> {\n const auth = await this.#options.storage.getLoginResponse(entropySourceId);\n if (!validateLoginResponse(auth)) {\n return null;\n }\n\n // get canonical profile id from server if not present in the cached session\n if (!auth.profile.canonicalProfileId) {\n return null;\n }\n\n const currentTime = Date.now();\n const sessionAge = currentTime - auth.token.obtainedAt;\n const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;\n\n if (sessionAge < refreshThreshold) {\n return auth;\n }\n return null;\n }\n\n async #login(entropySourceId?: string): Promise<LoginResponse> {\n // Use a deferred login to avoid race conditions\n return await this.#deferredLogin(entropySourceId);\n }\n\n async #performLogin(entropySourceId?: string): Promise<LoginResponse> {\n // Nonce\n const publicKey = await this.getIdentifier(entropySourceId);\n const nonceRes = await getNonce(publicKey, this.#config.env);\n\n // Tag only when the wallet supplies getLoginTag. SDK callers keep the\n // legacy 3-part message rather than guessing `primary`.\n const tag = await this.#getLoginTag?.(entropySourceId);\n const identifierType =\n (await this.#getLoginIdentifierType?.(entropySourceId)) ?? 'SRP';\n const rawMessage = this.#createSrpLoginRawMessage(\n nonceRes.nonce,\n publicKey,\n tag,\n );\n const signature = await this.signMessage(rawMessage, entropySourceId);\n\n // Authenticate\n const authResponse = await authenticate(\n rawMessage,\n signature,\n this.#config.type,\n this.#config.env,\n this.#metametrics,\n identifierType,\n );\n\n // Resolve original profileId from aliases.\n // This is done mainly to preserve the original profileId for storage key derivation\n // until we migrate to the canonical profileId storage system.\n const canonicalProfileId = authResponse.profile.profileId;\n const profile = { ...authResponse.profile };\n\n if (authResponse.profileAliases?.length > 0) {\n const targetIdentifierId = computeIdentifierId(\n publicKey,\n this.#config.env,\n );\n\n const matchingAliases = authResponse.profileAliases.filter((alias) =>\n alias.identifierIds.some((id) => id.id === targetIdentifierId),\n );\n\n // Prefer the leaf alias (single identifier) — it's the original profile\n // created for this SRP. Multi-identifier aliases are former canonicals\n // that absorbed other profiles; they are correct only when this SRP's\n // original profile was itself a canonical before being absorbed.\n const targetAlias =\n matchingAliases.find((alias) => alias.identifierIds.length === 1) ??\n matchingAliases[0];\n\n if (targetAlias) {\n profile.profileId = targetAlias.aliasProfileId;\n }\n }\n\n profile.canonicalProfileId = canonicalProfileId;\n\n // Authorize\n const tokenResponse = await authorizeOIDC(\n authResponse.token,\n this.#config.env,\n this.#config.platform,\n );\n\n // Save\n const result: LoginResponse = {\n profile,\n token: tokenResponse,\n };\n\n await this.#options.storage.setLoginResponse(result, entropySourceId);\n\n return result;\n }\n\n async #deferredLogin(entropySourceId?: string): Promise<LoginResponse> {\n // Check if there's already an ongoing login for this entropySourceId\n const existingLogin = this.#ongoingLogins.get(entropySourceId);\n if (existingLogin) {\n return existingLogin;\n }\n\n // Create a new login promise\n const loginPromise = this.#loginWithRetry(entropySourceId);\n\n // Store the promise in the map\n this.#ongoingLogins.set(entropySourceId, loginPromise);\n\n try {\n // Wait for the login to complete\n return await loginPromise;\n } finally {\n // Always clean up the ongoing login promise when done\n this.#ongoingLogins.delete(entropySourceId);\n }\n }\n\n async #loginWithRetry(entropySourceId?: string): Promise<LoginResponse> {\n // Allow max attempts: initial + maxLoginRetries on 429\n for (let attempt = 0; attempt < 1 + this.#maxLoginRetries; attempt += 1) {\n try {\n return await this.#performLogin(entropySourceId);\n } catch (e) {\n // Only retry on rate-limit (429) errors\n if (!RateLimitedError.isRateLimitError(e)) {\n throw e;\n }\n\n // If we've exhausted attempts, rethrow\n if (attempt >= this.#maxLoginRetries) {\n throw e;\n }\n\n // Wait for Retry-After or default cooldown\n const waitMs = e.retryAfterMs ?? this.#cooldownDefaultMs;\n await timeUtils.delay(waitMs);\n\n // Loop continues to retry\n }\n }\n\n // Should never reach here due to loop logic, but TypeScript needs a return\n throw new Error('Unexpected: login loop exhausted without result');\n }\n\n #createSrpLoginRawMessage(\n nonce: string,\n publicKey: string,\n tag?: SrpLoginTag,\n ):\n | `metamask:${string}:${string}`\n | `metamask:${string}:${string}:${SrpLoginTag}` {\n if (tag) {\n return `metamask:${nonce}:${publicKey}:${tag}` as const;\n }\n return `metamask:${nonce}:${publicKey}` as const;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Env, Platform } from
|
|
2
|
-
import type { MetaMetricsAuth } from
|
|
3
|
-
import type { AccessToken, LoginIdentifierType, ProfileAlias, UserProfile, UserProfileLineage } from
|
|
4
|
-
import { AuthType } from
|
|
1
|
+
import type { Env, Platform } from '../../shared/env.js';
|
|
2
|
+
import type { MetaMetricsAuth } from '../../shared/types/services.js';
|
|
3
|
+
import type { AccessToken, LoginIdentifierType, ProfileAlias, UserProfile, UserProfileLineage } from './types.js';
|
|
4
|
+
import { AuthType } from './types.js';
|
|
5
5
|
export declare const NONCE_URL: (env: Env) => string;
|
|
6
6
|
export declare const PAIR_IDENTIFIERS: (env: Env) => string;
|
|
7
7
|
export declare const OIDC_TOKEN_URL: (env: Env) => string;
|
|
@@ -102,4 +102,4 @@ export declare function getUserProfileLineage(env: Env, accessToken: string): Pr
|
|
|
102
102
|
*/
|
|
103
103
|
export declare function getCustomerServiceToken(env: Env, accessToken: string): Promise<string>;
|
|
104
104
|
export {};
|
|
105
|
-
//# sourceMappingURL=services.d.
|
|
105
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAUtE,OAAO,KAAK,EACV,WAAW,EAEX,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAwHtC,eAAO,MAAM,SAAS,QAAS,GAAG,KAAG,MACS,CAAC;AAE/C,eAAO,MAAM,gBAAgB,QAAS,GAAG,KAAG,MACa,CAAC;AAE1D,eAAO,MAAM,cAAc,QAAS,GAAG,KAAG,MACI,CAAC;AAE/C,eAAO,MAAM,aAAa,QAAS,GAAG,KAAG,MACS,CAAC;AAEnD,eAAO,MAAM,cAAc,QAAS,GAAG,KAAG,MACS,CAAC;AAEpD,eAAO,MAAM,iBAAiB,QAAS,GAAG,KAAG,MACQ,CAAC;AAEtD,eAAO,MAAM,mBAAmB,QAAS,GAAG,KAAG,MACS,CAAC;AAEzD,eAAO,MAAM,0BAA0B,QAAS,GAAG,KAAG,MACS,CAAC;AAgBhE,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmBF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,EAAE,MAAM,CAAC;IAEpB,qBAAqB,EAAE,MAAM,CAAC;IAE9B,eAAe,EAAE,MAAM,GAAG,KAAK,CAAC;CACjC,CAAC;AAEF;;;;;;;;G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;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getEnvUrls, getOidcClientId } from
|
|
2
|
-
import { HTTP_STATUS_CODES } from
|
|
3
|
-
import { NonceRetrievalError, PairError, SignInError, ValidationError, RateLimitedError } from
|
|
4
|
-
import { validatePairResponse } from
|
|
5
|
-
import { AuthType } from
|
|
1
|
+
import { getEnvUrls, getOidcClientId } from '../../shared/env.js';
|
|
2
|
+
import { HTTP_STATUS_CODES } from '../constants.js';
|
|
3
|
+
import { NonceRetrievalError, PairError, SignInError, ValidationError, RateLimitedError, } from '../errors.js';
|
|
4
|
+
import { validatePairResponse } from '../utils/validate-pair-response.js';
|
|
5
|
+
import { AuthType } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Parse Retry-After header into milliseconds if possible.
|
|
8
8
|
* Supports seconds or HTTP-date formats.
|
|
@@ -379,4 +379,4 @@ export async function getCustomerServiceToken(env, accessToken) {
|
|
|
379
379
|
return await throwServiceError(error, 'Failed to get customer service token', SignInError);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
//# sourceMappingURL=services.
|
|
382
|
+
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/services.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAS1E,OAAO,EAA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,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,MAAM,iBAAiB,CAC5B,QAAQ,EACR,sCAAsC,EACtC,WAAW,CACZ,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,OAAO,aAAa,EAAE,YAAY,KAAK,QAAQ,EAAE,CAAC;YACpD,MAAM,IAAI,WAAW,CACnB,4DAA4D,CAC7D,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC,YAAY,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,iBAAiB,CAC5B,KAAK,EACL,sCAAsC,EACtC,WAAW,CACZ,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { Env, Platform } from '../../shared/env.js';\nimport { getEnvUrls, getOidcClientId } from '../../shared/env.js';\nimport type { MetaMetricsAuth } from '../../shared/types/services.js';\nimport { HTTP_STATUS_CODES } from '../constants.js';\nimport {\n NonceRetrievalError,\n PairError,\n SignInError,\n ValidationError,\n RateLimitedError,\n} from '../errors.js';\nimport { validatePairResponse } from '../utils/validate-pair-response.js';\nimport type {\n AccessToken,\n ErrorMessage,\n LoginIdentifierType,\n ProfileAlias,\n UserProfile,\n UserProfileLineage,\n} from './types.js';\nimport { AuthType } from './types.js';\n\n/**\n * Parse Retry-After header into milliseconds if possible.\n * Supports seconds or HTTP-date formats.\n *\n * @param retryAfterHeader - The Retry-After header value (seconds or HTTP-date)\n * @returns The retry delay in milliseconds, or null if parsing fails\n */\nfunction parseRetryAfter(retryAfterHeader: string | null): number | null {\n if (!retryAfterHeader) {\n return null;\n }\n const seconds = Number(retryAfterHeader);\n if (!Number.isNaN(seconds)) {\n return seconds * 1000;\n }\n const date = Date.parse(retryAfterHeader);\n if (!Number.isNaN(date)) {\n const diff = date - Date.now();\n return diff > 0 ? diff : null;\n }\n return null;\n}\n\n/**\n * Extracts error details from a Response object.\n *\n * @param response - The HTTP response object\n * @returns Formatted error message with HTTP status and response body\n */\nasync function getResponseErrorMessage(response: Response): Promise<string> {\n const { status } = response;\n const clonedResponse = response.clone();\n\n let message = 'Unknown error';\n let error = 'unknown';\n\n try {\n const responseBody = (await response.json()) as\n | ErrorMessage\n // eslint-disable-next-line @typescript-eslint/naming-convention\n | { error_description: string; error: string };\n\n message =\n 'message' in responseBody\n ? responseBody.message\n : responseBody.error_description;\n error = responseBody.error ?? 'unknown';\n } catch {\n try {\n const textContent = await clonedResponse.text();\n message = textContent\n ? textContent.slice(0, 150)\n : 'Non-JSON error response';\n error = 'non_json_response';\n } catch {\n message = 'Unable to parse error response';\n error = 'unparseable_response';\n }\n }\n\n return `HTTP ${status} - ${message} (error: ${error})`;\n}\n\n/**\n * Type guard to check if an object is a Response-like object.\n *\n * @param obj - The object to check\n * @returns True if the object is a Response-like object, false otherwise\n */\nconst isErrorResponse = (obj: unknown): obj is Response =>\n typeof obj === 'object' &&\n obj !== null &&\n 'status' in obj &&\n 'headers' in obj;\n\n/**\n * Throws a domain-specific error for service failures.\n * Handles both HTTP error responses and regular errors (network failures, etc.).\n * For HTTP 429, throws RateLimitedError with Retry-After header parsing.\n *\n * @param error - The error (Response object or caught error)\n * @param errorPrefix - Context prefix for the error message\n * @param ErrorClass - The domain-specific error class to throw\n * @throws RateLimitedError for 429, otherwise ErrorClass\n */\nasync function throwServiceError(\n error: unknown,\n errorPrefix: string,\n ErrorClass: new (message: string) => Error,\n): Promise<never> {\n // Re-throw RateLimitedError or matching ErrorClass as-is (don't double-wrap)\n if (error instanceof RateLimitedError || error instanceof ErrorClass) {\n throw error;\n }\n\n // Not a Response-like object - handle as regular error\n if (!isErrorResponse(error)) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n throw new ErrorClass(`${errorPrefix}: ${errorMessage}`);\n }\n\n // Handle HTTP error response\n const response = error;\n const { status } = response;\n const responseMessage = await getResponseErrorMessage(response);\n\n if (status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS) {\n const retryAfterHeader = response.headers.get('Retry-After');\n const retryAfterMs = parseRetryAfter(retryAfterHeader);\n throw new RateLimitedError(\n `${errorPrefix}: ${responseMessage}`,\n retryAfterMs ?? undefined,\n );\n }\n\n throw new ErrorClass(`${errorPrefix}: ${responseMessage}`);\n}\n\nexport const NONCE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/nonce`;\n\nexport const PAIR_IDENTIFIERS = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/identifiers/pair`;\n\nexport const OIDC_TOKEN_URL = (env: Env): string =>\n `${getEnvUrls(env).oidcApiUrl}/oauth2/token`;\n\nexport const SRP_LOGIN_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/srp/login`;\n\nexport const SIWE_LOGIN_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/siwe/login`;\n\nexport const PAIR_PROFILES_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/profile/pair`;\n\nexport const PROFILE_LINEAGE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/profile/lineage`;\n\nexport const CUSTOMER_SERVICE_TOKEN_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/customer-service/token`;\n\nconst getAuthenticationUrl = (authType: AuthType, env: Env): string => {\n switch (authType) {\n case AuthType.SRP:\n return SRP_LOGIN_URL(env);\n case AuthType.SiWE:\n return SIWE_LOGIN_URL(env);\n /* istanbul ignore next */\n default:\n throw new ValidationError(\n `Invalid AuthType: ${authType as number} - unable to create Auth URL`,\n );\n }\n};\n\ntype NonceResponse = {\n nonce: string;\n identifier: string;\n expiresIn: number;\n};\n\ntype RawProfileAlias = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n alias_profile_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n canonical_profile_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n identifier_ids: { id: string; type: string }[];\n};\n\nconst parseProfileAliases = (raw: RawProfileAlias[]): ProfileAlias[] => {\n return raw.map((alias) => ({\n aliasProfileId: alias.alias_profile_id,\n canonicalProfileId: alias.canonical_profile_id,\n identifierIds: alias.identifier_ids ?? [],\n }));\n};\n\ntype PairRequest = {\n signature: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n raw_message: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n encrypted_storage_key: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n identifier_type: 'SIWE' | 'SRP';\n};\n\n/**\n * Pair multiple identifiers under a single profile\n *\n * @param nonce - session nonce\n * @param logins - pairing request payload\n * @param accessToken - JWT access token used to access protected resources\n * @param env - server environment\n * @returns void.\n */\nexport async function pairIdentifiers(\n nonce: string,\n logins: PairRequest[],\n accessToken: string,\n env: Env,\n): Promise<void> {\n const pairUrl = new URL(PAIR_IDENTIFIERS(env));\n\n try {\n const response = await fetch(pairUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({\n nonce,\n logins,\n }),\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n 'Failed to pair identifiers',\n PairError,\n );\n }\n return undefined;\n } catch (error) {\n return await throwServiceError(\n error,\n 'Failed to pair identifiers',\n PairError,\n );\n }\n}\n\nexport type PairProfilesResponse = {\n profile: UserProfile;\n profileAliases: ProfileAlias[];\n};\n\n/**\n * Pair multiple profiles using their OIDC access tokens.\n * Idempotent — calling with already-paired tokens is a no-op.\n *\n * @param accessTokens - Two or more OIDC access tokens to pair\n * @param authAccessToken - A valid access token for the Authorization header\n * @param env - server environment\n * @returns The pair response containing the canonical profile and aliases\n */\nexport async function pairProfiles(\n accessTokens: string[],\n authAccessToken: string,\n env: Env,\n): Promise<PairProfilesResponse> {\n const pairUrl = new URL(PAIR_PROFILES_URL(env));\n\n try {\n const response = await fetch(pairUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${authAccessToken}`,\n },\n body: JSON.stringify({\n jwts: accessTokens,\n }),\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n 'Failed to pair profiles',\n PairError,\n );\n }\n\n const pairResponse: unknown = await response.json();\n validatePairResponse(pairResponse);\n\n return {\n profile: {\n identifierId: pairResponse.profile.identifier_id,\n metaMetricsId: pairResponse.profile.metametrics_id ?? '',\n profileId: pairResponse.profile.profile_id,\n canonicalProfileId: pairResponse.profile.profile_id,\n },\n profileAliases: parseProfileAliases(pairResponse.profile_aliases ?? []),\n };\n } catch (error) {\n return await throwServiceError(error, 'Failed to pair profiles', PairError);\n }\n}\n\n/**\n * Service to Get Nonce for JWT Bearer Flow\n *\n * @param id - identifier ID\n * @param env - server environment\n * @returns the nonce.\n */\nexport async function getNonce(id: string, env: Env): Promise<NonceResponse> {\n const nonceUrl = new URL(NONCE_URL(env));\n nonceUrl.searchParams.set('identifier', id);\n\n try {\n const nonceResponse = await fetch(nonceUrl.toString());\n if (!nonceResponse.ok) {\n return await throwServiceError(\n nonceResponse,\n 'Failed to get nonce',\n NonceRetrievalError,\n );\n }\n\n const nonceJson = await nonceResponse.json();\n return {\n nonce: nonceJson.nonce,\n identifier: nonceJson.identifier,\n expiresIn: nonceJson.expires_in,\n };\n } catch (error) {\n return await throwServiceError(\n error,\n 'Failed to get nonce',\n NonceRetrievalError,\n );\n }\n}\n\n/**\n * Service to Authorize And perform OIDC Flow to get the Access Token\n *\n * @param jwtToken - The original token received from Authentication. This is traded for the Access Token. (the authentication token is single-use)\n * @param env - server environment\n * @param platform - SDK platform\n * @returns Access Token from Authorization server\n */\nexport async function authorizeOIDC(\n jwtToken: string,\n env: Env,\n platform: Platform,\n): Promise<AccessToken> {\n const grantType = 'urn:ietf:params:oauth:grant-type:jwt-bearer';\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n };\n\n const urlEncodedBody = new URLSearchParams();\n urlEncodedBody.append('grant_type', grantType);\n urlEncodedBody.append('client_id', getOidcClientId(env, platform));\n urlEncodedBody.append('assertion', jwtToken);\n\n try {\n const response = await fetch(OIDC_TOKEN_URL(env), {\n method: 'POST',\n headers,\n body: urlEncodedBody.toString(),\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n 'Failed to get access token',\n SignInError,\n );\n }\n\n const accessTokenResponse = await response.json();\n return {\n accessToken: accessTokenResponse.access_token,\n expiresIn: accessTokenResponse.expires_in,\n obtainedAt: Date.now(),\n };\n } catch (error) {\n return await throwServiceError(\n error,\n 'Failed to get access token',\n SignInError,\n );\n }\n}\n\ntype Authentication = {\n token: string;\n expiresIn: number;\n profile: UserProfile;\n profileAliases: ProfileAlias[];\n};\n/**\n * Service to Authenticate/Login a user via SIWE or SRP derived key.\n *\n * @param rawMessage - raw message for validation when authenticating\n * @param signature - signed raw message\n * @param authType - authentication type/flow used\n * @param env - server environment\n * @param metametrics - optional metametrics\n * @param identifierType - login identifier type included in metametrics\n * (defaults to `SRP` when metametrics is present)\n * @returns Authentication Token\n */\nexport async function authenticate(\n rawMessage: string,\n signature: string,\n authType: AuthType,\n env: Env,\n metametrics?: MetaMetricsAuth,\n identifierType: LoginIdentifierType = 'SRP',\n): Promise<Authentication> {\n const authenticationUrl = getAuthenticationUrl(authType, env);\n\n try {\n const response = await fetch(authenticationUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(authType === AuthType.SRP\n ? { 'X-MetaMask-Profile-Pairing': 'enabled' }\n : {}),\n },\n body: JSON.stringify({\n signature,\n raw_message: rawMessage,\n ...(metametrics\n ? {\n metametrics: {\n metametrics_id: await metametrics.getMetaMetricsId(),\n agent: metametrics.agent,\n app_version: await metametrics.getAppVersion?.(),\n identifier_type: identifierType,\n },\n }\n : {}),\n }),\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n `Failed to login with ${authType}`,\n SignInError,\n );\n }\n\n const loginResponse = await response.json();\n\n return {\n token: loginResponse.token,\n expiresIn: loginResponse.expires_in,\n profile: {\n identifierId: loginResponse.profile.identifier_id,\n metaMetricsId: loginResponse.profile.metametrics_id,\n profileId: loginResponse.profile.profile_id,\n canonicalProfileId: loginResponse.profile.profile_id,\n },\n profileAliases: parseProfileAliases(loginResponse.profile_aliases ?? []),\n };\n } catch (error) {\n return await throwServiceError(\n error,\n `Failed to login with ${authType}`,\n SignInError,\n );\n }\n}\n\n/**\n * Service to get the Profile Lineage\n *\n * @param env - server environment\n * @param accessToken - JWT access token used to access protected resources\n * @returns Profile Lineage information.\n */\nexport async function getUserProfileLineage(\n env: Env,\n accessToken: string,\n): Promise<UserProfileLineage> {\n const profileLineageUrl = new URL(PROFILE_LINEAGE_URL(env));\n\n try {\n const response = await fetch(profileLineageUrl, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n 'Failed to get profile lineage',\n SignInError,\n );\n }\n\n const profileJson: UserProfileLineage = await response.json();\n return profileJson;\n } catch (error) {\n return await throwServiceError(\n error,\n 'Failed to get profile lineage',\n SignInError,\n );\n }\n}\n\n/**\n * Service to get a Customer Service specific access token.\n *\n * Exchanges a valid OIDC access token for a short-lived token scoped to the\n * customer-service audience, which Customer Service tooling consumes to\n * identify and authenticate the user.\n *\n * @param env - server environment\n * @param accessToken - JWT access token used to access protected resources\n * @returns The customer-service access token.\n */\nexport async function getCustomerServiceToken(\n env: Env,\n accessToken: string,\n): Promise<string> {\n const customerServiceTokenUrl = new URL(CUSTOMER_SERVICE_TOKEN_URL(env));\n\n try {\n const response = await fetch(customerServiceTokenUrl, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n return await throwServiceError(\n response,\n 'Failed to get customer service token',\n SignInError,\n );\n }\n\n const tokenResponse = await response.json();\n if (typeof tokenResponse?.access_token !== 'string') {\n throw new SignInError(\n 'Failed to get customer service token: missing access_token',\n );\n }\n return tokenResponse.access_token;\n } catch (error) {\n return await throwServiceError(\n error,\n 'Failed to get customer service token',\n SignInError,\n );\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Env, Platform } from
|
|
1
|
+
import type { Env, Platform } from '../../shared/env.js';
|
|
2
2
|
export declare enum AuthType {
|
|
3
3
|
SRP = "SRP",
|
|
4
4
|
SiWE = "SiWE"
|
|
@@ -111,4 +111,4 @@ export type UserProfileLineage = {
|
|
|
111
111
|
counter: number;
|
|
112
112
|
}[];
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=types.d.
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEzD,oBAAY,QAAQ;IAGlB,GAAG,QAAQ;IAGX,IAAI,SAAS;CACd;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;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EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,KAAK,CAAC;IAC/B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,QAAQ,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../../shared/env.js';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP).\n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\n/**\n * Login identifier type sent in the `/srp/login` metametrics object.\n * Defaults to `SRP`; social-backed entropy overrides with the OAuth provider.\n *\n * Orthogonal to {@link SrpLoginTag}: a secondary entropy source can still be\n * `GOOGLE` / `APPLE` / `TELEGRAM` if it is social-backed.\n */\nexport type LoginIdentifierType = 'SRP' | 'GOOGLE' | 'APPLE' | 'TELEGRAM';\n\n/**\n * Tag appended to the SRP login `raw_message` so the auth server can\n * distinguish primary vs secondary SRPs.\n *\n * Message format: `metamask:<nonce>:<pubkey>:<tag>`\n *\n * Orthogonal to {@link LoginIdentifierType}: tag is entropy-slot only.\n */\nexport type SrpLoginTag = 'primary' | 'secondary';\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The original per-SRP profile ID. Immutable after first login.\n * Used for user storage key derivation — MUST NOT be replaced with the canonical.\n */\n profileId: string;\n /**\n * The unified canonical profile ID across all paired SRPs.\n * Set from the server response and updated after pairing via canonical propagation.\n * For pre-upgrade state, defaults to profileId.\n */\n canonicalProfileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\n/**\n * Represents a profile alias returned by the server in profile_aliases.\n * Transient — this is not persisted in LoginResponse or srpSessionData.\n */\nexport type ProfileAlias = {\n aliasProfileId: string;\n canonicalProfileId: string;\n identifierIds: { id: string; type: string }[];\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n // TODO: figure out if these need the entropy source id param or if that can be abstracted on another layer\n getAccessToken: (entropySourceId?: string) => Promise<string>;\n getUserProfile: (entropySourceId?: string) => Promise<UserProfile>;\n getIdentifier: (entropySourceId?: string) => Promise<string>;\n signMessage: (message: string, entropySourceId?: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n // TODO: figure out if these need the entropy source id param or if that can be abstracted on another layer\n getLoginResponse: (entropySourceId?: string) => Promise<LoginResponse | null>;\n setLoginResponse: (\n val: LoginResponse,\n entropySourceId?: string,\n ) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n // TODO: figure out if these need the entropy source id param or if that can be abstracted on another layer\n signMessage: (message: string, entropySourceId?: string) => Promise<string>;\n getIdentifier: (entropySourceId?: string) => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type UserProfileLineage = {\n profile_id: string;\n created_at: string;\n lineage: {\n metametrics_id: string;\n agent: Platform;\n created_at: string;\n updated_at: string;\n counter: number;\n }[];\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Env } from
|
|
1
|
+
import type { Env } from '../../../shared/env.js';
|
|
2
2
|
export declare const IDENTIFIER_SALT: Record<Env, string>;
|
|
3
3
|
/**
|
|
4
4
|
* Computes a deterministic identifier ID by hashing a public key with an
|
|
@@ -10,4 +10,4 @@ export declare const IDENTIFIER_SALT: Record<Env, string>;
|
|
|
10
10
|
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
11
11
|
*/
|
|
12
12
|
export declare function computeIdentifierId(publicKey: string, env: Env): string;
|
|
13
|
-
//# sourceMappingURL=identifier.d.
|
|
13
|
+
//# sourceMappingURL=identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAI/C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAMvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSHA256Hash } from
|
|
1
|
+
import { createSHA256Hash } from '../../../shared/encryption/index.js';
|
|
2
2
|
export const IDENTIFIER_SALT = {
|
|
3
3
|
dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',
|
|
4
4
|
uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',
|
|
@@ -20,4 +20,4 @@ export function computeIdentifierId(publicKey, env) {
|
|
|
20
20
|
}
|
|
21
21
|
return createSHA256Hash(publicKey + salt);
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=identifier.
|
|
23
|
+
//# sourceMappingURL=identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAGvE,MAAM,CAAC,MAAM,eAAe,GAAwB;IAClD,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,GAAQ;IAC7D,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,gBAAgB,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { createSHA256Hash } from '../../../shared/encryption/index.js';\nimport type { Env } from '../../../shared/env.js';\n\nexport const IDENTIFIER_SALT: Record<Env, string> = {\n dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',\n uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',\n prd: 'oCheThi4lohv5choGhuosh1aiT2phioF',\n};\n\n/**\n * Computes a deterministic identifier ID by hashing a public key with an\n * environment-specific salt. Matches the server-side formula:\n * SHA256(publicKey + salt).\n *\n * @param publicKey - The raw SRP public key\n * @param env - The environment whose salt to use\n * @returns The hex-encoded SHA256 hash used as identifier_id\n */\nexport function computeIdentifierId(publicKey: string, env: Env): string {\n const salt = IDENTIFIER_SALT[env];\n if (!salt) {\n throw new Error('Cannot compute identifier ID: invalid environment');\n }\n return createSHA256Hash(publicKey + salt);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,EAAU;IACpC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/**\n * Delays execution for the specified number of milliseconds.\n *\n * @param ms - Number of milliseconds to delay\n * @returns Promise that resolves after the delay\n */\nexport async function delay(ms: number): Promise<void> {\n if (ms <= 0) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, ms));\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Eip1193Provider } from
|
|
2
|
-
import { SIWEJwtBearerAuth } from
|
|
3
|
-
import { SRPJwtBearerAuth } from
|
|
4
|
-
import type { PairProfilesResponse } from
|
|
5
|
-
import type { UserProfile, Pair, UserProfileLineage } from
|
|
1
|
+
import type { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';
|
|
3
|
+
import { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';
|
|
4
|
+
import type { PairProfilesResponse } from './authentication-jwt-bearer/services.js';
|
|
5
|
+
import type { UserProfile, Pair, UserProfileLineage } from './authentication-jwt-bearer/types.js';
|
|
6
6
|
type Compute<T> = T extends infer U ? {
|
|
7
7
|
[K in keyof U]: U[K];
|
|
8
8
|
} : never;
|
|
@@ -32,7 +32,7 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
|
|
|
32
32
|
domain: string;
|
|
33
33
|
}): void;
|
|
34
34
|
}
|
|
35
|
-
export { SIWEJwtBearerAuth } from
|
|
36
|
-
export { SRPJwtBearerAuth } from
|
|
37
|
-
export * from
|
|
38
|
-
//# sourceMappingURL=authentication.d.
|
|
35
|
+
export { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';
|
|
36
|
+
export { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';
|
|
37
|
+
export * from './authentication-jwt-bearer/types.js';
|
|
38
|
+
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAK3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,K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AO,CAAC,oBAAoB,CAAC,CAG/B;IAEK,WAAW,CACf,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;IAEK,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BpD;IAED,OAAO,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAGP;CA2BF;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,cAAc,sCAAsC,CAAC"}
|
|
@@ -10,11 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _JwtBearerAuth_instances, _JwtBearerAuth_type, _JwtBearerAuth_env, _JwtBearerAuth_sdk, _JwtBearerAuth_assertSIWE, _JwtBearerAuth_assertSRP;
|
|
13
|
-
import { SIWEJwtBearerAuth } from
|
|
14
|
-
import { SRPJwtBearerAuth } from
|
|
15
|
-
import { getNonce, pairIdentifiers } from
|
|
16
|
-
import { AuthType } from
|
|
17
|
-
import { PairError, UnsupportedAuthTypeError } from
|
|
13
|
+
import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';
|
|
14
|
+
import { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';
|
|
15
|
+
import { getNonce, pairIdentifiers, } from './authentication-jwt-bearer/services.js';
|
|
16
|
+
import { AuthType } from './authentication-jwt-bearer/types.js';
|
|
17
|
+
import { PairError, UnsupportedAuthTypeError } from './errors.js';
|
|
18
18
|
export class JwtBearerAuth {
|
|
19
19
|
constructor(...args) {
|
|
20
20
|
_JwtBearerAuth_instances.add(this);
|
|
@@ -106,7 +106,7 @@ _JwtBearerAuth_type = new WeakMap(), _JwtBearerAuth_env = new WeakMap(), _JwtBea
|
|
|
106
106
|
}
|
|
107
107
|
throw new UnsupportedAuthTypeError('This method is only available via SRP auth type');
|
|
108
108
|
};
|
|
109
|
-
export { SIWEJwtBearerAuth } from
|
|
110
|
-
export { SRPJwtBearerAuth } from
|
|
111
|
-
export * from
|
|
112
|
-
//# sourceMappingURL=authentication.
|
|
109
|
+
export { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';
|
|
110
|
+
export { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';
|
|
111
|
+
export * from './authentication-jwt-bearer/types.js';
|
|
112
|
+
//# sourceMappingURL=authentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EACL,QAAQ,EACR,eAAe,GAChB,MAAM,yCAAyC,CAAC;AAOjD,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAYlE,MAAM,OAAO,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,M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AAI,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,wBAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,cAAc,sCAAsC,CAAC","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env.js';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services.js';\nimport type { PairProfilesResponse } from './authentication-jwt-bearer/services.js';\nimport type {\n UserProfile,\n Pair,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types.js';\nimport { AuthType } from './authentication-jwt-bearer/types.js';\nimport { PairError, UnsupportedAuthTypeError } from './errors.js';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async getCustomerServiceToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getCustomerServiceToken(entropySourceId);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSrpProfiles(accessTokens, authAccessToken);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nexport * from './authentication-jwt-bearer/types.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;IAC5B,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB,EAAE,GAAG;CACvB,CAAC","sourcesContent":["export const HTTP_STATUS_CODES = {\n TOO_MANY_REQUESTS: 429,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sdk/errors.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,SAAuC;IAEtD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,YAAY,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAIjD;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,gBAAgB,CAQzD;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODES } from
|
|
1
|
+
import { HTTP_STATUS_CODES } from './constants.js';
|
|
2
2
|
export class NonceRetrievalError extends Error {
|
|
3
3
|
constructor(message) {
|
|
4
4
|
super(message);
|
|
@@ -62,4 +62,4 @@ export class RateLimitedError extends Error {
|
|
|
62
62
|
e.status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
//# sourceMappingURL=errors.
|
|
65
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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e,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,WAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC;QAMpD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAU;QAChC,OAAO,CACL,CAAC,YAAY,gBAAgB;YAC7B,CAAC,OAAO,CAAC,KAAK,QAAQ;gBACpB,CAAC,KAAK,IAAI;gBACV,QAAQ,IAAI,CAAC;gBACb,CAAC,CAAC,MAAM,KAAK,iBAAiB,CAAC,iBAAiB,CAAC,CACpD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { HTTP_STATUS_CODES } from './constants.js';\n\nexport class NonceRetrievalError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NonceRetrievalError';\n }\n}\n\nexport class SignInError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SignInError';\n }\n}\n\nexport class PairError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'PairError';\n }\n}\n\nexport class UserStorageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserStorageError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ValidationError';\n }\n}\n\nexport class UnsupportedAuthTypeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedAuthTypeError';\n }\n}\n\nexport class NotFoundError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\nexport class RateLimitedError extends Error {\n readonly status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS;\n\n readonly retryAfterMs?: number;\n\n constructor(message: string, retryAfterMs?: number) {\n super(message);\n this.name = 'RateLimitedError';\n this.retryAfterMs = retryAfterMs;\n }\n\n /**\n * Check if an unknown error is a rate limit error (429 status).\n *\n * @param e - The error to check\n * @returns True if the error is a rate limit error\n */\n static isRateLimitError(e: unknown): e is RateLimitedError {\n return (\n e instanceof RateLimitedError ||\n (typeof e === 'object' &&\n e !== null &&\n 'status' in e &&\n e.status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS)\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './authentication.js';
|
|
2
|
+
export * from './user-storage.js';
|
|
3
|
+
export * from './errors.js';
|
|
4
|
+
export * from './utils/messaging-signing-snap-requests.js';
|
|
5
|
+
export * from '../shared/encryption/index.js';
|
|
6
|
+
export * from '../shared/env.js';
|
|
7
|
+
export * from '../shared/storage-schema.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './authentication.js';
|
|
2
|
+
export * from './user-storage.js';
|
|
3
|
+
export * from './errors.js';
|
|
4
|
+
export * from './utils/messaging-signing-snap-requests.js';
|
|
5
|
+
export * from '../shared/encryption/index.js';
|
|
6
|
+
export * from '../shared/env.js';
|
|
7
|
+
export * from '../shared/storage-schema.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './authentication.js';\nexport * from './user-storage.js';\nexport * from './errors.js';\nexport * from './utils/messaging-signing-snap-requests.js';\nexport * from '../shared/encryption/index.js';\nexport * from '../shared/env.js';\nexport * from '../shared/storage-schema.js';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from
|
|
1
|
+
import { Platform } from '../../shared/env.js';
|
|
2
2
|
export declare const MOCK_NONCE_URL: string;
|
|
3
3
|
export declare const MOCK_SRP_LOGIN_URL: string;
|
|
4
4
|
export declare const MOCK_OIDC_TOKEN_URL: string;
|
|
@@ -66,4 +66,4 @@ export declare const MOCK_USER_PROFILE_LINEAGE_RESPONSE: {
|
|
|
66
66
|
counter: number;
|
|
67
67
|
}[];
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=auth.d.
|
|
69
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAYpD,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AACnE,eAAO,MAAM,sBAAsB,QAA6B,CAAC;AACjE,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AACrE,eAAO,MAAM,+BAA+B,QAE3C,CAAC;AAEF,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,sLACyJ,CAAC;AAEtL,eAAO,MAAM,mBAAmB;IAC9B,KAAK;IACL,UAAU;IACV,UAAU;CACX,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;QAIjC,UAAU;QACV,cAAc;QACd,aAAa;QAEb,eAAe;QACf,qBAAqB;;CAExB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;QAIhC,UAAU;QACV,cAAc;QACd,aAAa;QAEb,eAAe;QACf,qBAAqB;;;CAGxB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;CAKhD,CAAC;AAEF,eAAO,MAAM,2BAA2B;IACtC,OAAO;QACL,aAAa;QACb,cAAc;QACd,UAAU;;IAEZ,eAAe;CAChB,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;CAmB9C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Env, Platform } from
|
|
2
|
-
import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS, PAIR_PROFILES_URL, PROFILE_LINEAGE_URL, CUSTOMER_SERVICE_TOKEN_URL } from
|
|
1
|
+
import { Env, Platform } from '../../shared/env.js';
|
|
2
|
+
import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS, PAIR_PROFILES_URL, PROFILE_LINEAGE_URL, CUSTOMER_SERVICE_TOKEN_URL, } from '../authentication-jwt-bearer/services.js';
|
|
3
3
|
export const MOCK_NONCE_URL = NONCE_URL(Env.PRD);
|
|
4
4
|
export const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);
|
|
5
5
|
export const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);
|
|
@@ -76,4 +76,4 @@ export const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {
|
|
|
76
76
|
},
|
|
77
77
|
],
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=auth.
|
|
79
|
+
//# sourceMappingURL=auth.js.map
|