@oxyhq/services 5.16.43 → 5.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -10
- package/lib/commonjs/core/OxyServices.js +1 -1
- package/lib/commonjs/core/index.js +20 -15
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.auth.js +36 -53
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.user.js +10 -17
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/core/services/TokenService.js +27 -13
- package/lib/commonjs/core/services/TokenService.js.map +1 -1
- package/lib/commonjs/crypto/index.js +0 -16
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/crypto/keyManager.js +21 -22
- package/lib/commonjs/crypto/keyManager.js.map +1 -1
- package/lib/commonjs/crypto/polyfill.js +1 -10
- package/lib/commonjs/crypto/polyfill.js.map +1 -1
- package/lib/commonjs/crypto/signatureService.js +18 -32
- package/lib/commonjs/crypto/signatureService.js.map +1 -1
- package/lib/commonjs/index.js +13 -134
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/interfaces.js +0 -7
- package/lib/commonjs/models/interfaces.js.map +1 -1
- package/lib/commonjs/node/index.js +1 -10
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -9
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +779 -450
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +551 -0
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -0
- package/lib/commonjs/ui/context/hooks/useDeviceManagement.js +73 -0
- package/lib/commonjs/ui/context/hooks/useDeviceManagement.js.map +1 -0
- package/lib/commonjs/ui/context/hooks/useStorage.js +79 -0
- package/lib/commonjs/ui/context/hooks/useStorage.js.map +1 -0
- package/lib/commonjs/ui/hooks/index.js +0 -20
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/index.js +0 -12
- package/lib/commonjs/ui/hooks/mutations/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +23 -74
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/index.js +0 -12
- package/lib/commonjs/ui/hooks/queries/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -3
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +28 -64
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +6 -4
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useDeviceManagement.js +73 -0
- package/lib/commonjs/ui/hooks/useDeviceManagement.js.map +1 -0
- package/lib/commonjs/ui/hooks/useProfileEditing.js +5 -3
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +284 -0
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -0
- package/lib/commonjs/ui/index.js +2 -10
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +1 -5
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -9
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +19 -37
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -5
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +15 -2
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +97 -76
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +6 -6
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +6 -54
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/spacing.js +2 -54
- package/lib/commonjs/ui/styles/spacing.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +12 -9
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/sessionHelpers.js +1 -7
- package/lib/commonjs/ui/utils/sessionHelpers.js.map +1 -1
- package/lib/commonjs/utils/deviceManager.js +177 -0
- package/lib/commonjs/utils/deviceManager.js.map +1 -0
- package/lib/commonjs/utils/errorUtils.js +0 -13
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +7 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/sessionUtils.js +1 -8
- package/lib/commonjs/utils/sessionUtils.js.map +1 -1
- package/lib/commonjs/utils/validationUtils.js +1 -15
- package/lib/commonjs/utils/validationUtils.js.map +1 -1
- package/lib/module/core/OxyServices.js +1 -1
- package/lib/module/core/index.js +4 -6
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.auth.js +36 -53
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.user.js +10 -17
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/core/services/TokenService.js +27 -13
- package/lib/module/core/services/TokenService.js.map +1 -1
- package/lib/module/crypto/index.js +0 -3
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/crypto/keyManager.js +21 -22
- package/lib/module/crypto/keyManager.js.map +1 -1
- package/lib/module/crypto/polyfill.js +1 -2
- package/lib/module/crypto/polyfill.js.map +1 -1
- package/lib/module/crypto/signatureService.js +18 -32
- package/lib/module/crypto/signatureService.js.map +1 -1
- package/lib/module/index.js +7 -19
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/interfaces.js +0 -7
- package/lib/module/models/interfaces.js.map +1 -1
- package/lib/module/node/index.js +0 -3
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +2 -6
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +779 -450
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +545 -0
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -0
- package/lib/module/ui/context/hooks/useDeviceManagement.js +68 -0
- package/lib/module/ui/context/hooks/useDeviceManagement.js.map +1 -0
- package/lib/module/ui/context/hooks/useStorage.js +74 -0
- package/lib/module/ui/context/hooks/useStorage.js.map +1 -0
- package/lib/module/ui/hooks/index.js +0 -1
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/mutations/index.js +1 -1
- package/lib/module/ui/hooks/mutations/index.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +21 -71
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/index.js +1 -1
- package/lib/module/ui/hooks/queries/index.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +1 -3
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +27 -61
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +6 -4
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/useDeviceManagement.js +68 -0
- package/lib/module/ui/hooks/useDeviceManagement.js.map +1 -0
- package/lib/module/ui/hooks/useProfileEditing.js +5 -3
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +279 -0
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -0
- package/lib/module/ui/index.js +1 -2
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +1 -5
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +4 -9
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +19 -37
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +15 -2
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +98 -77
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +6 -6
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +6 -54
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/spacing.js +2 -6
- package/lib/module/ui/styles/spacing.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +12 -9
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/ui/utils/sessionHelpers.js +1 -7
- package/lib/module/ui/utils/sessionHelpers.js.map +1 -1
- package/lib/module/utils/deviceManager.js +171 -0
- package/lib/module/utils/deviceManager.js.map +1 -0
- package/lib/module/utils/errorUtils.js +0 -7
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/index.js +1 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/sessionUtils.js +1 -8
- package/lib/module/utils/sessionUtils.js.map +1 -1
- package/lib/module/utils/validationUtils.js +0 -13
- package/lib/module/utils/validationUtils.js.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +1 -1
- package/lib/typescript/core/index.d.ts +3 -3
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +21 -44
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +8 -15
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/core/services/TokenService.d.ts.map +1 -1
- package/lib/typescript/crypto/index.d.ts +0 -1
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/keyManager.d.ts +2 -15
- package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
- package/lib/typescript/crypto/polyfill.d.ts +1 -2
- package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
- package/lib/typescript/crypto/signatureService.d.ts +0 -13
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +7 -12
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +36 -5
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +18 -3
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +0 -1
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts +0 -5
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/helpers.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/types.d.ts +0 -1
- package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +28 -5
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +59 -0
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -0
- package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts +27 -0
- package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts.map +1 -0
- package/lib/typescript/ui/context/hooks/useStorage.d.ts +22 -0
- package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/index.d.ts +0 -1
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/index.d.ts +1 -1
- package/lib/typescript/ui/hooks/mutations/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +8 -19
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts +1 -1
- package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/index.d.ts +1 -1
- package/lib/typescript/ui/hooks/queries/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/queryKeys.d.ts +0 -2
- package/lib/typescript/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +5 -17
- 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/useDeviceManagement.d.ts +27 -0
- package/lib/typescript/ui/hooks/useDeviceManagement.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts +41 -0
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +0 -1
- 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/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +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/authStore.d.ts +1 -8
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/spacing.d.ts +0 -5
- package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +4 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/ui/utils/sessionHelpers.d.ts +0 -1
- package/lib/typescript/ui/utils/sessionHelpers.d.ts.map +1 -1
- package/lib/typescript/utils/deviceManager.d.ts +66 -0
- package/lib/typescript/utils/deviceManager.d.ts.map +1 -0
- package/lib/typescript/utils/errorUtils.d.ts +0 -6
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/sessionUtils.d.ts.map +1 -1
- package/lib/typescript/utils/validationUtils.d.ts +0 -8
- package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/core/OxyServices.ts +1 -1
- package/src/core/index.ts +5 -8
- package/src/core/mixins/OxyServices.auth.ts +44 -87
- package/src/core/mixins/OxyServices.user.ts +10 -18
- package/src/core/services/TokenService.ts +27 -16
- package/src/crypto/index.ts +1 -3
- package/src/crypto/keyManager.ts +21 -30
- package/src/crypto/polyfill.ts +1 -2
- package/src/crypto/signatureService.ts +19 -43
- package/src/index.ts +6 -41
- package/src/models/interfaces.ts +39 -12
- package/src/models/session.ts +19 -7
- package/src/node/index.ts +0 -3
- package/src/ui/components/BottomSheetRouter.tsx +1 -6
- package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
- package/src/ui/components/TextField/helpers.tsx +2 -2
- package/src/ui/components/TextField/types.tsx +1 -1
- package/src/ui/context/OxyContext.tsx +831 -463
- package/src/ui/context/hooks/useAuthOperations.ts +620 -0
- package/src/ui/context/hooks/useDeviceManagement.ts +108 -0
- package/src/ui/context/hooks/useStorage.ts +104 -0
- package/src/ui/hooks/index.ts +1 -2
- package/src/ui/hooks/mutations/index.ts +0 -2
- package/src/ui/hooks/mutations/useAccountMutations.ts +20 -66
- package/src/ui/hooks/queries/index.ts +0 -2
- package/src/ui/hooks/queries/queryKeys.ts +0 -2
- package/src/ui/hooks/queries/useAccountQueries.ts +19 -53
- package/src/ui/hooks/queries/useServicesQueries.ts +5 -5
- package/src/ui/hooks/useDeviceManagement.ts +108 -0
- package/src/ui/hooks/useProfileEditing.ts +3 -3
- package/src/ui/hooks/useSessionManagement.ts +405 -0
- package/src/ui/index.ts +1 -2
- package/src/ui/navigation/routes.ts +2 -6
- package/src/ui/screens/AccountCenterScreen.tsx +4 -9
- package/src/ui/screens/AccountSettingsScreen.tsx +31 -49
- package/src/ui/screens/AccountSwitcherScreen.tsx +5 -5
- package/src/ui/screens/OxyAuthScreen.tsx +19 -4
- package/src/ui/screens/PrivacySettingsScreen.tsx +101 -67
- package/src/ui/screens/ProfileScreen.tsx +10 -10
- package/src/ui/stores/authStore.ts +8 -48
- package/src/ui/styles/spacing.ts +2 -15
- package/src/ui/utils/avatarUtils.ts +21 -19
- package/src/ui/utils/sessionHelpers.ts +0 -7
- package/src/utils/__tests__/validationUtils.test.ts +1 -16
- package/src/utils/deviceManager.ts +198 -0
- package/src/utils/errorUtils.ts +1 -8
- package/src/utils/index.ts +2 -1
- package/src/utils/sessionUtils.ts +0 -8
- package/src/utils/validationUtils.ts +0 -12
- package/lib/commonjs/adapters/expo/crypto.js +0 -56
- package/lib/commonjs/adapters/expo/crypto.js.map +0 -1
- package/lib/commonjs/adapters/expo/fetch.js +0 -30
- package/lib/commonjs/adapters/expo/fetch.js.map +0 -1
- package/lib/commonjs/adapters/expo/index.js +0 -48
- package/lib/commonjs/adapters/expo/index.js.map +0 -1
- package/lib/commonjs/adapters/expo/storage.js +0 -201
- package/lib/commonjs/adapters/expo/storage.js.map +0 -1
- package/lib/commonjs/adapters/index.js +0 -37
- package/lib/commonjs/adapters/index.js.map +0 -1
- package/lib/commonjs/adapters/node/crypto.js +0 -40
- package/lib/commonjs/adapters/node/crypto.js.map +0 -1
- package/lib/commonjs/adapters/node/fetch.js +0 -62
- package/lib/commonjs/adapters/node/fetch.js.map +0 -1
- package/lib/commonjs/adapters/node/index.js +0 -34
- package/lib/commonjs/adapters/node/index.js.map +0 -1
- package/lib/commonjs/adapters/node/storage.js +0 -163
- package/lib/commonjs/adapters/node/storage.js.map +0 -1
- package/lib/commonjs/core/identity-session/DeviceManager.js +0 -237
- package/lib/commonjs/core/identity-session/DeviceManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/lib/commonjs/core/identity-session/IdentityManager.js +0 -400
- package/lib/commonjs/core/identity-session/IdentityManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/IdentitySessionCore.js +0 -394
- package/lib/commonjs/core/identity-session/IdentitySessionCore.js.map +0 -1
- package/lib/commonjs/core/identity-session/RefreshManager.js +0 -137
- package/lib/commonjs/core/identity-session/RefreshManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/SessionManager.js +0 -427
- package/lib/commonjs/core/identity-session/SessionManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/createIdentitySessionCore.js +0 -24
- package/lib/commonjs/core/identity-session/createIdentitySessionCore.js.map +0 -1
- package/lib/commonjs/core/identity-session/errors.js +0 -176
- package/lib/commonjs/core/identity-session/errors.js.map +0 -1
- package/lib/commonjs/core/identity-session/index.js +0 -80
- package/lib/commonjs/core/identity-session/index.js.map +0 -1
- package/lib/commonjs/core/identity-session/types.js +0 -2
- package/lib/commonjs/core/identity-session/types.js.map +0 -1
- package/lib/commonjs/crypto/README.md +0 -142
- package/lib/commonjs/crypto/core.js +0 -147
- package/lib/commonjs/crypto/core.js.map +0 -1
- package/lib/commonjs/node/signatureService.js +0 -107
- package/lib/commonjs/node/signatureService.js.map +0 -1
- package/lib/commonjs/ui/hooks/auth/index.js +0 -37
- package/lib/commonjs/ui/hooks/auth/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js +0 -171
- package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -52
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/commonjs/ui/hooks/useIdentityTransfer.js +0 -125
- package/lib/commonjs/ui/hooks/useIdentityTransfer.js.map +0 -1
- package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js +0 -81
- package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js.map +0 -1
- package/lib/commonjs/ui/hooks/useTransferQueries.js +0 -85
- package/lib/commonjs/ui/hooks/useTransferQueries.js.map +0 -1
- package/lib/commonjs/ui/stores/transferStore.js +0 -157
- package/lib/commonjs/ui/stores/transferStore.js.map +0 -1
- package/lib/module/adapters/expo/crypto.js +0 -51
- package/lib/module/adapters/expo/crypto.js.map +0 -1
- package/lib/module/adapters/expo/fetch.js +0 -26
- package/lib/module/adapters/expo/fetch.js.map +0 -1
- package/lib/module/adapters/expo/index.js +0 -45
- package/lib/module/adapters/expo/index.js.map +0 -1
- package/lib/module/adapters/expo/storage.js +0 -198
- package/lib/module/adapters/expo/storage.js.map +0 -1
- package/lib/module/adapters/index.js +0 -34
- package/lib/module/adapters/index.js.map +0 -1
- package/lib/module/adapters/node/crypto.js +0 -36
- package/lib/module/adapters/node/crypto.js.map +0 -1
- package/lib/module/adapters/node/fetch.js +0 -57
- package/lib/module/adapters/node/fetch.js.map +0 -1
- package/lib/module/adapters/node/index.js +0 -31
- package/lib/module/adapters/node/index.js.map +0 -1
- package/lib/module/adapters/node/storage.js +0 -159
- package/lib/module/adapters/node/storage.js.map +0 -1
- package/lib/module/core/identity-session/DeviceManager.js +0 -232
- package/lib/module/core/identity-session/DeviceManager.js.map +0 -1
- package/lib/module/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/lib/module/core/identity-session/IdentityManager.js +0 -395
- package/lib/module/core/identity-session/IdentityManager.js.map +0 -1
- package/lib/module/core/identity-session/IdentitySessionCore.js +0 -390
- package/lib/module/core/identity-session/IdentitySessionCore.js.map +0 -1
- package/lib/module/core/identity-session/RefreshManager.js +0 -132
- package/lib/module/core/identity-session/RefreshManager.js.map +0 -1
- package/lib/module/core/identity-session/SessionManager.js +0 -422
- package/lib/module/core/identity-session/SessionManager.js.map +0 -1
- package/lib/module/core/identity-session/createIdentitySessionCore.js +0 -21
- package/lib/module/core/identity-session/createIdentitySessionCore.js.map +0 -1
- package/lib/module/core/identity-session/errors.js +0 -170
- package/lib/module/core/identity-session/errors.js.map +0 -1
- package/lib/module/core/identity-session/index.js +0 -17
- package/lib/module/core/identity-session/index.js.map +0 -1
- package/lib/module/core/identity-session/types.js +0 -2
- package/lib/module/core/identity-session/types.js.map +0 -1
- package/lib/module/crypto/README.md +0 -142
- package/lib/module/crypto/core.js +0 -133
- package/lib/module/crypto/core.js.map +0 -1
- package/lib/module/node/signatureService.js +0 -101
- package/lib/module/node/signatureService.js.map +0 -1
- package/lib/module/ui/hooks/auth/index.js +0 -7
- package/lib/module/ui/hooks/auth/index.js.map +0 -1
- package/lib/module/ui/hooks/auth/useUsernameValidation.js +0 -167
- package/lib/module/ui/hooks/auth/useUsernameValidation.js.map +0 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +0 -48
- package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/module/ui/hooks/useIdentityTransfer.js +0 -121
- package/lib/module/ui/hooks/useIdentityTransfer.js.map +0 -1
- package/lib/module/ui/hooks/useTransferCodesPersistence.js +0 -77
- package/lib/module/ui/hooks/useTransferCodesPersistence.js.map +0 -1
- package/lib/module/ui/hooks/useTransferQueries.js +0 -80
- package/lib/module/ui/hooks/useTransferQueries.js.map +0 -1
- package/lib/module/ui/stores/transferStore.js +0 -152
- package/lib/module/ui/stores/transferStore.js.map +0 -1
- package/lib/typescript/adapters/expo/crypto.d.ts +0 -17
- package/lib/typescript/adapters/expo/crypto.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/fetch.d.ts +0 -16
- package/lib/typescript/adapters/expo/fetch.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/index.d.ts +0 -23
- package/lib/typescript/adapters/expo/index.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/storage.d.ts +0 -23
- package/lib/typescript/adapters/expo/storage.d.ts.map +0 -1
- package/lib/typescript/adapters/index.d.ts +0 -17
- package/lib/typescript/adapters/index.d.ts.map +0 -1
- package/lib/typescript/adapters/node/crypto.d.ts +0 -17
- package/lib/typescript/adapters/node/crypto.d.ts.map +0 -1
- package/lib/typescript/adapters/node/fetch.d.ts +0 -16
- package/lib/typescript/adapters/node/fetch.d.ts.map +0 -1
- package/lib/typescript/adapters/node/index.d.ts +0 -23
- package/lib/typescript/adapters/node/index.d.ts.map +0 -1
- package/lib/typescript/adapters/node/storage.d.ts +0 -23
- package/lib/typescript/adapters/node/storage.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/DeviceManager.d.ts +0 -64
- package/lib/typescript/core/identity-session/DeviceManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/IdentityManager.d.ts +0 -88
- package/lib/typescript/core/identity-session/IdentityManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts +0 -141
- package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/RefreshManager.d.ts +0 -36
- package/lib/typescript/core/identity-session/RefreshManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/SessionManager.d.ts +0 -104
- package/lib/typescript/core/identity-session/SessionManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts +0 -11
- package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/errors.d.ts +0 -63
- package/lib/typescript/core/identity-session/errors.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/index.d.ts +0 -14
- package/lib/typescript/core/identity-session/index.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/types.d.ts +0 -196
- package/lib/typescript/core/identity-session/types.d.ts.map +0 -1
- package/lib/typescript/crypto/core.d.ts +0 -56
- package/lib/typescript/crypto/core.d.ts.map +0 -1
- package/lib/typescript/node/signatureService.d.ts +0 -55
- package/lib/typescript/node/signatureService.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/auth/index.d.ts +0 -6
- package/lib/typescript/ui/hooks/auth/index.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts +0 -32
- package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -18
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts +0 -24
- package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts +0 -6
- package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useTransferQueries.d.ts +0 -26
- package/lib/typescript/ui/hooks/useTransferQueries.d.ts.map +0 -1
- package/lib/typescript/ui/stores/transferStore.d.ts +0 -36
- package/lib/typescript/ui/stores/transferStore.d.ts.map +0 -1
- package/src/adapters/expo/crypto.ts +0 -55
- package/src/adapters/expo/fetch.ts +0 -28
- package/src/adapters/expo/index.ts +0 -51
- package/src/adapters/expo/storage.ts +0 -228
- package/src/adapters/index.ts +0 -34
- package/src/adapters/node/crypto.ts +0 -39
- package/src/adapters/node/fetch.ts +0 -59
- package/src/adapters/node/index.ts +0 -37
- package/src/adapters/node/storage.ts +0 -170
- package/src/core/identity-session/DeviceManager.ts +0 -273
- package/src/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/src/core/identity-session/IdentityManager.ts +0 -474
- package/src/core/identity-session/IdentitySessionCore.ts +0 -464
- package/src/core/identity-session/RefreshManager.ts +0 -189
- package/src/core/identity-session/SessionManager.ts +0 -500
- package/src/core/identity-session/createIdentitySessionCore.ts +0 -19
- package/src/core/identity-session/errors.ts +0 -197
- package/src/core/identity-session/index.ts +0 -15
- package/src/core/identity-session/types.ts +0 -188
- package/src/crypto/README.md +0 -142
- package/src/crypto/__tests__/core.test.ts +0 -203
- package/src/crypto/core.ts +0 -142
- package/src/node/signatureService.ts +0 -126
- package/src/ui/hooks/auth/index.ts +0 -9
- package/src/ui/hooks/auth/useUsernameValidation.ts +0 -177
- package/src/ui/hooks/useAvatarPicker.ts +0 -62
- package/src/ui/hooks/useIdentityTransfer.ts +0 -135
- package/src/ui/hooks/useTransferCodesPersistence.ts +0 -80
- package/src/ui/hooks/useTransferQueries.ts +0 -102
- package/src/ui/stores/transferStore.ts +0 -201
package/src/ui/styles/spacing.ts
CHANGED
|
@@ -8,20 +8,7 @@ import { StyleSheet } from 'react-native';
|
|
|
8
8
|
export const STEP_GAP = 12; // Vertical gap between ALL elements (illustration, title, description, textfield, buttons, etc.) - must be consistent everywhere
|
|
9
9
|
export const STEP_INNER_GAP = 12; // Gap within sections (headers, cards, etc.) - must match STEP_GAP for uniformity
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
* Re-export screen spacing constants from constants/spacing.ts
|
|
13
|
-
* This allows importing all spacing constants from a single location
|
|
14
|
-
*/
|
|
15
|
-
export {
|
|
16
|
-
SCREEN_PADDING_HORIZONTAL,
|
|
17
|
-
SCREEN_PADDING_VERTICAL,
|
|
18
|
-
SECTION_GAP,
|
|
19
|
-
SECTION_GAP_LARGE,
|
|
20
|
-
COMPONENT_GAP,
|
|
21
|
-
COMPONENT_GAP_SMALL,
|
|
22
|
-
HEADER_PADDING_TOP_OVERVIEW,
|
|
23
|
-
HEADER_PADDING_TOP_SETTINGS,
|
|
24
|
-
} from '../constants/spacing';
|
|
11
|
+
// Import spacing constants directly from '../constants/spacing' where needed.
|
|
25
12
|
|
|
26
13
|
/**
|
|
27
14
|
* Reusable stylesheet for step components
|
|
@@ -37,7 +24,7 @@ export const stepStyles = StyleSheet.create({
|
|
|
37
24
|
},
|
|
38
25
|
sectionSpacing: {
|
|
39
26
|
// Layout removed - do NOT use for spacing, use explicit marginBottom: 0
|
|
40
|
-
// This
|
|
27
|
+
// This should not add margins
|
|
41
28
|
marginBottom: 0,
|
|
42
29
|
},
|
|
43
30
|
header: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { OxyServices } from '../../core';
|
|
2
2
|
import type { User } from '../../models/interfaces';
|
|
3
3
|
import { useAccountStore } from '../stores/accountStore';
|
|
4
|
-
import { useAuthStore } from '../stores/authStore';
|
|
5
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
5
|
import { queryKeys, invalidateUserQueries, invalidateAccountQueries } from '../hooks/queries/queryKeys';
|
|
7
6
|
|
|
@@ -70,19 +69,20 @@ export async function updateProfileWithAvatar(
|
|
|
70
69
|
oxyServices: OxyServices,
|
|
71
70
|
activeSessionId: string | null,
|
|
72
71
|
queryClient: QueryClient,
|
|
73
|
-
syncIdentity?: () => Promise<User
|
|
72
|
+
options?: { syncIdentity?: () => Promise<User>; deviceId?: string }
|
|
74
73
|
): Promise<User> {
|
|
74
|
+
const { syncIdentity, deviceId } = options || {};
|
|
75
75
|
// Ensure we have a valid token before making the request
|
|
76
76
|
if (!oxyServices.hasValidToken() && activeSessionId) {
|
|
77
77
|
try {
|
|
78
|
-
await oxyServices.getTokenBySession(activeSessionId);
|
|
78
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
79
79
|
} catch (tokenError) {
|
|
80
80
|
const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
|
|
81
81
|
if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
|
|
82
82
|
if (syncIdentity) {
|
|
83
83
|
try {
|
|
84
84
|
await syncIdentity();
|
|
85
|
-
await oxyServices.getTokenBySession(activeSessionId);
|
|
85
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
86
86
|
} catch (syncError) {
|
|
87
87
|
throw new Error('Session needs to be synced. Please try again.');
|
|
88
88
|
}
|
|
@@ -104,9 +104,6 @@ export async function updateProfileWithAvatar(
|
|
|
104
104
|
queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
// Update authStore so frontend components see the changes immediately
|
|
108
|
-
useAuthStore.getState().setUser(data);
|
|
109
|
-
|
|
110
107
|
// If avatar was updated, refresh accountStore with cache-busted URL
|
|
111
108
|
if (updates.avatar && activeSessionId) {
|
|
112
109
|
refreshAvatarInStore(activeSessionId, updates.avatar, oxyServices);
|
|
@@ -122,17 +119,23 @@ export async function updateProfileWithAvatar(
|
|
|
122
119
|
const status = error?.status || error?.response?.status;
|
|
123
120
|
|
|
124
121
|
// Handle authentication errors
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
|
|
123
|
+
if (activeSessionId && syncIdentity) {
|
|
124
|
+
try {
|
|
125
|
+
await syncIdentity();
|
|
126
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
127
|
+
// Retry the update after getting token
|
|
128
|
+
return await updateProfileWithAvatar(
|
|
129
|
+
updates,
|
|
130
|
+
oxyServices,
|
|
131
|
+
activeSessionId,
|
|
132
|
+
queryClient,
|
|
133
|
+
{ syncIdentity, deviceId }
|
|
134
|
+
);
|
|
135
|
+
} catch (retryError) {
|
|
136
|
+
throw new Error('Authentication failed. Please sign in again.');
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
136
139
|
throw new Error('No active session. Please sign in.');
|
|
137
140
|
}
|
|
138
141
|
}
|
|
@@ -140,4 +143,3 @@ export async function updateProfileWithAvatar(
|
|
|
140
143
|
throw error;
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
|
|
@@ -10,7 +10,6 @@ interface DeviceSession {
|
|
|
10
10
|
user?: { id?: string; _id?: { toString(): string } };
|
|
11
11
|
userId?: string;
|
|
12
12
|
isCurrent?: boolean;
|
|
13
|
-
deviceInfo?: import('../../core/identity-session/types').DeviceInfo;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export interface FetchSessionsWithFallbackOptions {
|
|
@@ -58,12 +57,6 @@ export const mapSessionsToClient = (
|
|
|
58
57
|
fallbackUserId ||
|
|
59
58
|
'',
|
|
60
59
|
isCurrent: Boolean(session.isCurrent),
|
|
61
|
-
deviceInfo: session.deviceInfo || {
|
|
62
|
-
deviceName: '',
|
|
63
|
-
deviceType: 'unknown',
|
|
64
|
-
platform: 'unknown',
|
|
65
|
-
lastActive: session.lastActive || now.toISOString(),
|
|
66
|
-
},
|
|
67
60
|
}));
|
|
68
61
|
};
|
|
69
62
|
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
isValidObject,
|
|
7
7
|
isValidEmail,
|
|
8
8
|
isValidUsername,
|
|
9
|
-
isValidPassword,
|
|
10
9
|
isValidUUID,
|
|
11
10
|
isValidDate,
|
|
12
11
|
isValidFileSize,
|
|
@@ -125,20 +124,6 @@ describe('Validation Utils', () => {
|
|
|
125
124
|
});
|
|
126
125
|
});
|
|
127
126
|
|
|
128
|
-
describe('isValidPassword', () => {
|
|
129
|
-
it('should return true for valid passwords', () => {
|
|
130
|
-
expect(isValidPassword('password123')).toBe(true);
|
|
131
|
-
expect(isValidPassword('mySecurePass')).toBe(true);
|
|
132
|
-
expect(isValidPassword('12345678')).toBe(true);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should return false for invalid passwords', () => {
|
|
136
|
-
expect(isValidPassword('')).toBe(false);
|
|
137
|
-
expect(isValidPassword('short')).toBe(false); // too short
|
|
138
|
-
expect(isValidPassword('1234567')).toBe(false); // too short
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
127
|
describe('isValidUUID', () => {
|
|
143
128
|
it('should return true for valid UUIDs', () => {
|
|
144
129
|
expect(isValidUUID('123e4567-e89b-12d3-a456-426614174000')).toBe(true);
|
|
@@ -233,4 +218,4 @@ describe('Validation Utils', () => {
|
|
|
233
218
|
expect(validateAndSanitizeUserInput(123, 'string')).toBeNull();
|
|
234
219
|
});
|
|
235
220
|
});
|
|
236
|
-
});
|
|
221
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export interface DeviceFingerprint {
|
|
2
|
+
userAgent: string;
|
|
3
|
+
platform: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
timezone?: string;
|
|
6
|
+
screen?: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
colorDepth: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface StoredDeviceInfo {
|
|
14
|
+
deviceId: string;
|
|
15
|
+
deviceName?: string;
|
|
16
|
+
fingerprint?: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
lastUsed: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Client-side device management utility
|
|
23
|
+
* Handles persistent device identification across app sessions
|
|
24
|
+
*/
|
|
25
|
+
export class DeviceManager {
|
|
26
|
+
private static DEVICE_KEY = 'oxy_device_info';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Check if we're in React Native environment
|
|
30
|
+
*/
|
|
31
|
+
private static isReactNative(): boolean {
|
|
32
|
+
return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get appropriate storage for the platform
|
|
37
|
+
*/
|
|
38
|
+
private static async getStorage(): Promise<{
|
|
39
|
+
getItem: (key: string) => Promise<string | null>;
|
|
40
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
41
|
+
removeItem: (key: string) => Promise<void>;
|
|
42
|
+
}> {
|
|
43
|
+
if (this.isReactNative()) {
|
|
44
|
+
try {
|
|
45
|
+
const asyncStorageModule = await import('@react-native-async-storage/async-storage');
|
|
46
|
+
const storage = (asyncStorageModule.default as unknown) as import('@react-native-async-storage/async-storage').AsyncStorageStatic;
|
|
47
|
+
return {
|
|
48
|
+
getItem: storage.getItem.bind(storage),
|
|
49
|
+
setItem: storage.setItem.bind(storage),
|
|
50
|
+
removeItem: storage.removeItem.bind(storage),
|
|
51
|
+
};
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('AsyncStorage not available in React Native:', error);
|
|
54
|
+
throw new Error('AsyncStorage is required in React Native environment');
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
// Use localStorage for web
|
|
58
|
+
return {
|
|
59
|
+
getItem: async (key: string) => localStorage.getItem(key),
|
|
60
|
+
setItem: async (key: string, value: string) => localStorage.setItem(key, value),
|
|
61
|
+
removeItem: async (key: string) => localStorage.removeItem(key)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get or create device fingerprint for current device
|
|
68
|
+
*/
|
|
69
|
+
static getDeviceFingerprint(): DeviceFingerprint {
|
|
70
|
+
const fingerprint: DeviceFingerprint = {
|
|
71
|
+
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'unknown',
|
|
72
|
+
platform: typeof navigator !== 'undefined' ? navigator.platform : 'unknown',
|
|
73
|
+
language: typeof navigator !== 'undefined' ? navigator.language : undefined,
|
|
74
|
+
timezone: typeof Intl !== 'undefined' ? Intl.DateTimeFormat().resolvedOptions().timeZone : undefined,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Add screen info if available
|
|
78
|
+
if (typeof screen !== 'undefined') {
|
|
79
|
+
fingerprint.screen = {
|
|
80
|
+
width: screen.width,
|
|
81
|
+
height: screen.height,
|
|
82
|
+
colorDepth: screen.colorDepth
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return fingerprint;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get stored device info or create new one
|
|
91
|
+
*/
|
|
92
|
+
static async getDeviceInfo(): Promise<StoredDeviceInfo> {
|
|
93
|
+
try {
|
|
94
|
+
const storage = await this.getStorage();
|
|
95
|
+
const stored = await storage.getItem(this.DEVICE_KEY);
|
|
96
|
+
|
|
97
|
+
if (stored) {
|
|
98
|
+
const deviceInfo: StoredDeviceInfo = JSON.parse(stored);
|
|
99
|
+
|
|
100
|
+
// Update last used timestamp
|
|
101
|
+
deviceInfo.lastUsed = new Date().toISOString();
|
|
102
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
103
|
+
|
|
104
|
+
return deviceInfo;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Create new device info
|
|
108
|
+
return await this.createNewDeviceInfo();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error('Error getting device info:', error);
|
|
111
|
+
return await this.createNewDeviceInfo();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Create new device info and store it
|
|
117
|
+
*/
|
|
118
|
+
static async createNewDeviceInfo(): Promise<StoredDeviceInfo> {
|
|
119
|
+
const deviceInfo: StoredDeviceInfo = {
|
|
120
|
+
deviceId: this.generateDeviceId(),
|
|
121
|
+
fingerprint: JSON.stringify(this.getDeviceFingerprint()),
|
|
122
|
+
createdAt: new Date().toISOString(),
|
|
123
|
+
lastUsed: new Date().toISOString()
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
127
|
+
return deviceInfo;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Save device info to storage
|
|
132
|
+
*/
|
|
133
|
+
static async saveDeviceInfo(deviceInfo: StoredDeviceInfo): Promise<void> {
|
|
134
|
+
try {
|
|
135
|
+
const storage = await this.getStorage();
|
|
136
|
+
await storage.setItem(this.DEVICE_KEY, JSON.stringify(deviceInfo));
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error('Error saving device info:', error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Update device name
|
|
144
|
+
*/
|
|
145
|
+
static async updateDeviceName(deviceName: string): Promise<void> {
|
|
146
|
+
try {
|
|
147
|
+
const deviceInfo = await this.getDeviceInfo();
|
|
148
|
+
deviceInfo.deviceName = deviceName;
|
|
149
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error('Error updating device name:', error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Clear stored device info (useful for testing or reset)
|
|
157
|
+
*/
|
|
158
|
+
static async clearDeviceInfo(): Promise<void> {
|
|
159
|
+
try {
|
|
160
|
+
const storage = await this.getStorage();
|
|
161
|
+
await storage.removeItem(this.DEVICE_KEY);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error('Error clearing device info:', error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Generate a unique device ID
|
|
169
|
+
*/
|
|
170
|
+
private static generateDeviceId(): string {
|
|
171
|
+
// Use crypto.getRandomValues if available, otherwise fallback to Math.random
|
|
172
|
+
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
173
|
+
const array = new Uint8Array(32);
|
|
174
|
+
crypto.getRandomValues(array);
|
|
175
|
+
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
|
176
|
+
} else {
|
|
177
|
+
// Fallback for environments without crypto.getRandomValues
|
|
178
|
+
return 'device_' + Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get a user-friendly device name based on platform
|
|
184
|
+
*/
|
|
185
|
+
static getDefaultDeviceName(): string {
|
|
186
|
+
const fingerprint = this.getDeviceFingerprint();
|
|
187
|
+
const platform = (fingerprint.platform || '').toLowerCase();
|
|
188
|
+
|
|
189
|
+
if (platform.includes('win')) return 'Windows Computer';
|
|
190
|
+
if (platform.includes('mac')) return 'Mac Computer';
|
|
191
|
+
if (platform.includes('linux')) return 'Linux Computer';
|
|
192
|
+
if (platform.includes('iphone')) return 'iPhone';
|
|
193
|
+
if (platform.includes('ipad')) return 'iPad';
|
|
194
|
+
if (platform.includes('android')) return 'Android Device';
|
|
195
|
+
|
|
196
|
+
return 'Unknown Device';
|
|
197
|
+
}
|
|
198
|
+
}
|
package/src/utils/errorUtils.ts
CHANGED
|
@@ -211,11 +211,4 @@ export function logError(error: unknown, context?: string): void {
|
|
|
211
211
|
method: 'logError',
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Retry function with exponential backoff
|
|
218
|
-
* Re-exports retryAsync for backward compatibility
|
|
219
|
-
* @deprecated Use retryAsync from asyncUtils instead
|
|
220
|
-
*/
|
|
221
|
-
export { retryAsync as retryWithBackoff } from './asyncUtils';
|
|
214
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { DeviceManager } from './deviceManager';
|
|
2
|
+
export type { DeviceFingerprint, StoredDeviceInfo } from './deviceManager';
|
|
2
3
|
|
|
3
4
|
// Request utilities
|
|
4
5
|
export { RequestDeduplicator, RequestQueue, SimpleLogger } from './requestUtils';
|
|
@@ -6,26 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ClientSession } from '../models/session';
|
|
9
|
-
import type { DeviceInfo } from '../core/identity-session/types';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Normalize a session to ensure all required fields are present
|
|
13
12
|
*/
|
|
14
13
|
export function normalizeSession(session: Partial<ClientSession> & { sessionId: string }): ClientSession {
|
|
15
14
|
const now = new Date().toISOString();
|
|
16
|
-
const defaultDeviceInfo: DeviceInfo = {
|
|
17
|
-
deviceName: '',
|
|
18
|
-
deviceType: 'unknown',
|
|
19
|
-
platform: 'unknown',
|
|
20
|
-
lastActive: now,
|
|
21
|
-
};
|
|
22
15
|
return {
|
|
23
16
|
sessionId: session.sessionId,
|
|
24
17
|
deviceId: session.deviceId || '',
|
|
25
18
|
expiresAt: session.expiresAt || now,
|
|
26
19
|
lastActive: session.lastActive || now,
|
|
27
20
|
userId: session.userId || '',
|
|
28
|
-
deviceInfo: session.deviceInfo || defaultDeviceInfo,
|
|
29
21
|
};
|
|
30
22
|
}
|
|
31
23
|
|
|
@@ -12,11 +12,6 @@ export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
12
12
|
*/
|
|
13
13
|
export const USERNAME_REGEX = /^[a-zA-Z0-9_-]{3,30}$/;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Password validation regex (at least 8 chars, 1 uppercase, 1 lowercase, 1 number)
|
|
17
|
-
*/
|
|
18
|
-
// At least 8 characters (tests expect len>=8 without complexity requirements)
|
|
19
|
-
export const PASSWORD_REGEX = /^.{8,}$/;
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
17
|
* Validate email format
|
|
@@ -32,13 +27,6 @@ export function isValidUsername(username: string): boolean {
|
|
|
32
27
|
return USERNAME_REGEX.test(username);
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
/**
|
|
36
|
-
* Validate password strength
|
|
37
|
-
*/
|
|
38
|
-
export function isValidPassword(password: string): boolean {
|
|
39
|
-
return PASSWORD_REGEX.test(password);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
30
|
/**
|
|
43
31
|
* Validate required string
|
|
44
32
|
*/
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createExpoCryptoAdapter = createExpoCryptoAdapter;
|
|
7
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
|
-
/**
|
|
9
|
-
* Expo 54 Crypto Adapter
|
|
10
|
-
*
|
|
11
|
-
* Uses expo-crypto which works in both React Native and Web
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// Lazy import
|
|
15
|
-
let ExpoCrypto = null;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Initialize expo-crypto
|
|
19
|
-
*/
|
|
20
|
-
async function initExpoCrypto() {
|
|
21
|
-
if (!ExpoCrypto) {
|
|
22
|
-
try {
|
|
23
|
-
ExpoCrypto = await Promise.resolve().then(() => _interopRequireWildcard(require('expo-crypto')));
|
|
24
|
-
} catch (error) {
|
|
25
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
26
|
-
throw new Error(`Failed to load expo-crypto: ${errorMessage}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return ExpoCrypto;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Crypto Adapter Interface
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create Expo Crypto Adapter
|
|
38
|
-
*/
|
|
39
|
-
async function createExpoCryptoAdapter() {
|
|
40
|
-
const crypto = await initExpoCrypto();
|
|
41
|
-
return {
|
|
42
|
-
/**
|
|
43
|
-
* Generate cryptographically secure random bytes
|
|
44
|
-
*/
|
|
45
|
-
async getRandomBytes(length) {
|
|
46
|
-
return crypto.getRandomBytes(length);
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Hash a string using the specified algorithm
|
|
50
|
-
*/
|
|
51
|
-
async digestStringAsync(algorithm, data) {
|
|
52
|
-
return crypto.digestStringAsync(algorithm, data);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=crypto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ExpoCrypto","initExpoCrypto","Promise","resolve","then","_interopRequireWildcard","require","error","errorMessage","Error","message","String","createExpoCryptoAdapter","crypto","getRandomBytes","length","digestStringAsync","algorithm","data"],"sourceRoot":"../../../../src","sources":["adapters/expo/crypto.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAIA,UAA+C,GAAG,IAAI;;AAE1D;AACA;AACA;AACA,eAAeC,cAAcA,CAAA,EAA0C;EACrE,IAAI,CAACD,UAAU,EAAE;IACf,IAAI;MACFA,UAAU,GAAG,MAAAE,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAC,uBAAA,CAAAC,OAAA,CAAa,aAAa,GAAC;IAC1C,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAMC,YAAY,GAAGD,KAAK,YAAYE,KAAK,GAAGF,KAAK,CAACG,OAAO,GAAGC,MAAM,CAACJ,KAAK,CAAC;MAC3E,MAAM,IAAIE,KAAK,CAAC,+BAA+BD,YAAY,EAAE,CAAC;IAChE;EACF;EACA,OAAOR,UAAU;AACnB;;AAEA;AACA;AACA;;AAMA;AACA;AACA;AACO,eAAeY,uBAAuBA,CAAA,EAA2B;EACtE,MAAMC,MAAM,GAAG,MAAMZ,cAAc,CAAC,CAAC;EAErC,OAAO;IACL;AACJ;AACA;IACI,MAAMa,cAAcA,CAACC,MAAc,EAAuB;MACxD,OAAOF,MAAM,CAACC,cAAc,CAACC,MAAM,CAAC;IACtC,CAAC;IAED;AACJ;AACA;IACI,MAAMC,iBAAiBA,CAACC,SAA8B,EAAEC,IAAY,EAAmB;MACrF,OAAOL,MAAM,CAACG,iBAAiB,CAACC,SAAS,EAAEC,IAAI,CAAC;IAClD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createExpoFetchAdapter = createExpoFetchAdapter;
|
|
7
|
-
/**
|
|
8
|
-
* Expo 54 Fetch Adapter
|
|
9
|
-
*
|
|
10
|
-
* Uses native fetch which works in both React Native and Web
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Fetch Adapter Interface
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Create Expo Fetch Adapter
|
|
19
|
-
*/
|
|
20
|
-
async function createExpoFetchAdapter() {
|
|
21
|
-
if (typeof fetch === 'undefined') {
|
|
22
|
-
throw new Error('fetch is not available in this environment');
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
fetch(url, options) {
|
|
26
|
-
return fetch(url, options);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createExpoFetchAdapter","fetch","Error","url","options"],"sourceRoot":"../../../../src","sources":["adapters/expo/fetch.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;AACO,eAAeA,sBAAsBA,CAAA,EAA0B;EACpE,IAAI,OAAOC,KAAK,KAAK,WAAW,EAAE;IAChC,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EAEA,OAAO;IACLD,KAAKA,CAACE,GAAW,EAAEC,OAAqB,EAAqB;MAC3D,OAAOH,KAAK,CAACE,GAAG,EAAEC,OAAO,CAAC;IAC5B;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createExpoAdapter = createExpoAdapter;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _storage = require("./storage");
|
|
9
|
-
var _crypto = require("./crypto");
|
|
10
|
-
var _fetch = require("./fetch");
|
|
11
|
-
/**
|
|
12
|
-
* Expo 54 Platform Adapter
|
|
13
|
-
*
|
|
14
|
-
* Provides storage, crypto, and fetch adapters for Expo 54 (React Native + Web)
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Platform Adapter Interface
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create Expo Platform Adapter
|
|
23
|
-
*/
|
|
24
|
-
async function createExpoAdapter() {
|
|
25
|
-
const storage = await (0, _storage.createExpoStorageAdapter)();
|
|
26
|
-
const crypto = await (0, _crypto.createExpoCryptoAdapter)();
|
|
27
|
-
const fetchAdapter = await (0, _fetch.createExpoFetchAdapter)();
|
|
28
|
-
|
|
29
|
-
// Determine platform
|
|
30
|
-
let platform = 'web';
|
|
31
|
-
try {
|
|
32
|
-
if (_reactNative.Platform.OS !== 'web') {
|
|
33
|
-
platform = 'native';
|
|
34
|
-
}
|
|
35
|
-
} catch {
|
|
36
|
-
// Fallback detection
|
|
37
|
-
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
38
|
-
platform = 'native';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
storage,
|
|
43
|
-
crypto,
|
|
44
|
-
fetch: fetchAdapter,
|
|
45
|
-
platform
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_storage","_crypto","_fetch","createExpoAdapter","storage","createExpoStorageAdapter","crypto","createExpoCryptoAdapter","fetchAdapter","createExpoFetchAdapter","platform","Platform","OS","navigator","product","fetch"],"sourceRoot":"../../../../src","sources":["adapters/expo/index.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;AACA;AACA;AACO,eAAeI,iBAAiBA,CAAA,EAA6B;EAClE,MAAMC,OAAO,GAAG,MAAM,IAAAC,iCAAwB,EAAC,CAAC;EAChD,MAAMC,MAAM,GAAG,MAAM,IAAAC,+BAAuB,EAAC,CAAC;EAC9C,MAAMC,YAAY,GAAG,MAAM,IAAAC,6BAAsB,EAAC,CAAC;;EAEnD;EACA,IAAIC,QAAsB,GAAG,KAAK;EAClC,IAAI;IACF,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzBF,QAAQ,GAAG,QAAQ;IACrB;EACF,CAAC,CAAC,MAAM;IACN;IACA,IAAI,OAAOG,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,OAAO,KAAK,aAAa,EAAE;MAC3EJ,QAAQ,GAAG,QAAQ;IACrB;EACF;EAEA,OAAO;IACLN,OAAO;IACPE,MAAM;IACNS,KAAK,EAAEP,YAAY;IACnBE;EACF,CAAC;AACH","ignoreList":[]}
|