@metamask-previews/profile-sync-controller 29.0.0-preview-3e34650c2 → 29.0.0-preview-4f4c98e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/controllers/authentication/{AuthenticationController-method-action-types.d.mts → AuthenticationController-method-action-types.d.ts} +2 -2
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController-method-action-types.mjs → AuthenticationController-method-action-types.js} +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController.d.mts → AuthenticationController.d.ts} +10 -10
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -0
- package/dist/controllers/authentication/{AuthenticationController.mjs → AuthenticationController.js} +11 -11
- package/dist/controllers/authentication/AuthenticationController.js.map +1 -0
- package/dist/controllers/authentication/{index.d.cts → index.d.ts} +5 -5
- package/dist/controllers/authentication/index.d.ts.map +1 -0
- package/dist/controllers/authentication/index.js +6 -0
- package/dist/controllers/authentication/index.js.map +1 -0
- package/dist/controllers/authentication/mocks/index.d.ts +2 -0
- package/dist/controllers/authentication/mocks/index.d.ts.map +1 -0
- package/dist/controllers/authentication/mocks/index.js +2 -0
- package/dist/controllers/authentication/mocks/index.js.map +1 -0
- package/dist/controllers/authentication/mocks/{mockResponses.d.mts → mockResponses.d.ts} +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +1 -0
- package/dist/controllers/authentication/mocks/{mockResponses.mjs → mockResponses.js} +2 -2
- package/dist/controllers/authentication/mocks/mockResponses.js.map +1 -0
- package/dist/controllers/index.d.ts +3 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/index.js +3 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController-method-action-types.d.mts → UserStorageController-method-action-types.d.ts} +2 -2
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.ts.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController-method-action-types.mjs → UserStorageController-method-action-types.js} +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.js.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController.d.cts → UserStorageController.d.ts} +14 -14
- package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -0
- package/dist/controllers/user-storage/{UserStorageController.mjs → UserStorageController.js} +15 -15
- package/dist/controllers/user-storage/UserStorageController.js.map +1 -0
- package/dist/controllers/user-storage/constants.d.ts +15 -0
- package/dist/controllers/user-storage/constants.d.ts.map +1 -0
- package/dist/controllers/user-storage/{constants.mjs → constants.js} +1 -1
- package/dist/controllers/user-storage/constants.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{constants.d.cts → constants.d.ts} +1 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{constants.mjs → constants.js} +1 -1
- package/dist/controllers/user-storage/contact-syncing/constants.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{controller-integration.d.cts → controller-integration.d.ts} +3 -3
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{controller-integration.mjs → controller-integration.js} +6 -6
- package/dist/controllers/user-storage/contact-syncing/controller-integration.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.d.cts → setup-subscriptions.d.ts} +2 -2
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.mjs → setup-subscriptions.js} +4 -4
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{sync-utils.d.cts → sync-utils.d.ts} +2 -2
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{sync-utils.mjs → sync-utils.js} +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{types.d.cts → types.d.ts} +6 -6
- package/dist/controllers/user-storage/contact-syncing/types.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/types.js +2 -0
- package/dist/controllers/user-storage/contact-syncing/types.js.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{utils.d.mts → utils.d.ts} +3 -3
- package/dist/controllers/user-storage/contact-syncing/utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/contact-syncing/{utils.mjs → utils.js} +2 -2
- package/dist/controllers/user-storage/contact-syncing/utils.js.map +1 -0
- package/dist/controllers/user-storage/{index.d.cts → index.d.ts} +8 -8
- package/dist/controllers/user-storage/index.d.ts.map +1 -0
- package/dist/controllers/user-storage/index.js +9 -0
- package/dist/controllers/user-storage/index.js.map +1 -0
- package/dist/controllers/user-storage/mocks/index.d.ts +3 -0
- package/dist/controllers/user-storage/mocks/index.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/index.js +3 -0
- package/dist/controllers/user-storage/mocks/index.js.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockResponses.d.mts → mockResponses.d.ts} +3 -3
- package/dist/controllers/user-storage/mocks/mockResponses.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockResponses.mjs → mockResponses.js} +4 -4
- package/dist/controllers/user-storage/mocks/mockResponses.js.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockStorage.d.cts → mockStorage.d.ts} +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.ts.map +1 -0
- package/dist/controllers/user-storage/mocks/{mockStorage.mjs → mockStorage.js} +2 -2
- package/dist/controllers/user-storage/mocks/mockStorage.js.map +1 -0
- package/dist/controllers/user-storage/{types.d.cts → types.d.ts} +3 -3
- package/dist/controllers/user-storage/types.d.ts.map +1 -0
- package/dist/controllers/user-storage/types.js +2 -0
- package/dist/controllers/user-storage/types.js.map +1 -0
- package/dist/controllers/user-storage/{utils.d.cts → utils.d.ts} +1 -1
- package/dist/controllers/user-storage/utils.d.ts.map +1 -0
- package/dist/controllers/user-storage/{utils.mjs → utils.js} +1 -1
- package/dist/controllers/user-storage/utils.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-siwe.d.cts → flow-siwe.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-siwe.mjs → flow-siwe.js} +5 -5
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-srp.d.cts → flow-srp.d.ts} +5 -5
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{flow-srp.mjs → flow-srp.js} +8 -8
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{services.d.cts → services.d.ts} +5 -5
- package/dist/sdk/authentication-jwt-bearer/services.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{services.mjs → services.js} +6 -6
- package/dist/sdk/authentication-jwt-bearer/services.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{types.d.cts → types.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/types.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/{types.mjs → types.js} +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{identifier.d.cts → identifier.d.ts} +2 -2
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{identifier.mjs → identifier.js} +2 -2
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.js.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{time.d.cts → time.d.ts} +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.ts.map +1 -0
- package/dist/sdk/authentication-jwt-bearer/utils/{time.mjs → time.js} +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.js.map +1 -0
- package/dist/sdk/{authentication.d.cts → authentication.d.ts} +9 -9
- package/dist/sdk/authentication.d.ts.map +1 -0
- package/dist/sdk/{authentication.mjs → authentication.js} +9 -9
- package/dist/sdk/authentication.js.map +1 -0
- package/dist/sdk/{constants.d.cts → constants.d.ts} +1 -1
- package/dist/sdk/constants.d.ts.map +1 -0
- package/dist/sdk/{constants.mjs → constants.js} +1 -1
- package/dist/sdk/constants.js.map +1 -0
- package/dist/sdk/{errors.d.cts → errors.d.ts} +1 -1
- package/dist/sdk/errors.d.ts.map +1 -0
- package/dist/sdk/{errors.mjs → errors.js} +2 -2
- package/dist/sdk/errors.js.map +1 -0
- package/dist/sdk/index.d.ts +8 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +8 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/mocks/{auth.d.cts → auth.d.ts} +2 -2
- package/dist/sdk/mocks/auth.d.ts.map +1 -0
- package/dist/sdk/mocks/{auth.mjs → auth.js} +3 -3
- package/dist/sdk/mocks/auth.js.map +1 -0
- package/dist/sdk/mocks/{userstorage.d.cts → userstorage.d.ts} +1 -1
- package/dist/sdk/mocks/userstorage.d.ts.map +1 -0
- package/dist/sdk/mocks/{userstorage.mjs → userstorage.js} +5 -5
- package/dist/sdk/mocks/userstorage.js.map +1 -0
- package/dist/sdk/{user-storage.d.mts → user-storage.d.ts} +5 -5
- package/dist/sdk/user-storage.d.ts.map +1 -0
- package/dist/sdk/{user-storage.mjs → user-storage.js} +6 -6
- package/dist/sdk/user-storage.js.map +1 -0
- package/dist/sdk/utils/{eip-6963-metamask-provider.d.cts → eip-6963-metamask-provider.d.ts} +2 -2
- package/dist/sdk/utils/eip-6963-metamask-provider.d.ts.map +1 -0
- package/dist/sdk/utils/{eip-6963-metamask-provider.mjs → eip-6963-metamask-provider.js} +1 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.js.map +1 -0
- package/dist/sdk/utils/{messaging-signing-snap-requests.d.cts → messaging-signing-snap-requests.d.ts} +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.ts.map +1 -0
- package/dist/sdk/utils/{messaging-signing-snap-requests.mjs → messaging-signing-snap-requests.js} +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.js.map +1 -0
- package/dist/sdk/utils/{validate-login-response.d.mts → validate-login-response.d.ts} +2 -2
- package/dist/sdk/utils/validate-login-response.d.ts.map +1 -0
- package/dist/sdk/utils/{validate-login-response.mjs → validate-login-response.js} +1 -1
- package/dist/sdk/utils/validate-login-response.js.map +1 -0
- package/dist/sdk/utils/{validate-pair-response.d.cts → validate-pair-response.d.ts} +1 -1
- package/dist/sdk/utils/validate-pair-response.d.ts.map +1 -0
- package/dist/sdk/utils/{validate-pair-response.mjs → validate-pair-response.js} +1 -1
- package/dist/sdk/utils/validate-pair-response.js.map +1 -0
- package/dist/shared/encryption/{cache.d.cts → cache.d.ts} +1 -1
- package/dist/shared/encryption/cache.d.ts.map +1 -0
- package/dist/shared/encryption/{cache.mjs → cache.js} +3 -3
- package/dist/shared/encryption/cache.js.map +1 -0
- package/dist/shared/encryption/{constants.d.cts → constants.d.ts} +2 -2
- package/dist/shared/encryption/constants.d.ts.map +1 -0
- package/dist/shared/encryption/{constants.mjs → constants.js} +1 -1
- package/dist/shared/encryption/constants.js.map +1 -0
- package/dist/shared/encryption/{encryption.d.cts → encryption.d.ts} +3 -3
- package/dist/shared/encryption/encryption.d.ts.map +1 -0
- package/dist/shared/encryption/{encryption.mjs → encryption.js} +9 -9
- package/dist/shared/encryption/encryption.js.map +1 -0
- package/dist/shared/encryption/index.d.ts +5 -0
- package/dist/shared/encryption/index.d.ts.map +1 -0
- package/dist/shared/encryption/index.js +5 -0
- package/dist/shared/encryption/index.js.map +1 -0
- package/dist/shared/encryption/{utils.d.cts → utils.d.ts} +3 -3
- package/dist/shared/encryption/utils.d.ts.map +1 -0
- package/dist/shared/encryption/{utils.mjs → utils.js} +1 -1
- package/dist/shared/encryption/utils.js.map +1 -0
- package/dist/shared/{env.d.cts → env.d.ts} +1 -1
- package/dist/shared/env.d.ts.map +1 -0
- package/dist/shared/{env.mjs → env.js} +1 -1
- package/dist/shared/env.js.map +1 -0
- package/dist/shared/{storage-schema.d.mts → storage-schema.d.ts} +1 -1
- package/dist/shared/storage-schema.d.ts.map +1 -0
- package/dist/shared/{storage-schema.mjs → storage-schema.js} +2 -2
- package/dist/shared/storage-schema.js.map +1 -0
- package/dist/shared/types/{encryption.d.cts → encryption.d.ts} +1 -1
- package/dist/shared/types/encryption.d.ts.map +1 -0
- package/dist/shared/types/encryption.js +2 -0
- package/dist/shared/types/encryption.js.map +1 -0
- package/dist/shared/types/{services.d.cts → services.d.ts} +2 -2
- package/dist/shared/types/services.d.ts.map +1 -0
- package/dist/shared/types/services.js +2 -0
- package/dist/shared/types/services.js.map +1 -0
- package/dist/shared/utils/{entropy-source.d.cts → entropy-source.d.ts} +2 -2
- package/dist/shared/utils/entropy-source.d.ts.map +1 -0
- package/dist/shared/utils/{entropy-source.mjs → entropy-source.js} +2 -2
- package/dist/shared/utils/entropy-source.js.map +1 -0
- package/dist/shared/utils/{event-queue.d.cts → event-queue.d.ts} +1 -1
- package/dist/shared/utils/event-queue.d.ts.map +1 -0
- package/dist/shared/utils/{event-queue.mjs → event-queue.js} +1 -1
- package/dist/shared/utils/event-queue.js.map +1 -0
- package/dist/shared/utils/{hd-keyring-seed.d.mts → hd-keyring-seed.d.ts} +3 -3
- package/dist/shared/utils/hd-keyring-seed.d.ts.map +1 -0
- package/dist/shared/utils/{hd-keyring-seed.mjs → hd-keyring-seed.js} +1 -1
- package/dist/shared/utils/hd-keyring-seed.js.map +1 -0
- package/dist/shared/utils/{message-signing.d.mts → message-signing.d.ts} +1 -1
- package/dist/shared/utils/message-signing.d.ts.map +1 -0
- package/dist/shared/utils/{message-signing.mjs → message-signing.js} +7 -7
- package/dist/shared/utils/message-signing.js.map +1 -0
- package/package.json +22 -56
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs +0 -7
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +0 -102
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.cjs +0 -489
- package/dist/controllers/authentication/AuthenticationController.cjs.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +0 -130
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +0 -1
- package/dist/controllers/authentication/AuthenticationController.mjs.map +0 -1
- package/dist/controllers/authentication/index.cjs +0 -35
- package/dist/controllers/authentication/index.cjs.map +0 -1
- package/dist/controllers/authentication/index.d.cts.map +0 -1
- package/dist/controllers/authentication/index.d.mts +0 -7
- package/dist/controllers/authentication/index.d.mts.map +0 -1
- package/dist/controllers/authentication/index.mjs +0 -6
- package/dist/controllers/authentication/index.mjs.map +0 -1
- package/dist/controllers/authentication/mocks/index.cjs +0 -18
- package/dist/controllers/authentication/mocks/index.cjs.map +0 -1
- package/dist/controllers/authentication/mocks/index.d.cts +0 -2
- package/dist/controllers/authentication/mocks/index.d.cts.map +0 -1
- package/dist/controllers/authentication/mocks/index.d.mts +0 -2
- package/dist/controllers/authentication/mocks/index.d.mts.map +0 -1
- package/dist/controllers/authentication/mocks/index.mjs +0 -2
- package/dist/controllers/authentication/mocks/index.mjs.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.cjs +0 -126
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +0 -58
- package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +0 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +0 -1
- package/dist/controllers/index.cjs +0 -29
- package/dist/controllers/index.cjs.map +0 -1
- package/dist/controllers/index.d.cts +0 -3
- package/dist/controllers/index.d.cts.map +0 -1
- package/dist/controllers/index.d.mts +0 -3
- package/dist/controllers/index.d.mts.map +0 -1
- package/dist/controllers/index.mjs +0 -3
- package/dist/controllers/index.mjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs +0 -7
- package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts +0 -137
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +0 -412
- package/dist/controllers/user-storage/UserStorageController.cjs.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +0 -182
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +0 -1
- package/dist/controllers/user-storage/UserStorageController.mjs.map +0 -1
- package/dist/controllers/user-storage/constants.cjs +0 -19
- package/dist/controllers/user-storage/constants.cjs.map +0 -1
- package/dist/controllers/user-storage/constants.d.cts +0 -15
- package/dist/controllers/user-storage/constants.d.cts.map +0 -1
- package/dist/controllers/user-storage/constants.d.mts +0 -15
- package/dist/controllers/user-storage/constants.d.mts.map +0 -1
- package/dist/controllers/user-storage/constants.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.cjs +0 -12
- package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts +0 -9
- package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +0 -346
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +0 -47
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +0 -50
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +0 -8
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +0 -23
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +0 -9
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.cjs +0 -3
- package/dist/controllers/user-storage/contact-syncing/types.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.mts +0 -37
- package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/types.mjs +0 -2
- package/dist/controllers/user-storage/contact-syncing/types.mjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.cjs +0 -64
- package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts +0 -36
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +0 -1
- package/dist/controllers/user-storage/index.cjs +0 -38
- package/dist/controllers/user-storage/index.cjs.map +0 -1
- package/dist/controllers/user-storage/index.d.cts.map +0 -1
- package/dist/controllers/user-storage/index.d.mts +0 -10
- package/dist/controllers/user-storage/index.d.mts.map +0 -1
- package/dist/controllers/user-storage/index.mjs +0 -9
- package/dist/controllers/user-storage/index.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/index.cjs +0 -19
- package/dist/controllers/user-storage/mocks/index.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/index.d.cts +0 -3
- package/dist/controllers/user-storage/mocks/index.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/index.d.mts +0 -3
- package/dist/controllers/user-storage/mocks/index.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/index.mjs +0 -3
- package/dist/controllers/user-storage/mocks/index.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.cjs +0 -113
- package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.cts +0 -66
- package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.cjs +0 -36
- package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.mts +0 -5
- package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +0 -1
- package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +0 -1
- package/dist/controllers/user-storage/types.cjs +0 -3
- package/dist/controllers/user-storage/types.cjs.map +0 -1
- package/dist/controllers/user-storage/types.d.cts.map +0 -1
- package/dist/controllers/user-storage/types.d.mts +0 -23
- package/dist/controllers/user-storage/types.d.mts.map +0 -1
- package/dist/controllers/user-storage/types.mjs +0 -2
- package/dist/controllers/user-storage/types.mjs.map +0 -1
- package/dist/controllers/user-storage/utils.cjs +0 -32
- package/dist/controllers/user-storage/utils.cjs.map +0 -1
- package/dist/controllers/user-storage/utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/utils.d.mts +0 -19
- package/dist/controllers/user-storage/utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/utils.mjs.map +0 -1
- package/dist/index.cjs +0 -30
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -4
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +0 -114
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +0 -25
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +0 -290
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +0 -44
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +0 -400
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts +0 -105
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs +0 -12
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +0 -114
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +0 -27
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +0 -13
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.cjs +0 -17
- package/dist/sdk/authentication-jwt-bearer/utils/time.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts +0 -8
- package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/time.mjs.map +0 -1
- package/dist/sdk/authentication.cjs +0 -132
- package/dist/sdk/authentication.cjs.map +0 -1
- package/dist/sdk/authentication.d.cts.map +0 -1
- package/dist/sdk/authentication.d.mts +0 -38
- package/dist/sdk/authentication.d.mts.map +0 -1
- package/dist/sdk/authentication.mjs.map +0 -1
- package/dist/sdk/constants.cjs +0 -7
- package/dist/sdk/constants.cjs.map +0 -1
- package/dist/sdk/constants.d.cts.map +0 -1
- package/dist/sdk/constants.d.mts +0 -4
- package/dist/sdk/constants.d.mts.map +0 -1
- package/dist/sdk/constants.mjs.map +0 -1
- package/dist/sdk/errors.cjs +0 -76
- package/dist/sdk/errors.cjs.map +0 -1
- package/dist/sdk/errors.d.cts.map +0 -1
- package/dist/sdk/errors.d.mts +0 -34
- package/dist/sdk/errors.d.mts.map +0 -1
- package/dist/sdk/errors.mjs.map +0 -1
- package/dist/sdk/index.cjs +0 -24
- package/dist/sdk/index.cjs.map +0 -1
- package/dist/sdk/index.d.cts +0 -8
- package/dist/sdk/index.d.cts.map +0 -1
- package/dist/sdk/index.d.mts +0 -8
- package/dist/sdk/index.d.mts.map +0 -1
- package/dist/sdk/index.mjs +0 -8
- package/dist/sdk/index.mjs.map +0 -1
- package/dist/sdk/mocks/auth.cjs +0 -82
- package/dist/sdk/mocks/auth.cjs.map +0 -1
- package/dist/sdk/mocks/auth.d.cts.map +0 -1
- package/dist/sdk/mocks/auth.d.mts +0 -69
- package/dist/sdk/mocks/auth.d.mts.map +0 -1
- package/dist/sdk/mocks/auth.mjs.map +0 -1
- package/dist/sdk/mocks/userstorage.cjs +0 -43
- package/dist/sdk/mocks/userstorage.cjs.map +0 -1
- package/dist/sdk/mocks/userstorage.d.cts.map +0 -1
- package/dist/sdk/mocks/userstorage.d.mts +0 -10
- package/dist/sdk/mocks/userstorage.d.mts.map +0 -1
- package/dist/sdk/mocks/userstorage.mjs.map +0 -1
- package/dist/sdk/user-storage.cjs +0 -386
- package/dist/sdk/user-storage.cjs.map +0 -1
- package/dist/sdk/user-storage.d.cts +0 -47
- package/dist/sdk/user-storage.d.cts.map +0 -1
- package/dist/sdk/user-storage.d.mts.map +0 -1
- package/dist/sdk/user-storage.mjs.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.cjs +0 -70
- package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +0 -25
- package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +0 -1
- package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs +0 -96
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +0 -41
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +0 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +0 -1
- package/dist/sdk/utils/validate-login-response.cjs +0 -49
- package/dist/sdk/utils/validate-login-response.cjs.map +0 -1
- package/dist/sdk/utils/validate-login-response.d.cts +0 -14
- package/dist/sdk/utils/validate-login-response.d.cts.map +0 -1
- package/dist/sdk/utils/validate-login-response.d.mts.map +0 -1
- package/dist/sdk/utils/validate-login-response.mjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.cjs +0 -29
- package/dist/sdk/utils/validate-pair-response.cjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.cts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.mts +0 -26
- package/dist/sdk/utils/validate-pair-response.d.mts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.mjs.map +0 -1
- package/dist/shared/encryption/cache.cjs +0 -77
- package/dist/shared/encryption/cache.cjs.map +0 -1
- package/dist/shared/encryption/cache.d.cts.map +0 -1
- package/dist/shared/encryption/cache.d.mts +0 -32
- package/dist/shared/encryption/cache.d.mts.map +0 -1
- package/dist/shared/encryption/cache.mjs.map +0 -1
- package/dist/shared/encryption/constants.cjs +0 -17
- package/dist/shared/encryption/constants.cjs.map +0 -1
- package/dist/shared/encryption/constants.d.cts.map +0 -1
- package/dist/shared/encryption/constants.d.mts +0 -9
- package/dist/shared/encryption/constants.d.mts.map +0 -1
- package/dist/shared/encryption/constants.mjs.map +0 -1
- package/dist/shared/encryption/encryption.cjs +0 -209
- package/dist/shared/encryption/encryption.cjs.map +0 -1
- package/dist/shared/encryption/encryption.d.cts.map +0 -1
- package/dist/shared/encryption/encryption.d.mts +0 -30
- package/dist/shared/encryption/encryption.d.mts.map +0 -1
- package/dist/shared/encryption/encryption.mjs.map +0 -1
- package/dist/shared/encryption/index.cjs +0 -25
- package/dist/shared/encryption/index.cjs.map +0 -1
- package/dist/shared/encryption/index.d.cts +0 -5
- package/dist/shared/encryption/index.d.cts.map +0 -1
- package/dist/shared/encryption/index.d.mts +0 -5
- package/dist/shared/encryption/index.d.mts.map +0 -1
- package/dist/shared/encryption/index.mjs +0 -5
- package/dist/shared/encryption/index.mjs.map +0 -1
- package/dist/shared/encryption/utils.cjs +0 -21
- package/dist/shared/encryption/utils.cjs.map +0 -1
- package/dist/shared/encryption/utils.d.cts.map +0 -1
- package/dist/shared/encryption/utils.d.mts +0 -5
- package/dist/shared/encryption/utils.d.mts.map +0 -1
- package/dist/shared/encryption/utils.mjs.map +0 -1
- package/dist/shared/env.cjs +0 -85
- package/dist/shared/env.cjs.map +0 -1
- package/dist/shared/env.d.cts.map +0 -1
- package/dist/shared/env.d.mts +0 -34
- package/dist/shared/env.d.mts.map +0 -1
- package/dist/shared/env.mjs.map +0 -1
- package/dist/shared/storage-schema.cjs +0 -42
- package/dist/shared/storage-schema.cjs.map +0 -1
- package/dist/shared/storage-schema.d.cts +0 -34
- package/dist/shared/storage-schema.d.cts.map +0 -1
- package/dist/shared/storage-schema.d.mts.map +0 -1
- package/dist/shared/storage-schema.mjs.map +0 -1
- package/dist/shared/types/encryption.cjs +0 -3
- package/dist/shared/types/encryption.cjs.map +0 -1
- package/dist/shared/types/encryption.d.cts.map +0 -1
- package/dist/shared/types/encryption.d.mts +0 -2
- package/dist/shared/types/encryption.d.mts.map +0 -1
- package/dist/shared/types/encryption.mjs +0 -2
- package/dist/shared/types/encryption.mjs.map +0 -1
- package/dist/shared/types/services.cjs +0 -3
- package/dist/shared/types/services.cjs.map +0 -1
- package/dist/shared/types/services.d.cts.map +0 -1
- package/dist/shared/types/services.d.mts +0 -17
- package/dist/shared/types/services.d.mts.map +0 -1
- package/dist/shared/types/services.mjs +0 -2
- package/dist/shared/types/services.mjs.map +0 -1
- package/dist/shared/utils/entropy-source.cjs +0 -37
- package/dist/shared/utils/entropy-source.cjs.map +0 -1
- package/dist/shared/utils/entropy-source.d.cts.map +0 -1
- package/dist/shared/utils/entropy-source.d.mts +0 -22
- package/dist/shared/utils/entropy-source.d.mts.map +0 -1
- package/dist/shared/utils/entropy-source.mjs.map +0 -1
- package/dist/shared/utils/event-queue.cjs +0 -24
- package/dist/shared/utils/event-queue.cjs.map +0 -1
- package/dist/shared/utils/event-queue.d.cts.map +0 -1
- package/dist/shared/utils/event-queue.d.mts +0 -6
- package/dist/shared/utils/event-queue.d.mts.map +0 -1
- package/dist/shared/utils/event-queue.mjs.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.cjs +0 -49
- package/dist/shared/utils/hd-keyring-seed.cjs.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.d.cts +0 -27
- package/dist/shared/utils/hd-keyring-seed.d.cts.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.d.mts.map +0 -1
- package/dist/shared/utils/hd-keyring-seed.mjs.map +0 -1
- package/dist/shared/utils/message-signing.cjs +0 -147
- package/dist/shared/utils/message-signing.cjs.map +0 -1
- package/dist/shared/utils/message-signing.d.cts +0 -73
- package/dist/shared/utils/message-signing.d.cts.map +0 -1
- package/dist/shared/utils/message-signing.d.mts.map +0 -1
- package/dist/shared/utils/message-signing.mjs.map +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthType = void 0;
|
|
4
|
-
var AuthType;
|
|
5
|
-
(function (AuthType) {
|
|
6
|
-
/* sign in using a private key derived from your secret recovery phrase (SRP).
|
|
7
|
-
Uses message signing snap to perform this operation */
|
|
8
|
-
AuthType["SRP"] = "SRP";
|
|
9
|
-
/* sign in with Ethereum */
|
|
10
|
-
AuthType["SiWE"] = "SiWE";
|
|
11
|
-
})(AuthType || (exports.AuthType = AuthType = {}));
|
|
12
|
-
//# sourceMappingURL=types.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,wBAAR,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,6BAA4B;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;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AAC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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"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { Env, Platform } from "../../shared/env.mjs";
|
|
2
|
-
export declare enum AuthType {
|
|
3
|
-
SRP = "SRP",
|
|
4
|
-
SiWE = "SiWE"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Login identifier type sent in the `/srp/login` metametrics object.
|
|
8
|
-
* Defaults to `SRP`; social-backed entropy overrides with the OAuth provider.
|
|
9
|
-
*
|
|
10
|
-
* Orthogonal to {@link SrpLoginTag}: a secondary entropy source can still be
|
|
11
|
-
* `GOOGLE` / `APPLE` / `TELEGRAM` if it is social-backed.
|
|
12
|
-
*/
|
|
13
|
-
export type LoginIdentifierType = 'SRP' | 'GOOGLE' | 'APPLE' | 'TELEGRAM';
|
|
14
|
-
/**
|
|
15
|
-
* Tag appended to the SRP login `raw_message` so the auth server can
|
|
16
|
-
* distinguish primary vs secondary SRPs.
|
|
17
|
-
*
|
|
18
|
-
* Message format: `metamask:<nonce>:<pubkey>:<tag>`
|
|
19
|
-
*
|
|
20
|
-
* Orthogonal to {@link LoginIdentifierType}: tag is entropy-slot only.
|
|
21
|
-
*/
|
|
22
|
-
export type SrpLoginTag = 'primary' | 'secondary';
|
|
23
|
-
export type AuthConfig = {
|
|
24
|
-
env: Env;
|
|
25
|
-
platform: Platform;
|
|
26
|
-
type: AuthType;
|
|
27
|
-
};
|
|
28
|
-
export type AccessToken = {
|
|
29
|
-
/**
|
|
30
|
-
* The JWT Access Token
|
|
31
|
-
*/
|
|
32
|
-
accessToken: string;
|
|
33
|
-
/**
|
|
34
|
-
* Expiration in seconds
|
|
35
|
-
*/
|
|
36
|
-
expiresIn: number;
|
|
37
|
-
/**
|
|
38
|
-
* Date in milliseconds
|
|
39
|
-
*/
|
|
40
|
-
obtainedAt: number;
|
|
41
|
-
};
|
|
42
|
-
export type UserProfile = {
|
|
43
|
-
/**
|
|
44
|
-
* The "Identifier" used to log in with.
|
|
45
|
-
*/
|
|
46
|
-
identifierId: string;
|
|
47
|
-
/**
|
|
48
|
-
* The original per-SRP profile ID. Immutable after first login.
|
|
49
|
-
* Used for user storage key derivation — MUST NOT be replaced with the canonical.
|
|
50
|
-
*/
|
|
51
|
-
profileId: string;
|
|
52
|
-
/**
|
|
53
|
-
* The unified canonical profile ID across all paired SRPs.
|
|
54
|
-
* Set from the server response and updated after pairing via canonical propagation.
|
|
55
|
-
* For pre-upgrade state, defaults to profileId.
|
|
56
|
-
*/
|
|
57
|
-
canonicalProfileId: string;
|
|
58
|
-
/**
|
|
59
|
-
* Server MetaMetrics ID. Allows grouping of user events cross platform.
|
|
60
|
-
*/
|
|
61
|
-
metaMetricsId: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Represents a profile alias returned by the server in profile_aliases.
|
|
65
|
-
* Transient — this is not persisted in LoginResponse or srpSessionData.
|
|
66
|
-
*/
|
|
67
|
-
export type ProfileAlias = {
|
|
68
|
-
aliasProfileId: string;
|
|
69
|
-
canonicalProfileId: string;
|
|
70
|
-
identifierIds: {
|
|
71
|
-
id: string;
|
|
72
|
-
type: string;
|
|
73
|
-
}[];
|
|
74
|
-
};
|
|
75
|
-
export type LoginResponse = {
|
|
76
|
-
token: AccessToken;
|
|
77
|
-
profile: UserProfile;
|
|
78
|
-
};
|
|
79
|
-
export type IBaseAuth = {
|
|
80
|
-
getAccessToken: (entropySourceId?: string) => Promise<string>;
|
|
81
|
-
getUserProfile: (entropySourceId?: string) => Promise<UserProfile>;
|
|
82
|
-
getIdentifier: (entropySourceId?: string) => Promise<string>;
|
|
83
|
-
signMessage: (message: string, entropySourceId?: string) => Promise<string>;
|
|
84
|
-
};
|
|
85
|
-
export type AuthStorageOptions = {
|
|
86
|
-
getLoginResponse: (entropySourceId?: string) => Promise<LoginResponse | null>;
|
|
87
|
-
setLoginResponse: (val: LoginResponse, entropySourceId?: string) => Promise<void>;
|
|
88
|
-
};
|
|
89
|
-
export type AuthSigningOptions = {
|
|
90
|
-
signMessage: (message: string, entropySourceId?: string) => Promise<string>;
|
|
91
|
-
getIdentifier: (entropySourceId?: string) => Promise<string>;
|
|
92
|
-
};
|
|
93
|
-
export type ErrorMessage = {
|
|
94
|
-
message: string;
|
|
95
|
-
error: string;
|
|
96
|
-
};
|
|
97
|
-
export type Pair = {
|
|
98
|
-
identifier: string;
|
|
99
|
-
encryptedStorageKey: string;
|
|
100
|
-
identifierType: 'SIWE' | 'SRP';
|
|
101
|
-
signMessage: (message: string) => Promise<string>;
|
|
102
|
-
};
|
|
103
|
-
export type UserProfileLineage = {
|
|
104
|
-
profile_id: string;
|
|
105
|
-
created_at: string;
|
|
106
|
-
lineage: {
|
|
107
|
-
metametrics_id: string;
|
|
108
|
-
agent: Platform;
|
|
109
|
-
created_at: string;
|
|
110
|
-
updated_at: string;
|
|
111
|
-
counter: number;
|
|
112
|
-
}[];
|
|
113
|
-
};
|
|
114
|
-
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRo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AAU,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","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,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computeIdentifierId = exports.IDENTIFIER_SALT = void 0;
|
|
4
|
-
const index_js_1 = require("../../../shared/encryption/index.cjs");
|
|
5
|
-
exports.IDENTIFIER_SALT = {
|
|
6
|
-
dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',
|
|
7
|
-
uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',
|
|
8
|
-
prd: 'oCheThi4lohv5choGhuosh1aiT2phioF',
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Computes a deterministic identifier ID by hashing a public key with an
|
|
12
|
-
* environment-specific salt. Matches the server-side formula:
|
|
13
|
-
* SHA256(publicKey + salt).
|
|
14
|
-
*
|
|
15
|
-
* @param publicKey - The raw SRP public key
|
|
16
|
-
* @param env - The environment whose salt to use
|
|
17
|
-
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
18
|
-
*/
|
|
19
|
-
function computeIdentifierId(publicKey, env) {
|
|
20
|
-
const salt = exports.IDENTIFIER_SALT[env];
|
|
21
|
-
if (!salt) {
|
|
22
|
-
throw new Error('Cannot compute identifier ID: invalid environment');
|
|
23
|
-
}
|
|
24
|
-
return (0, index_js_1.createSHA256Hash)(publicKey + salt);
|
|
25
|
-
}
|
|
26
|
-
exports.computeIdentifierId = computeIdentifierId;
|
|
27
|
-
//# sourceMappingURL=identifier.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.cjs","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":";;;AAAA,mEAAuE;AAG1D,QAAA,eAAe,GAAwB;IAClD,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,SAAiB,EAAE,GAAQ;IAC7D,MAAM,IAAI,GAAG,uBAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAA,2BAAgB,EAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAND,kDAMC","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.cts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,gCAA+B;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,13 +0,0 @@
|
|
|
1
|
-
import type { Env } from "../../../shared/env.mjs";
|
|
2
|
-
export declare const IDENTIFIER_SALT: Record<Env, string>;
|
|
3
|
-
/**
|
|
4
|
-
* Computes a deterministic identifier ID by hashing a public key with an
|
|
5
|
-
* environment-specific salt. Matches the server-side formula:
|
|
6
|
-
* SHA256(publicKey + salt).
|
|
7
|
-
*
|
|
8
|
-
* @param publicKey - The raw SRP public key
|
|
9
|
-
* @param env - The environment whose salt to use
|
|
10
|
-
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
11
|
-
*/
|
|
12
|
-
export declare function computeIdentifierId(publicKey: string, env: Env): string;
|
|
13
|
-
//# sourceMappingURL=identifier.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.mts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,gCAA+B;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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.mjs","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,6CAA4C;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"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.delay = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Delays execution for the specified number of milliseconds.
|
|
6
|
-
*
|
|
7
|
-
* @param ms - Number of milliseconds to delay
|
|
8
|
-
* @returns Promise that resolves after the delay
|
|
9
|
-
*/
|
|
10
|
-
async function delay(ms) {
|
|
11
|
-
if (ms <= 0) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
15
|
-
}
|
|
16
|
-
exports.delay = delay;
|
|
17
|
-
//# sourceMappingURL=time.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.cjs","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/time.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,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;AALD,sBAKC","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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.cts","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"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Delays execution for the specified number of milliseconds.
|
|
3
|
-
*
|
|
4
|
-
* @param ms - Number of milliseconds to delay
|
|
5
|
-
* @returns Promise that resolves after the delay
|
|
6
|
-
*/
|
|
7
|
-
export declare function delay(ms: number): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=time.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.mts","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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.mjs","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,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
17
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
18
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
19
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
20
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
21
|
-
};
|
|
22
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
25
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
26
|
-
};
|
|
27
|
-
var _JwtBearerAuth_instances, _JwtBearerAuth_type, _JwtBearerAuth_env, _JwtBearerAuth_sdk, _JwtBearerAuth_assertSIWE, _JwtBearerAuth_assertSRP;
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SRPJwtBearerAuth = exports.SIWEJwtBearerAuth = exports.JwtBearerAuth = void 0;
|
|
30
|
-
const flow_siwe_js_1 = require("./authentication-jwt-bearer/flow-siwe.cjs");
|
|
31
|
-
const flow_srp_js_1 = require("./authentication-jwt-bearer/flow-srp.cjs");
|
|
32
|
-
const services_js_1 = require("./authentication-jwt-bearer/services.cjs");
|
|
33
|
-
const types_js_1 = require("./authentication-jwt-bearer/types.cjs");
|
|
34
|
-
const errors_js_1 = require("./errors.cjs");
|
|
35
|
-
class JwtBearerAuth {
|
|
36
|
-
constructor(...args) {
|
|
37
|
-
_JwtBearerAuth_instances.add(this);
|
|
38
|
-
_JwtBearerAuth_type.set(this, void 0);
|
|
39
|
-
_JwtBearerAuth_env.set(this, void 0);
|
|
40
|
-
_JwtBearerAuth_sdk.set(this, void 0);
|
|
41
|
-
__classPrivateFieldSet(this, _JwtBearerAuth_type, args[0].type, "f");
|
|
42
|
-
__classPrivateFieldSet(this, _JwtBearerAuth_env, args[0].env, "f");
|
|
43
|
-
if (args[0].type === types_js_1.AuthType.SRP) {
|
|
44
|
-
__classPrivateFieldSet(this, _JwtBearerAuth_sdk, new flow_srp_js_1.SRPJwtBearerAuth(args[0], args[1]), "f");
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (args[0].type === types_js_1.AuthType.SiWE) {
|
|
48
|
-
__classPrivateFieldSet(this, _JwtBearerAuth_sdk, new flow_siwe_js_1.SIWEJwtBearerAuth(args[0], args[1]), "f");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
throw new errors_js_1.UnsupportedAuthTypeError('unsupported auth type');
|
|
52
|
-
}
|
|
53
|
-
setCustomProvider(provider) {
|
|
54
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
|
|
55
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").setCustomProvider(provider);
|
|
56
|
-
}
|
|
57
|
-
async getAccessToken(entropySourceId) {
|
|
58
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getAccessToken(entropySourceId);
|
|
59
|
-
}
|
|
60
|
-
async connectSnap() {
|
|
61
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
|
|
62
|
-
return __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").connectSnap();
|
|
63
|
-
}
|
|
64
|
-
async isSnapConnected() {
|
|
65
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
|
|
66
|
-
return __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").isSnapConnected();
|
|
67
|
-
}
|
|
68
|
-
async getUserProfile(entropySourceId) {
|
|
69
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfile(entropySourceId);
|
|
70
|
-
}
|
|
71
|
-
async getIdentifier(entropySourceId) {
|
|
72
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getIdentifier(entropySourceId);
|
|
73
|
-
}
|
|
74
|
-
async getUserProfileLineage(entropySourceId) {
|
|
75
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfileLineage(entropySourceId);
|
|
76
|
-
}
|
|
77
|
-
async getCustomerServiceToken(entropySourceId) {
|
|
78
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getCustomerServiceToken(entropySourceId);
|
|
79
|
-
}
|
|
80
|
-
async pairSrpProfiles(accessTokens, authAccessToken) {
|
|
81
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
|
|
82
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").pairSrpProfiles(accessTokens, authAccessToken);
|
|
83
|
-
}
|
|
84
|
-
async signMessage(message, entropySourceId) {
|
|
85
|
-
return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").signMessage(message, entropySourceId);
|
|
86
|
-
}
|
|
87
|
-
async pairIdentifiers(pairing) {
|
|
88
|
-
const profile = await this.getUserProfile();
|
|
89
|
-
const n = await (0, services_js_1.getNonce)(profile.profileId, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
|
|
90
|
-
const logins = await Promise.all(pairing.map(async (p) => {
|
|
91
|
-
try {
|
|
92
|
-
const raw = `metamask:${n.nonce}:${p.identifier}`;
|
|
93
|
-
const sig = await p.signMessage(raw);
|
|
94
|
-
return {
|
|
95
|
-
signature: sig,
|
|
96
|
-
raw_message: raw,
|
|
97
|
-
encrypted_storage_key: p.encryptedStorageKey,
|
|
98
|
-
identifier_type: p.identifierType,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
/* istanbul ignore next */
|
|
103
|
-
const errorMessage = e instanceof Error ? e.message : JSON.stringify(e ?? '');
|
|
104
|
-
throw new errors_js_1.PairError(`failed to sign pairing message: ${errorMessage}`);
|
|
105
|
-
}
|
|
106
|
-
}));
|
|
107
|
-
const accessToken = await this.getAccessToken();
|
|
108
|
-
await (0, services_js_1.pairIdentifiers)(n.nonce, logins, accessToken, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
|
|
109
|
-
}
|
|
110
|
-
prepare(signer) {
|
|
111
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSIWE).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
|
|
112
|
-
__classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").prepare(signer);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.JwtBearerAuth = JwtBearerAuth;
|
|
116
|
-
_JwtBearerAuth_type = new WeakMap(), _JwtBearerAuth_env = new WeakMap(), _JwtBearerAuth_sdk = new WeakMap(), _JwtBearerAuth_instances = new WeakSet(), _JwtBearerAuth_assertSIWE = function _JwtBearerAuth_assertSIWE(type, _sdk) {
|
|
117
|
-
if (type === types_js_1.AuthType.SiWE) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
throw new errors_js_1.UnsupportedAuthTypeError('This method is only available via SIWE auth type');
|
|
121
|
-
}, _JwtBearerAuth_assertSRP = function _JwtBearerAuth_assertSRP(type, _sdk) {
|
|
122
|
-
if (type === types_js_1.AuthType.SRP) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
throw new errors_js_1.UnsupportedAuthTypeError('This method is only available via SRP auth type');
|
|
126
|
-
};
|
|
127
|
-
var flow_siwe_js_2 = require("./authentication-jwt-bearer/flow-siwe.cjs");
|
|
128
|
-
Object.defineProperty(exports, "SIWEJwtBearerAuth", { enumerable: true, get: function () { return flow_siwe_js_2.SIWEJwtBearerAuth; } });
|
|
129
|
-
var flow_srp_js_2 = require("./authentication-jwt-bearer/flow-srp.cjs");
|
|
130
|
-
Object.defineProperty(exports, "SRPJwtBearerAuth", { enumerable: true, get: function () { return flow_srp_js_2.SRPJwtBearerAuth; } });
|
|
131
|
-
__exportStar(require("./authentication-jwt-bearer/types.cjs"), exports);
|
|
132
|
-
//# sourceMappingURL=authentication.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,4EAA6E;AAC7E,0EAA2E;AAC3E,0EAGiD;AAOjD,oEAAgE;AAChE,4CAAkE;AAYlE,MAAa,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,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAQ,CAAC,GAAG,EAAE,CAAC;YAClC,uBAAA,IAAI,sBAAQ,IAAI,8BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,uBAAA,IAAI,sBAAQ,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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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.cts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe;AAG9C,OAAO,EAAE,iBAAiB,EAAE,kDAAiD;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iDAAgD;AAK3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,iDAAgD;AACpF,OAAO,KAAK,EACV,WAAW,EACX,IAAI,EACJ,kBAAkB,EACnB,8CAA6C;AAM9C,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAErD,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,KAAK,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,qBAAa,aAAc,YAAW,aAAa,EAAE,YAAY;;g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wt-bearer/flow-siwe.mjs";
|
|
3
|
-
import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
|
|
4
|
-
import type { PairProfilesResponse } from "./authentication-jwt-bearer/services.mjs";
|
|
5
|
-
import type { UserProfile, Pair, UserProfileLineage } from "./authentication-jwt-bearer/types.mjs";
|
|
6
|
-
type Compute<T> = T extends infer U ? {
|
|
7
|
-
[K in keyof U]: U[K];
|
|
8
|
-
} : never;
|
|
9
|
-
type SIWEInterface = Compute<SIWEJwtBearerAuth>;
|
|
10
|
-
export type SRPInterface = Compute<SRPJwtBearerAuth>;
|
|
11
|
-
type SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;
|
|
12
|
-
type SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;
|
|
13
|
-
type JwtBearerAuthParams = SiweParams | SRPParams;
|
|
14
|
-
export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
|
|
15
|
-
#private;
|
|
16
|
-
constructor(...args: JwtBearerAuthParams);
|
|
17
|
-
setCustomProvider(provider: Eip1193Provider): void;
|
|
18
|
-
getAccessToken(entropySourceId?: string): Promise<string>;
|
|
19
|
-
connectSnap(): Promise<string>;
|
|
20
|
-
isSnapConnected(): Promise<boolean>;
|
|
21
|
-
getUserProfile(entropySourceId?: string): Promise<UserProfile>;
|
|
22
|
-
getIdentifier(entropySourceId?: string): Promise<string>;
|
|
23
|
-
getUserProfileLineage(entropySourceId?: string): Promise<UserProfileLineage>;
|
|
24
|
-
getCustomerServiceToken(entropySourceId?: string): Promise<string>;
|
|
25
|
-
pairSrpProfiles(accessTokens: string[], authAccessToken: string): Promise<PairProfilesResponse>;
|
|
26
|
-
signMessage(message: string, entropySourceId?: string): Promise<string>;
|
|
27
|
-
pairIdentifiers(pairing: Pair[]): Promise<void>;
|
|
28
|
-
prepare(signer: {
|
|
29
|
-
address: string;
|
|
30
|
-
chainId: number;
|
|
31
|
-
signMessage: (message: string) => Promise<string>;
|
|
32
|
-
domain: string;
|
|
33
|
-
}): void;
|
|
34
|
-
}
|
|
35
|
-
export { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
|
|
36
|
-
export { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
|
|
37
|
-
export * from "./authentication-jwt-bearer/types.mjs";
|
|
38
|
-
//# sourceMappingURL=authentication.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.mts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe;AAG9C,OAAO,EAAE,iBAAiB,EAAE,kDAAiD;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iDAAgD;AAK3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,iDAAgD;AACpF,OAAO,KAAK,EACV,WAAW,EACX,IAAI,EACJ,kBAAkB,EACnB,8CAA6C;AAM9C,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAErD,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,KAAK,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,qBAAa,aAAc,YAAW,aAAa,EAAE,YAAY;;gBAOnD,GAAG,IAAI,EAAE,mBAAmB;IAiBxC,iBAAiB,CAAC,QAAQ,EAAE,eAAe;IAKrC,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,C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IAAI,2BAAM,EAAE,uBAAA,IAAI,0BAAK,CAAC,CAAC;QACxC,uBAAA,IAAI,0BAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CA2BF;sNAxBG,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,wBAAwB,CAChC,kDAAkD,CACnD,CAAC;AACJ,CAAC,+DAGC,IAAc,EACd,IAA0C;IAE1C,IAAI,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,kDAAiD;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iDAAgD;AAC3E,sDAAqD","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"]}
|
package/dist/sdk/constants.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,iBAAiB,EAAE,GAAG;CACvB,CAAC","sourcesContent":["export const HTTP_STATUS_CODES = {\n TOO_MANY_REQUESTS: 429,\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
|
package/dist/sdk/constants.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/sdk/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","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"]}
|
package/dist/sdk/errors.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RateLimitedError = exports.NotFoundError = exports.UnsupportedAuthTypeError = exports.ValidationError = exports.UserStorageError = exports.PairError = exports.SignInError = exports.NonceRetrievalError = void 0;
|
|
4
|
-
const constants_js_1 = require("./constants.cjs");
|
|
5
|
-
class NonceRetrievalError extends Error {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'NonceRetrievalError';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.NonceRetrievalError = NonceRetrievalError;
|
|
12
|
-
class SignInError extends Error {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = 'SignInError';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.SignInError = SignInError;
|
|
19
|
-
class PairError extends Error {
|
|
20
|
-
constructor(message) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = 'PairError';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.PairError = PairError;
|
|
26
|
-
class UserStorageError extends Error {
|
|
27
|
-
constructor(message) {
|
|
28
|
-
super(message);
|
|
29
|
-
this.name = 'UserStorageError';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.UserStorageError = UserStorageError;
|
|
33
|
-
class ValidationError extends Error {
|
|
34
|
-
constructor(message) {
|
|
35
|
-
super(message);
|
|
36
|
-
this.name = 'ValidationError';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ValidationError = ValidationError;
|
|
40
|
-
class UnsupportedAuthTypeError extends Error {
|
|
41
|
-
constructor(message) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.name = 'UnsupportedAuthTypeError';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.UnsupportedAuthTypeError = UnsupportedAuthTypeError;
|
|
47
|
-
class NotFoundError extends Error {
|
|
48
|
-
constructor(message) {
|
|
49
|
-
super(message);
|
|
50
|
-
this.name = 'NotFoundError';
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.NotFoundError = NotFoundError;
|
|
54
|
-
class RateLimitedError extends Error {
|
|
55
|
-
constructor(message, retryAfterMs) {
|
|
56
|
-
super(message);
|
|
57
|
-
this.status = constants_js_1.HTTP_STATUS_CODES.TOO_MANY_REQUESTS;
|
|
58
|
-
this.name = 'RateLimitedError';
|
|
59
|
-
this.retryAfterMs = retryAfterMs;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Check if an unknown error is a rate limit error (429 status).
|
|
63
|
-
*
|
|
64
|
-
* @param e - The error to check
|
|
65
|
-
* @returns True if the error is a rate limit error
|
|
66
|
-
*/
|
|
67
|
-
static isRateLimitError(e) {
|
|
68
|
-
return (e instanceof RateLimitedError ||
|
|
69
|
-
(typeof e === 'object' &&
|
|
70
|
-
e !== null &&
|
|
71
|
-
'status' in e &&
|
|
72
|
-
e.status === constants_js_1.HTTP_STATUS_CODES.TOO_MANY_REQUESTS));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.RateLimitedError = RateLimitedError;
|
|
76
|
-
//# sourceMappingURL=errors.cjs.map
|
package/dist/sdk/errors.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../../src/sdk/errors.ts"],"names":[],"mappings":";;;AAAA,kDAAmD;AAEnD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAED,MAAa,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AALD,8BAKC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,4DAKC;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IAKzC,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,WAAM,GAAG,gCAAiB,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,gCAAiB,CAAC,iBAAiB,CAAC,CACpD,CAAC;IACJ,CAAC;CACF;AA1BD,4CA0BC","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"]}
|