@oxyhq/services 5.17.17 → 5.17.18
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/README.md +32 -38
- package/lib/commonjs/core/CrossDomainAuth.js +277 -0
- package/lib/commonjs/core/CrossDomainAuth.js.map +1 -0
- package/lib/commonjs/core/HttpService.js +82 -15
- package/lib/commonjs/core/HttpService.js.map +1 -1
- package/lib/commonjs/core/OxyServices.base.js +11 -3
- package/lib/commonjs/core/OxyServices.base.js.map +1 -1
- package/lib/commonjs/core/OxyServices.js +4 -1
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +30 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.assets.js +16 -3
- package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.auth.js +73 -32
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js +289 -0
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.popup.js +352 -0
- package/lib/commonjs/core/mixins/OxyServices.popup.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.redirect.js +378 -0
- package/lib/commonjs/core/mixins/OxyServices.redirect.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js +35 -24
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/core/mixins/index.js +27 -15
- package/lib/commonjs/core/mixins/index.js.map +1 -1
- package/lib/commonjs/crypto/index.js +30 -0
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/crypto/keyManager.js +902 -0
- package/lib/commonjs/crypto/keyManager.js.map +1 -0
- package/lib/commonjs/crypto/polyfill.js +14 -5
- package/lib/commonjs/crypto/polyfill.js.map +1 -1
- package/lib/commonjs/crypto/recoveryPhrase.js +152 -0
- package/lib/commonjs/crypto/recoveryPhrase.js.map +1 -0
- package/lib/commonjs/crypto/signatureService.js +289 -0
- package/lib/commonjs/crypto/signatureService.js.map +1 -0
- package/lib/commonjs/i18n/locales/en-US.json +1 -1
- package/lib/commonjs/index.js +40 -26
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/interfaces.js +0 -15
- package/lib/commonjs/models/interfaces.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +9 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/components/Icon.js.map +1 -1
- package/lib/commonjs/ui/components/IconButton/utils.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +41 -11
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/helpers.js.map +1 -1
- package/lib/commonjs/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/commonjs/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +110 -199
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +150 -19
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useSessionManagement.js +279 -0
- package/lib/commonjs/ui/context/hooks/useSessionManagement.js.map +1 -0
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +79 -72
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +38 -51
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js +3 -3
- package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +18 -12
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useProfileEditing.js +3 -5
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +4 -8
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +162 -315
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/hooks/useStorage.js +24 -58
- package/lib/commonjs/ui/hooks/useStorage.js.map +1 -1
- package/lib/commonjs/ui/index.js +50 -21
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +5 -1
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +2 -2
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +29 -24
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +134 -66
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +6 -13
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/accountStore.js +2 -4
- package/lib/commonjs/ui/stores/accountStore.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +45 -32
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/spacing.js +54 -2
- package/lib/commonjs/ui/styles/spacing.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +37 -41
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/storageHelpers.js.map +1 -1
- package/lib/commonjs/utils/errorUtils.js +13 -0
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/validationUtils.js +15 -1
- package/lib/commonjs/utils/validationUtils.js.map +1 -1
- package/lib/module/core/CrossDomainAuth.js +271 -0
- package/lib/module/core/CrossDomainAuth.js.map +1 -0
- package/lib/module/core/HttpService.js +82 -15
- package/lib/module/core/HttpService.js.map +1 -1
- package/lib/module/core/OxyServices.base.js +11 -4
- package/lib/module/core/OxyServices.base.js.map +1 -1
- package/lib/module/core/OxyServices.js +4 -1
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +6 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.assets.js +16 -3
- package/lib/module/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.auth.js +73 -32
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.fedcm.js +286 -0
- package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.popup.js +349 -0
- package/lib/module/core/mixins/OxyServices.popup.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.redirect.js +375 -0
- package/lib/module/core/mixins/OxyServices.redirect.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.user.js +35 -24
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/core/mixins/index.js +15 -3
- package/lib/module/core/mixins/index.js.map +1 -1
- package/lib/module/crypto/index.js +8 -4
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/crypto/keyManager.js +899 -0
- package/lib/module/crypto/keyManager.js.map +1 -0
- package/lib/module/crypto/polyfill.js +6 -5
- package/lib/module/crypto/polyfill.js.map +1 -1
- package/lib/module/crypto/recoveryPhrase.js +147 -0
- package/lib/module/crypto/recoveryPhrase.js.map +1 -0
- package/lib/module/crypto/signatureService.js +286 -0
- package/lib/module/crypto/signatureService.js.map +1 -0
- package/lib/module/i18n/locales/en-US.json +1 -1
- package/lib/module/index.js +6 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/interfaces.js +0 -15
- package/lib/module/models/interfaces.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +6 -2
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/components/Icon.js.map +1 -1
- package/lib/module/ui/components/IconButton/utils.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +41 -11
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/module/ui/components/TextField/helpers.js.map +1 -1
- package/lib/module/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/module/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +112 -191
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +150 -19
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/hooks/useSessionManagement.js +274 -0
- package/lib/module/ui/context/hooks/useSessionManagement.js.map +1 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +80 -72
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +31 -44
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useSecurityQueries.js +1 -1
- package/lib/module/ui/hooks/queries/useSecurityQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +13 -7
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/useProfileEditing.js +3 -5
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +4 -8
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +162 -315
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/hooks/useStorage.js +25 -59
- package/lib/module/ui/hooks/useStorage.js.map +1 -1
- package/lib/module/ui/index.js +15 -10
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +5 -1
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +2 -2
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +29 -24
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +135 -68
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +6 -13
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/stores/accountStore.js +2 -4
- package/lib/module/ui/stores/accountStore.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +45 -32
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/spacing.js +6 -2
- package/lib/module/ui/styles/spacing.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +37 -40
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/ui/utils/storageHelpers.js.map +1 -1
- package/lib/module/utils/errorUtils.js +7 -0
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/validationUtils.js +13 -0
- package/lib/module/utils/validationUtils.js.map +1 -1
- package/lib/typescript/core/CrossDomainAuth.d.ts +161 -0
- package/lib/typescript/core/CrossDomainAuth.d.ts.map +1 -0
- package/lib/typescript/core/HttpService.d.ts +1 -1
- package/lib/typescript/core/HttpService.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.base.d.ts +0 -6
- package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +5 -36
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +4 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +40 -20
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts +195 -0
- package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.popup.d.ts +206 -0
- package/lib/typescript/core/mixins/OxyServices.popup.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.redirect.d.ts +246 -0
- package/lib/typescript/core/mixins/OxyServices.redirect.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +6 -4
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +220 -8
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/crypto/index.d.ts +6 -3
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/keyManager.d.ts +190 -0
- package/lib/typescript/crypto/keyManager.d.ts.map +1 -0
- package/lib/typescript/crypto/polyfill.d.ts +4 -3
- package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
- package/lib/typescript/crypto/recoveryPhrase.d.ts +59 -0
- package/lib/typescript/crypto/recoveryPhrase.d.ts.map +1 -0
- package/lib/typescript/crypto/signatureService.d.ts +87 -0
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -6
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +2 -14
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +0 -9
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/types/bip39.d.ts +32 -0
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts +5 -0
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/ui/components/IconButton/utils.d.ts +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts +1 -1
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/helpers.d.ts +8 -8
- package/lib/typescript/ui/components/TextField/types.d.ts +1 -0
- package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
- package/lib/typescript/ui/components/types.d.ts +4 -0
- package/lib/typescript/ui/components/types.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +57 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +10 -3
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts +41 -0
- package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts +1 -2
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useStorage.d.ts +3 -9
- package/lib/typescript/ui/hooks/useStorage.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +6 -2
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/OxyAuthScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/accountStore.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +8 -7
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/spacing.d.ts +5 -0
- package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
- package/lib/typescript/ui/types/navigation.d.ts +2 -1
- package/lib/typescript/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +2 -13
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/ui/utils/storageHelpers.d.ts +0 -3
- package/lib/typescript/ui/utils/storageHelpers.d.ts.map +1 -1
- package/lib/typescript/utils/errorUtils.d.ts +6 -0
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/utils/validationUtils.d.ts +8 -0
- package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/core/CrossDomainAuth.ts +307 -0
- package/src/core/HttpService.ts +99 -16
- package/src/core/OxyServices.base.ts +20 -3
- package/src/core/OxyServices.ts +7 -3
- package/src/core/index.ts +9 -1
- package/src/core/mixins/OxyServices.assets.ts +14 -3
- package/src/core/mixins/OxyServices.auth.ts +105 -36
- package/src/core/mixins/OxyServices.fedcm.ts +315 -0
- package/src/core/mixins/OxyServices.popup.ts +402 -0
- package/src/core/mixins/OxyServices.redirect.ts +397 -0
- package/src/core/mixins/OxyServices.user.ts +39 -24
- package/src/core/mixins/index.ts +19 -3
- package/src/crypto/index.ts +16 -5
- package/src/crypto/keyManager.ts +966 -0
- package/src/crypto/polyfill.ts +6 -5
- package/src/crypto/recoveryPhrase.ts +166 -0
- package/src/crypto/signatureService.ts +323 -0
- package/src/i18n/locales/en-US.json +1 -1
- package/src/index.ts +19 -15
- package/src/models/interfaces.ts +4 -16
- package/src/models/session.ts +2 -11
- package/src/types/bip39.d.ts +32 -0
- package/src/ui/components/BottomSheetRouter.tsx +6 -1
- package/src/ui/components/Icon.tsx +1 -1
- package/src/ui/components/IconButton/utils.ts +1 -1
- package/src/ui/components/OxyProvider.tsx +44 -12
- package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
- package/src/ui/components/TextField/Adornment/utils.ts +2 -2
- package/src/ui/components/TextField/helpers.tsx +10 -10
- package/src/ui/components/TextField/types.tsx +1 -1
- package/src/ui/components/TouchableRipple/utils.ts +2 -2
- package/src/ui/components/Typography/AnimatedText.tsx +2 -2
- package/src/ui/components/types.tsx +6 -0
- package/src/ui/context/OxyContext.tsx +173 -195
- package/src/ui/context/hooks/useAuthOperations.ts +177 -36
- package/src/ui/context/hooks/useSessionManagement.ts +399 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +83 -76
- package/src/ui/hooks/queries/useAccountQueries.ts +29 -35
- package/src/ui/hooks/queries/useSecurityQueries.ts +1 -1
- package/src/ui/hooks/queries/useServicesQueries.ts +14 -6
- package/src/ui/hooks/useProfileEditing.ts +3 -3
- package/src/ui/hooks/useSessionManagement.ts +5 -10
- package/src/ui/hooks/useSessionSocket.ts +46 -175
- package/src/ui/hooks/useStorage.ts +24 -76
- package/src/ui/index.ts +22 -13
- package/src/ui/navigation/routes.ts +6 -2
- package/src/ui/screens/AccountCenterScreen.tsx +2 -2
- package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
- package/src/ui/screens/AccountSettingsScreen.tsx +34 -37
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/OxyAuthScreen.tsx +138 -64
- package/src/ui/screens/PrivacySettingsScreen.tsx +6 -12
- package/src/ui/stores/accountStore.ts +1 -11
- package/src/ui/stores/authStore.ts +43 -44
- package/src/ui/styles/spacing.ts +15 -2
- package/src/ui/types/navigation.ts +2 -2
- package/src/ui/utils/avatarUtils.ts +39 -46
- package/src/ui/utils/storageHelpers.ts +0 -4
- package/src/utils/__tests__/validationUtils.test.ts +16 -1
- package/src/utils/errorUtils.ts +8 -1
- package/src/utils/validationUtils.ts +12 -0
- package/lib/commonjs/core/services/SessionService.js +0 -163
- package/lib/commonjs/core/services/SessionService.js.map +0 -1
- package/lib/commonjs/core/services/TokenService.js +0 -220
- package/lib/commonjs/core/services/TokenService.js.map +0 -1
- package/lib/commonjs/crypto/types.js +0 -2
- package/lib/commonjs/crypto/types.js.map +0 -1
- package/lib/commonjs/ui/context/OxyContextBase.js +0 -21
- package/lib/commonjs/ui/context/OxyContextBase.js.map +0 -1
- package/lib/commonjs/ui/context/hooks/useStorage.js +0 -79
- package/lib/commonjs/ui/context/hooks/useStorage.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -56
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/module/core/services/SessionService.js +0 -159
- package/lib/module/core/services/SessionService.js.map +0 -1
- package/lib/module/core/services/TokenService.js +0 -217
- package/lib/module/core/services/TokenService.js.map +0 -1
- package/lib/module/crypto/types.js +0 -2
- package/lib/module/crypto/types.js.map +0 -1
- package/lib/module/ui/context/OxyContextBase.js +0 -16
- package/lib/module/ui/context/OxyContextBase.js.map +0 -1
- package/lib/module/ui/context/hooks/useStorage.js +0 -74
- package/lib/module/ui/context/hooks/useStorage.js.map +0 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +0 -50
- package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/typescript/core/services/SessionService.d.ts +0 -78
- package/lib/typescript/core/services/SessionService.d.ts.map +0 -1
- package/lib/typescript/core/services/TokenService.d.ts +0 -72
- package/lib/typescript/core/services/TokenService.d.ts.map +0 -1
- package/lib/typescript/crypto/types.d.ts +0 -22
- package/lib/typescript/crypto/types.d.ts.map +0 -1
- package/lib/typescript/ui/context/OxyContextBase.d.ts +0 -63
- package/lib/typescript/ui/context/OxyContextBase.d.ts.map +0 -1
- package/lib/typescript/ui/context/hooks/useStorage.d.ts +0 -22
- package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -19
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
- package/src/core/services/SessionService.ts +0 -173
- package/src/core/services/TokenService.ts +0 -237
- package/src/crypto/types.ts +0 -23
- package/src/ui/context/OxyContextBase.tsx +0 -78
- package/src/ui/context/hooks/useStorage.ts +0 -104
- package/src/ui/hooks/useAvatarPicker.ts +0 -61
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ec","EC","Platform","SecureStore","ExpoCrypto","STORAGE_KEYS","PRIVATE_KEY","PUBLIC_KEY","BACKUP_PRIVATE_KEY","BACKUP_PUBLIC_KEY","BACKUP_TIMESTAMP","SHARED_PRIVATE_KEY","SHARED_PUBLIC_KEY","SHARED_SESSION_TOKEN","SHARED_SESSION_ID","IOS_KEYCHAIN_GROUP","ANDROID_ACCOUNT_TYPE","initSecureStore","error","errorMessage","Error","message","String","isReactNative","navigator","product","isNodeJS","process","versions","node","isWebPlatform","OS","window","initExpoCrypto","uint8ArrayToHex","bytes","Array","from","map","b","toString","padStart","join","getSecureRandomBytes","length","Crypto","getRandomBytes","getCrypto","Function","crypto","Uint8Array","randomBytes","KeyManager","cachedPublicKey","cachedHasIdentity","cachedSharedPublicKey","cachedHasSharedIdentity","invalidateCache","invalidateSharedCache","generateKeyPairSync","keyPair","genKeyPair","privateKey","getPrivate","publicKey","getPublic","generateKeyPair","privateKeyHex","keyFromPrivate","createSharedIdentity","store","setItemAsync","keychainAccessible","WHEN_UNLOCKED_THIS_DEVICE_ONLY","keychainAccessGroup","__DEV__","console","log","getSharedPublicKey","getItemAsync","warn","getSharedPrivateKey","hasSharedIdentity","hasShared","importSharedIdentity","storeSharedSession","sessionId","accessToken","WHEN_UNLOCKED","getSharedSession","clearSharedSession","deleteItemAsync","migrateToSharedIdentity","getPrivateKey","createIdentity","importKeyPair","getPublicKey","hasIdentity","deleteIdentity","skipBackup","force","userConfirmed","backupSuccess","backupIdentity","backupError","Date","now","verifyIdentityIntegrity","isValidPrivateKey","isValidPublicKey","derivedPublicKey","derivePublicKey","getKeyPairObject","restoreIdentityFromBackup","backupPrivateKey","backupPublicKey","restored","keyFromPublic","shortenPublicKey","slice"],"sourceRoot":"../../../src","sources":["crypto/keyManager.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,EAAE,IAAIC,EAAE,QAAQ,UAAU;AAEnC,SAASC,QAAQ,QAAQ,cAAc;;AAEvC;AACA,IAAIC,WAAsD,GAAG,IAAI;AACjE,IAAIC,UAA+C,GAAG,IAAI;AAE1D,MAAMJ,EAAE,GAAG,IAAIC,EAAE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AAMF,OAAO,GAAG5D,EAAE,CAACoE,cAAc,CAACN,UAAU,CAAC;MAC7C;MACAF,OAAO,CAACK,SAAS,CAAC,KAAK,CAAC;MACxB,OAAO,IAAI;IACb,CAAC,CAAC,MAAM;MACN,OAAO,KAAK;IACd;EACF;;EAEA;AACF;AACA;AACA;EACE,OAAOqD,gBAAgBA,CAACtD,SAAiB,EAAU;IACjD,IAAIA,SAAS,CAACpB,MAAM,IAAI,EAAE,EAAE,OAAOoB,SAAS;IAC5C,OAAO,GAAGA,SAAS,CAACuD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAMvD,SAAS,CAACuD,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;EAC5D;AACF;AAEA,eAAenE,UAAU","ignoreList":[]}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
* before any crypto operations are performed.
|
|
8
8
|
*
|
|
9
9
|
* Polyfills included:
|
|
10
|
-
* - Buffer: Required by crypto libraries
|
|
11
|
-
* - crypto.getRandomValues: Required for secure random number generation
|
|
10
|
+
* - Buffer: Required by bip39 and other crypto libraries
|
|
11
|
+
* - crypto.getRandomValues: Required by bip39 for secure random number generation
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
// Import Buffer polyfill for React Native compatibility
|
|
15
|
-
//
|
|
15
|
+
// Libraries like bip39 depend on Buffer which isn't available in React Native
|
|
16
16
|
import { Buffer } from 'buffer';
|
|
17
17
|
|
|
18
18
|
// Get the global object in a cross-platform way
|
|
@@ -31,7 +31,7 @@ if (!globalObject.Buffer) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Polyfill crypto.getRandomValues for React Native
|
|
34
|
-
// This is required by
|
|
34
|
+
// This is required by bip39 and other crypto libraries
|
|
35
35
|
|
|
36
36
|
// Cache for expo-crypto module
|
|
37
37
|
let expoCryptoModule = null;
|
|
@@ -73,5 +73,6 @@ if (typeof globalObject.crypto === 'undefined') {
|
|
|
73
73
|
globalObject.crypto.getRandomValues = cryptoPolyfill.getRandomValues;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
//
|
|
76
|
+
// Re-export Buffer for convenience
|
|
77
|
+
export { Buffer };
|
|
77
78
|
//# sourceMappingURL=polyfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Buffer","getGlobalObject","globalThis","global","window","self","globalObject","expoCryptoModule","getRandomBytesSync","byteCount","require","Error","cryptoModule","getRandomBytes","cryptoPolyfill","getRandomValues","array","bytes","byteLength","uint8View","Uint8Array","buffer","byteOffset","set","crypto"],"sourceRoot":"../../../src","sources":["crypto/polyfill.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;;AAE/B;AACA,MAAMC,eAAe,GAAGA,CAAA,KAAyB;EAC/C,IAAI,OAAOC,UAAU,KAAK,WAAW,EAAE,OAAOA,UAAU;EACxD,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAOA,MAAM;EAChD,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAOA,MAAM;EAChD,IAAI,OAAOC,IAAI,KAAK,WAAW,EAAE,OAAOA,IAAI;EAC5C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAMC,YAAY,GAAGL,eAAe,CAAC,CAAC;;AAEtC;AACA,IAAI,CAACK,YAAY,CAACN,MAAM,EAAE;EACvBM,YAAY,CAA0CN,MAAM,GAAGA,MAAM;AACxE;;AAEA;AACA;;AAKA;AACA,IAAIO,gBAAqD,GAAG,IAAI;;AAEhE;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAACC,SAAiB,EAAc;EACzD,IAAI,CAACF,gBAAgB,EAAE;IACrB;IACA,IAAI;MACF;MACAA,gBAAgB,GAAGG,OAAO,CAAC,aAAa,CAAC;IAC3C,CAAC,CAAC,MAAM;MACN,MAAM,IAAIC,KAAK,CAAC,6DAA6D,CAAC;IAChF;EACF;EACA;EACA,MAAMC,YAAY,GAAGL,gBAAgB;EACrC,IAAI,CAACK,YAAY,EAAE;IACjB,MAAM,IAAID,KAAK,CAAC,mCAAmC,CAAC;EACtD;EACA,OAAOC,YAAY,CAACC,cAAc,CAACJ,SAAS,CAAC;AAC/C;AAEA,MAAMK,cAA0B,GAAG;EACjCC,eAAeA,CAA4BC,KAAQ,EAAK;IACtD,MAAMC,KAAK,GAAGT,kBAAkB,CAACQ,KAAK,CAACE,UAAU,CAAC;IAClD,MAAMC,SAAS,GAAG,IAAIC,UAAU,CAACJ,KAAK,CAACK,MAAM,EAAEL,KAAK,CAACM,UAAU,EAAEN,KAAK,CAACE,UAAU,CAAC;IAClFC,SAAS,CAACI,GAAG,CAACN,KAAK,CAAC;IACpB,OAAOD,KAAK;EACd;AACF,CAAC;;AAED;AACA,IAAI,OAAOV,YAAY,CAACkB,MAAM,KAAK,WAAW,EAAE;EAC7ClB,YAAY,CAAuCkB,MAAM,GAAGV,cAAc;AAC7E,CAAC,MAAM,IAAI,OAAOR,YAAY,CAACkB,MAAM,CAACT,eAAe,KAAK,UAAU,EAAE;EACnET,YAAY,CAACkB,MAAM,CAAgBT,eAAe,GAAGD,cAAc,CAACC,eAAe;AACtF;;AAEA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Buffer","getGlobalObject","globalThis","global","window","self","globalObject","expoCryptoModule","getRandomBytesSync","byteCount","require","Error","cryptoModule","getRandomBytes","cryptoPolyfill","getRandomValues","array","bytes","byteLength","uint8View","Uint8Array","buffer","byteOffset","set","crypto"],"sourceRoot":"../../../src","sources":["crypto/polyfill.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;;AAE/B;AACA,MAAMC,eAAe,GAAGA,CAAA,KAAyB;EAC/C,IAAI,OAAOC,UAAU,KAAK,WAAW,EAAE,OAAOA,UAAU;EACxD,IAAI,OAAOC,MAAM,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AAC,MAAM,IAAI,OAAOR,YAAY,CAACkB,MAAM,CAACT,eAAe,KAAK,UAAU,EAAE;EACnET,YAAY,CAACkB,MAAM,CAAgBT,eAAe,GAAGD,cAAc,CAACC,eAAe;AACtF;;AAEA;AACA,SAASf,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Recovery Phrase Service - BIP39 Mnemonic Generation
|
|
5
|
+
*
|
|
6
|
+
* Handles generation and restoration of recovery phrases (mnemonic seeds)
|
|
7
|
+
* for backing up and restoring user identities.
|
|
8
|
+
*
|
|
9
|
+
* Note: This module requires the polyfill to be loaded first (done via crypto/index.ts)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as bip39 from 'bip39';
|
|
13
|
+
import { KeyManager } from './keyManager';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Convert Uint8Array or array-like to hexadecimal string
|
|
17
|
+
* Works in both Node.js and React Native without depending on Buffer
|
|
18
|
+
*/
|
|
19
|
+
function toHex(data) {
|
|
20
|
+
// Convert to array of numbers if needed
|
|
21
|
+
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
22
|
+
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
23
|
+
}
|
|
24
|
+
export class RecoveryPhraseService {
|
|
25
|
+
/**
|
|
26
|
+
* Generate a new identity with a recovery phrase
|
|
27
|
+
* Returns the mnemonic phrase (should only be shown once to the user)
|
|
28
|
+
*/
|
|
29
|
+
static async generateIdentityWithRecovery() {
|
|
30
|
+
// Generate 128-bit entropy for 12-word mnemonic
|
|
31
|
+
const mnemonic = bip39.generateMnemonic(128);
|
|
32
|
+
|
|
33
|
+
// Derive private key from mnemonic
|
|
34
|
+
// Using the seed directly as the private key (simplified approach)
|
|
35
|
+
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
36
|
+
|
|
37
|
+
// Use first 32 bytes of seed as private key
|
|
38
|
+
const seedSlice = seed.subarray ? seed.subarray(0, 32) : seed.slice(0, 32);
|
|
39
|
+
const privateKeyHex = toHex(seedSlice);
|
|
40
|
+
|
|
41
|
+
// Import the derived key pair
|
|
42
|
+
const publicKey = await KeyManager.importKeyPair(privateKeyHex);
|
|
43
|
+
return {
|
|
44
|
+
phrase: mnemonic,
|
|
45
|
+
words: mnemonic.split(' '),
|
|
46
|
+
publicKey
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generate a 24-word recovery phrase for higher security
|
|
52
|
+
*/
|
|
53
|
+
static async generateIdentityWithRecovery24() {
|
|
54
|
+
// Generate 256-bit entropy for 24-word mnemonic
|
|
55
|
+
const mnemonic = bip39.generateMnemonic(256);
|
|
56
|
+
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
57
|
+
const seedSlice = seed.subarray ? seed.subarray(0, 32) : seed.slice(0, 32);
|
|
58
|
+
const privateKeyHex = toHex(seedSlice);
|
|
59
|
+
const publicKey = await KeyManager.importKeyPair(privateKeyHex);
|
|
60
|
+
return {
|
|
61
|
+
phrase: mnemonic,
|
|
62
|
+
words: mnemonic.split(' '),
|
|
63
|
+
publicKey
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Restore an identity from a recovery phrase
|
|
69
|
+
*/
|
|
70
|
+
static async restoreFromPhrase(phrase) {
|
|
71
|
+
// Normalize and validate the phrase
|
|
72
|
+
const normalizedPhrase = phrase.trim().toLowerCase();
|
|
73
|
+
if (!bip39.validateMnemonic(normalizedPhrase)) {
|
|
74
|
+
throw new Error('Invalid recovery phrase. Please check the words and try again.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Derive the same private key from the mnemonic
|
|
78
|
+
const seed = await bip39.mnemonicToSeed(normalizedPhrase);
|
|
79
|
+
const seedSlice = seed.subarray ? seed.subarray(0, 32) : seed.slice(0, 32);
|
|
80
|
+
const privateKeyHex = toHex(seedSlice);
|
|
81
|
+
|
|
82
|
+
// Import and store the key pair
|
|
83
|
+
const publicKey = await KeyManager.importKeyPair(privateKeyHex);
|
|
84
|
+
return publicKey;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Validate a recovery phrase without importing it
|
|
89
|
+
*/
|
|
90
|
+
static validatePhrase(phrase) {
|
|
91
|
+
const normalizedPhrase = phrase.trim().toLowerCase();
|
|
92
|
+
return bip39.validateMnemonic(normalizedPhrase);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the word list for autocomplete/validation
|
|
97
|
+
*/
|
|
98
|
+
static getWordList() {
|
|
99
|
+
return bip39.wordlists.english;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if a word is valid in the BIP39 word list
|
|
104
|
+
*/
|
|
105
|
+
static isValidWord(word) {
|
|
106
|
+
return bip39.wordlists.english.includes(word.toLowerCase());
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get suggestions for a partial word
|
|
111
|
+
*/
|
|
112
|
+
static getSuggestions(partial, limit = 5) {
|
|
113
|
+
const lowerPartial = partial.toLowerCase();
|
|
114
|
+
return bip39.wordlists.english.filter(word => word.startsWith(lowerPartial)).slice(0, limit);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Derive the public key from a phrase without storing
|
|
119
|
+
* Useful for verification before importing
|
|
120
|
+
*/
|
|
121
|
+
static async derivePublicKeyFromPhrase(phrase) {
|
|
122
|
+
const normalizedPhrase = phrase.trim().toLowerCase();
|
|
123
|
+
if (!bip39.validateMnemonic(normalizedPhrase)) {
|
|
124
|
+
throw new Error('Invalid recovery phrase');
|
|
125
|
+
}
|
|
126
|
+
const seed = await bip39.mnemonicToSeed(normalizedPhrase);
|
|
127
|
+
const seedSlice = seed.subarray ? seed.subarray(0, 32) : seed.slice(0, 32);
|
|
128
|
+
const privateKeyHex = toHex(seedSlice);
|
|
129
|
+
return KeyManager.derivePublicKey(privateKeyHex);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Convert a phrase to its word array
|
|
134
|
+
*/
|
|
135
|
+
static phraseToWords(phrase) {
|
|
136
|
+
return phrase.trim().toLowerCase().split(/\s+/);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Convert a word array to a phrase string
|
|
141
|
+
*/
|
|
142
|
+
static wordsToPhrase(words) {
|
|
143
|
+
return words.map(w => w.toLowerCase().trim()).join(' ');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export default RecoveryPhraseService;
|
|
147
|
+
//# sourceMappingURL=recoveryPhrase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["bip39","KeyManager","toHex","data","bytes","Uint8Array","Array","from","map","b","toString","padStart","join","RecoveryPhraseService","generateIdentityWithRecovery","mnemonic","generateMnemonic","seed","mnemonicToSeed","seedSlice","subarray","slice","privateKeyHex","publicKey","importKeyPair","phrase","words","split","generateIdentityWithRecovery24","restoreFromPhrase","normalizedPhrase","trim","toLowerCase","validateMnemonic","Error","validatePhrase","getWordList","wordlists","english","isValidWord","word","includes","getSuggestions","partial","limit","lowerPartial","filter","startsWith","derivePublicKeyFromPhrase","derivePublicKey","phraseToWords","wordsToPhrase","w"],"sourceRoot":"../../../src","sources":["crypto/recoveryPhrase.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,IAAoC,EAAU;EAC3D;EACA,MAAMC,KAAK,GAAGD,IAAI,YAAYE,UAAU,GAAGF,IAAI,GAAG,IAAIE,UAAU,CAACF,IAAI,CAAC;E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AEA;AACF;AACA;EACE,OAAOwB,aAAaA,CAACzB,KAAe,EAAU;IAC5C,OAAOA,KAAK,CAAClB,GAAG,CAAC4C,CAAC,IAAIA,CAAC,CAACpB,WAAW,CAAC,CAAC,CAACD,IAAI,CAAC,CAAC,CAAC,CAACnB,IAAI,CAAC,GAAG,CAAC;EACzD;AACF;AAEA,eAAeC,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Signature Service - ECDSA Digital Signatures
|
|
5
|
+
*
|
|
6
|
+
* Handles signing and verification of messages using ECDSA secp256k1.
|
|
7
|
+
* Used for authenticating requests and proving identity ownership.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { ec as EC } from 'elliptic';
|
|
11
|
+
import { KeyManager } from './keyManager';
|
|
12
|
+
|
|
13
|
+
// Lazy import for expo-crypto
|
|
14
|
+
let ExpoCrypto = null;
|
|
15
|
+
const ec = new EC('secp256k1');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Check if we're in a React Native environment
|
|
19
|
+
*/
|
|
20
|
+
function isReactNative() {
|
|
21
|
+
return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check if we're in a Node.js environment
|
|
26
|
+
*/
|
|
27
|
+
function isNodeJS() {
|
|
28
|
+
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Initialize expo-crypto module
|
|
33
|
+
*/
|
|
34
|
+
async function initExpoCrypto() {
|
|
35
|
+
if (!ExpoCrypto) {
|
|
36
|
+
ExpoCrypto = await import('expo-crypto');
|
|
37
|
+
}
|
|
38
|
+
return ExpoCrypto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Compute SHA-256 hash of a string
|
|
43
|
+
*/
|
|
44
|
+
async function sha256(message) {
|
|
45
|
+
// In React Native, always use expo-crypto
|
|
46
|
+
if (isReactNative() || !isNodeJS()) {
|
|
47
|
+
const Crypto = await initExpoCrypto();
|
|
48
|
+
return Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, message);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// In Node.js, use Node's crypto module
|
|
52
|
+
// Use Function constructor to prevent Metro bundler from statically analyzing this require
|
|
53
|
+
// This ensures the require is only evaluated in Node.js runtime, not during Metro bundling
|
|
54
|
+
try {
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
56
|
+
const getCrypto = new Function('return require("crypto")');
|
|
57
|
+
const crypto = getCrypto();
|
|
58
|
+
return crypto.createHash('sha256').update(message).digest('hex');
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// Fallback to expo-crypto if Node crypto fails
|
|
61
|
+
const Crypto = await initExpoCrypto();
|
|
62
|
+
return Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, message);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class SignatureService {
|
|
66
|
+
/**
|
|
67
|
+
* Generate a random challenge string (for offline use)
|
|
68
|
+
* Uses expo-crypto in React Native, crypto.randomBytes in Node.js
|
|
69
|
+
*/
|
|
70
|
+
static async generateChallenge() {
|
|
71
|
+
if (isReactNative() || !isNodeJS()) {
|
|
72
|
+
// Use expo-crypto for React Native (expo-random is deprecated)
|
|
73
|
+
const Crypto = await initExpoCrypto();
|
|
74
|
+
const randomBytes = await Crypto.getRandomBytesAsync(32);
|
|
75
|
+
return Array.from(randomBytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Node.js fallback
|
|
79
|
+
try {
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
81
|
+
const getCrypto = new Function('return require("crypto")');
|
|
82
|
+
const crypto = getCrypto();
|
|
83
|
+
return crypto.randomBytes(32).toString('hex');
|
|
84
|
+
} catch (error) {
|
|
85
|
+
// Fallback to expo-crypto if Node crypto fails
|
|
86
|
+
const Crypto = await initExpoCrypto();
|
|
87
|
+
const randomBytes = await Crypto.getRandomBytesAsync(32);
|
|
88
|
+
return Array.from(randomBytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Hash a message using SHA-256
|
|
94
|
+
*/
|
|
95
|
+
static async hashMessage(message) {
|
|
96
|
+
return sha256(message);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sign a message using the stored private key
|
|
101
|
+
* Returns the signature in DER format (hex encoded)
|
|
102
|
+
*/
|
|
103
|
+
static async sign(message) {
|
|
104
|
+
const keyPair = await KeyManager.getKeyPairObject();
|
|
105
|
+
if (!keyPair) {
|
|
106
|
+
throw new Error('No identity found. Please create or import an identity first.');
|
|
107
|
+
}
|
|
108
|
+
const messageHash = await sha256(message);
|
|
109
|
+
const signature = keyPair.sign(messageHash);
|
|
110
|
+
return signature.toDER('hex');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Sign a message with an explicit private key (without storing)
|
|
115
|
+
* Useful for one-time operations or testing
|
|
116
|
+
*/
|
|
117
|
+
static async signWithKey(message, privateKey) {
|
|
118
|
+
const keyPair = ec.keyFromPrivate(privateKey);
|
|
119
|
+
const messageHash = await sha256(message);
|
|
120
|
+
const signature = keyPair.sign(messageHash);
|
|
121
|
+
return signature.toDER('hex');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Verify a signature against a message and public key
|
|
126
|
+
*/
|
|
127
|
+
static async verify(message, signature, publicKey) {
|
|
128
|
+
try {
|
|
129
|
+
const key = ec.keyFromPublic(publicKey, 'hex');
|
|
130
|
+
const messageHash = await sha256(message);
|
|
131
|
+
return key.verify(messageHash, signature);
|
|
132
|
+
} catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Synchronous verification (for Node.js backend)
|
|
139
|
+
* Uses crypto module directly for hashing
|
|
140
|
+
* Note: This method should only be used in Node.js environments
|
|
141
|
+
*/
|
|
142
|
+
static verifySync(message, signature, publicKey) {
|
|
143
|
+
try {
|
|
144
|
+
if (!isNodeJS()) {
|
|
145
|
+
// In React Native, use async verify instead
|
|
146
|
+
throw new Error('verifySync should only be used in Node.js. Use verify() in React Native.');
|
|
147
|
+
}
|
|
148
|
+
// Use Function constructor to prevent Metro bundler from statically analyzing this require
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
150
|
+
const getCrypto = new Function('return require("crypto")');
|
|
151
|
+
const crypto = getCrypto();
|
|
152
|
+
const key = ec.keyFromPublic(publicKey, 'hex');
|
|
153
|
+
const messageHash = crypto.createHash('sha256').update(message).digest('hex');
|
|
154
|
+
return key.verify(messageHash, signature);
|
|
155
|
+
} catch {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Create a signed message object with metadata
|
|
162
|
+
*/
|
|
163
|
+
static async createSignedMessage(message) {
|
|
164
|
+
const publicKey = await KeyManager.getPublicKey();
|
|
165
|
+
if (!publicKey) {
|
|
166
|
+
throw new Error('No identity found. Please create or import an identity first.');
|
|
167
|
+
}
|
|
168
|
+
const timestamp = Date.now();
|
|
169
|
+
const messageWithTimestamp = `${message}:${timestamp}`;
|
|
170
|
+
const signature = await SignatureService.sign(messageWithTimestamp);
|
|
171
|
+
return {
|
|
172
|
+
message,
|
|
173
|
+
signature,
|
|
174
|
+
publicKey,
|
|
175
|
+
timestamp
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Verify a signed message object
|
|
181
|
+
* Checks both signature validity and timestamp freshness
|
|
182
|
+
*/
|
|
183
|
+
static async verifySignedMessage(signedMessage, maxAgeMs = 5 * 60 * 1000 // 5 minutes default
|
|
184
|
+
) {
|
|
185
|
+
const {
|
|
186
|
+
message,
|
|
187
|
+
signature,
|
|
188
|
+
publicKey,
|
|
189
|
+
timestamp
|
|
190
|
+
} = signedMessage;
|
|
191
|
+
|
|
192
|
+
// Check timestamp freshness
|
|
193
|
+
const now = Date.now();
|
|
194
|
+
if (now - timestamp > maxAgeMs) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Verify signature
|
|
199
|
+
const messageWithTimestamp = `${message}:${timestamp}`;
|
|
200
|
+
return SignatureService.verify(messageWithTimestamp, signature, publicKey);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Create a signed authentication challenge response
|
|
205
|
+
* Used for challenge-response authentication
|
|
206
|
+
*/
|
|
207
|
+
static async signChallenge(challenge) {
|
|
208
|
+
const publicKey = await KeyManager.getPublicKey();
|
|
209
|
+
if (!publicKey) {
|
|
210
|
+
throw new Error('No identity found. Please create or import an identity first.');
|
|
211
|
+
}
|
|
212
|
+
const timestamp = Date.now();
|
|
213
|
+
const message = `auth:${publicKey}:${challenge}:${timestamp}`;
|
|
214
|
+
const signature = await SignatureService.sign(message);
|
|
215
|
+
return {
|
|
216
|
+
challenge: signature,
|
|
217
|
+
publicKey,
|
|
218
|
+
timestamp
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Verify a challenge response
|
|
224
|
+
*/
|
|
225
|
+
static async verifyChallengeResponse(originalChallenge, response, maxAgeMs = 5 * 60 * 1000) {
|
|
226
|
+
const {
|
|
227
|
+
challenge: signature,
|
|
228
|
+
publicKey,
|
|
229
|
+
timestamp
|
|
230
|
+
} = response;
|
|
231
|
+
|
|
232
|
+
// Check timestamp freshness
|
|
233
|
+
const now = Date.now();
|
|
234
|
+
if (now - timestamp > maxAgeMs) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const message = `auth:${publicKey}:${originalChallenge}:${timestamp}`;
|
|
238
|
+
return SignatureService.verify(message, signature, publicKey);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Create a registration signature
|
|
243
|
+
* Used when registering a new identity with the server
|
|
244
|
+
* Format matches server expectation: oxy:register:{publicKey}:{timestamp}
|
|
245
|
+
*/
|
|
246
|
+
static async createRegistrationSignature() {
|
|
247
|
+
const publicKey = await KeyManager.getPublicKey();
|
|
248
|
+
if (!publicKey) {
|
|
249
|
+
throw new Error('No identity found. Please create or import an identity first.');
|
|
250
|
+
}
|
|
251
|
+
const timestamp = Date.now();
|
|
252
|
+
const message = `oxy:register:${publicKey}:${timestamp}`;
|
|
253
|
+
const signature = await SignatureService.sign(message);
|
|
254
|
+
return {
|
|
255
|
+
signature,
|
|
256
|
+
publicKey,
|
|
257
|
+
timestamp
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Sign arbitrary data for API requests
|
|
263
|
+
* Creates a canonical string representation and signs it
|
|
264
|
+
*/
|
|
265
|
+
static async signRequestData(data) {
|
|
266
|
+
const publicKey = await KeyManager.getPublicKey();
|
|
267
|
+
if (!publicKey) {
|
|
268
|
+
throw new Error('No identity found. Please create or import an identity first.');
|
|
269
|
+
}
|
|
270
|
+
const timestamp = Date.now();
|
|
271
|
+
|
|
272
|
+
// Create canonical string representation
|
|
273
|
+
const sortedKeys = Object.keys(data).sort();
|
|
274
|
+
const canonicalParts = sortedKeys.map(key => `${key}:${JSON.stringify(data[key])}`);
|
|
275
|
+
const canonicalString = canonicalParts.join('|');
|
|
276
|
+
const message = `request:${publicKey}:${timestamp}:${canonicalString}`;
|
|
277
|
+
const signature = await SignatureService.sign(message);
|
|
278
|
+
return {
|
|
279
|
+
signature,
|
|
280
|
+
publicKey,
|
|
281
|
+
timestamp
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
export default SignatureService;
|
|
286
|
+
//# sourceMappingURL=signatureService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ec","EC","KeyManager","ExpoCrypto","isReactNative","navigator","product","isNodeJS","process","versions","node","initExpoCrypto","sha256","message","Crypto","digestStringAsync","CryptoDigestAlgorithm","SHA256","getCrypto","Function","crypto","createHash","update","digest","error","SignatureService","generateChallenge","randomBytes","getRandomBytesAsync","Array","from","map","b","toString","padStart","join","hashMessage","sign","keyPair","getKeyPairObject","Error","messageHash","signature","toDER","signWithKey","privateKey","keyFromPrivate","verify","publicKey","key","keyFromPublic","verifySync","createSignedMessage","getPublicKey","timestamp","Date","now","messageWithTimestamp","verifySignedMessage","signedMessage","maxAgeMs","signChallenge","challenge","verifyChallengeResponse","originalChallenge","response","createRegistrationSignature","signRequestData","data","sortedKeys","Object","keys","sort","canonicalParts","JSON","stringify","canonicalString"],"sourceRoot":"../../../src","sources":["crypto/signatureService.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,EAAE,IAAIC,EAAE,QAAQ,UAAU;AACnC,SAASC,UAAU,QAAQ,cAAc;;AAEzC;AACA,IAAIC,UAA+C,GAAG,IAAI;AAE1D,MAAMH,EAAE,GAAG,IAAIC,EAAE,CAAC,WAAW,CAAC;;AAE9B;AACA;AACA;AACA,SAASG,aAAaA,CAAA,EAAY;EAChC,OAAO,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,OAAO,KAAK,aAAa;AAChF;;AAEA;AACA;AACA;AACA,SAASC,QAAQA,CAAA,EAAY;EAC3B,OAAO,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,QAAQ,IAAI,IAAI,IAAID,OAAO,CAACC,QAAQ,CAACC,IAAI,IAAI,IAAI;AACpG;;AAEA;AACA;AACA;AACA,eAA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,OAAO;MACL6B,SAAS;MACTM,SAAS;MACTM;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,aAAaa,eAAeA,CAACC,IAA6B,EAIvD;IACD,MAAMpB,SAAS,GAAG,MAAM9C,UAAU,CAACmD,YAAY,CAAC,CAAC;IACjD,IAAI,CAACL,SAAS,EAAE;MACd,MAAM,IAAIR,KAAK,CAAC,+DAA+D,CAAC;IAClF;IAEA,MAAMc,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;;IAE5B;IACA,MAAMa,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,IAAI,CAAC,CAAC;IAC3C,MAAMC,cAAc,GAAGJ,UAAU,CAACtC,GAAG,CAACkB,GAAG,IAAI,GAAGA,GAAG,IAAIyB,IAAI,CAACC,SAAS,CAACP,IAAI,CAACnB,GAAG,CAAC,CAAC,EAAE,CAAC;IACnF,MAAM2B,eAAe,GAAGH,cAAc,CAACtC,IAAI,CAAC,GAAG,CAAC;IAEhD,MAAMtB,OAAO,GAAG,WAAWmC,SAAS,IAAIM,SAAS,IAAIsB,eAAe,EAAE;IACtE,MAAMlC,SAAS,GAAG,MAAMjB,gBAAgB,CAACY,IAAI,CAACxB,OAAO,CAAC;IAEtD,OAAO;MACL6B,SAAS;MACTM,SAAS;MACTM;IACF,CAAC;EACH;AACF;AAEA,eAAe7B,gBAAgB","ignoreList":[]}
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
"enterCode": "Enter the 6‑digit code from your authenticator app.",
|
|
238
238
|
"newPassword": "Set New Password",
|
|
239
239
|
"resetSuccess": "Your password has been reset! You can now sign in.",
|
|
240
|
-
"noEmail": "We no longer send recovery emails. Please use your
|
|
240
|
+
"noEmail": "We no longer send recovery emails. Please use your recovery phrase to restore your identity. Contact support if you need assistance.",
|
|
241
241
|
"password": {
|
|
242
242
|
"minLength": "Password must be at least 8 characters long",
|
|
243
243
|
"mismatch": "Passwords do not match",
|
package/lib/module/index.js
CHANGED
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
* This exports everything but uses environment detection to avoid crashes.
|
|
7
7
|
* - Frontend: Full UI + Core functionality
|
|
8
8
|
* - Backend: Core functionality only (UI components are no-ops)
|
|
9
|
-
*
|
|
10
|
-
* NOTE: Identity management (KeyManager, SignatureService) belongs ONLY in the Accounts app.
|
|
11
|
-
* Services SDK handles tokens/sessions, NOT identity.
|
|
12
9
|
*/
|
|
13
10
|
|
|
14
11
|
// IMPORTANT: Import crypto module first to ensure polyfills are loaded
|
|
15
12
|
// before any other code that might use Buffer or other polyfilled APIs
|
|
16
13
|
import './crypto/polyfill';
|
|
17
14
|
|
|
15
|
+
// Crypto/Identity exports (must be before core to ensure polyfills are available)
|
|
16
|
+
export { KeyManager, SignatureService, RecoveryPhraseService } from './crypto';
|
|
17
|
+
|
|
18
18
|
// Core exports
|
|
19
19
|
export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './core';
|
|
20
20
|
export { OXY_CLOUD_URL, oxyClient } from './core';
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
|
|
22
|
+
// Cross-domain authentication (Web SSO via FedCM/popup/redirect)
|
|
23
|
+
export { CrossDomainAuth, createCrossDomainAuth } from './core';
|
|
24
24
|
// React context
|
|
25
25
|
export { useOxy } from './ui/context/OxyContext';
|
|
26
26
|
|
|
@@ -67,12 +67,9 @@ export { OxyLogo, FollowButton } from './ui';
|
|
|
67
67
|
|
|
68
68
|
// New consolidated utilities
|
|
69
69
|
export * from './utils/apiUtils';
|
|
70
|
-
export { ErrorCodes, createApiError, handleHttpError, validateRequiredFields } from './utils/errorUtils';
|
|
70
|
+
export { ErrorCodes, createApiError, handleHttpError, validateRequiredFields, retryWithBackoff } from './utils/errorUtils';
|
|
71
71
|
export * from './utils/validationUtils';
|
|
72
72
|
export { logger, LogLevel, LogContext, logAuth, logApi, logSession, logUser, logDevice, logPayment, logPerformance } from './utils/loggerUtils';
|
|
73
73
|
export * from './utils/asyncUtils';
|
|
74
74
|
export * from './utils/hookUtils';
|
|
75
|
-
|
|
76
|
-
// Avatar and account utilities
|
|
77
|
-
export { refreshAvatarInStore, refreshAccountInStore, updateAvatarVisibility, updateProfileWithAvatar } from './ui/utils/avatarUtils';
|
|
78
75
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","useOxy","default","OxyProvider","DeviceManager","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode","SECURITY_EVENT_SEVERITY_MAP","useAuthStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","useSessionSocket","setOxyAssetInstance","useFileDownloadUrl","setOxyFileUrlInstance","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useSecurityActivity","useRecentSecurityActivity","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","OxySignInButton","OxyLogo","FollowButton","ErrorCodes","createApiError","handleHttpError","validateRequiredFields","logger","LogLevel","LogContext","logAuth","logApi","logSession","logUser","logDevice","logPayment","logPerformance"
|
|
1
|
+
{"version":3,"names":["KeyManager","SignatureService","RecoveryPhraseService","OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","CrossDomainAuth","createCrossDomainAuth","useOxy","default","OxyProvider","DeviceManager","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode","SECURITY_EVENT_SEVERITY_MAP","useAuthStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","useSessionSocket","setOxyAssetInstance","useFileDownloadUrl","setOxyFileUrlInstance","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useSecurityActivity","useRecentSecurityActivity","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","OxySignInButton","OxyLogo","FollowButton","ErrorCodes","createApiError","handleHttpError","validateRequiredFields","retryWithBackoff","logger","LogLevel","LogContext","logAuth","logApi","logSession","logUser","logDevice","logPayment","logPerformance"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO,mBAAmB;;AAE1B;AACA,SACEA,UAAU,EACVC,gBAAgB,EAChBC,qBAAqB,QAChB,UAAU;;AAEjB;AACA,SAASC,WAAW,EAAEC,sBAAsB,EAAEC,6BAA6B,QAAQ,QAAQ;AAC3F,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;;AAEjD;AACA,SAASC,eAAe,EAAEC,qBAAqB,QAAQ,QAAQ;AAS/D;AACA,SAASC,MAAM,QAAQ,yBAAyB;;AAEhD;AACA,SAASC,OAAO,IAAIC,WAAW,QAAQ,6BAA6B;;AAEpE;AACA,SAASC,aAAa,QAAQ,uBAAuB;AAGrD;AACA,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAuB;;AAG9B;;AA6DA;AACA,SAASC,2BAA2B,QAAQ,qBAAqB;AAQjE;AACA,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SACEC,aAAa,EACbC,S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* IMPORTANT:
|
|
7
|
-
* - id: MongoDB ObjectId (24 hex characters) - PRIMARY IDENTIFIER for all internal operations
|
|
8
|
-
* - publicKey: Cryptographic public key (130 hex characters) - LOOKUP KEY for authentication and identity operations
|
|
9
|
-
*
|
|
10
|
-
* Never use publicKey as an ID. Always use id (ObjectId) for:
|
|
11
|
-
* - Database queries
|
|
12
|
-
* - Session userId
|
|
13
|
-
* - Token userId
|
|
14
|
-
* - Socket room names
|
|
15
|
-
* - API route parameters (unless explicitly doing publicKey lookup)
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
3
|
/**
|
|
19
4
|
* File management interfaces
|
|
20
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SECURITY_EVENT_SEVERITY_MAP"],"sourceRoot":"../../../src","sources":["models/interfaces.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["SECURITY_EVENT_SEVERITY_MAP"],"sourceRoot":"../../../src","sources":["models/interfaces.ts"],"mappings":";;AA2NA;AACA;AACA;;AAmDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAuGA;AACA;AACA;;AAqBA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMA,2BAA6E,GAAG;EAC3F,SAAS,EAAE,KAAK;EAChB,UAAU,EAAE,KAAK;EACjB,iBAAiB,EAAE,KAAK;EACxB,eAAe,EAAE,QAAQ;EACzB,cAAc,EAAE,QAAQ;EACxB,gBAAgB,EAAE,QAAQ;EAC1B,2BAA2B,EAAE,QAAQ;EACrC,kBAAkB,EAAE,MAAM;EAC1B,sBAAsB,EAAE,MAAM;EAC9B,gBAAgB,EAAE,MAAM;EACxB,qBAAqB,EAAE;AACzB,CAAC;;AAED;AACA;AACA;;AAeA;AACA;AACA;;AAkBA","ignoreList":[]}
|