@oxyhq/services 5.16.44 → 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 -48
- 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 -45
- 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 -48
- 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
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { toast } from '../../lib/sonner';
|
|
5
|
-
import { useTransferStore } from '../stores/transferStore';
|
|
6
|
-
/**
|
|
7
|
-
* Hook to handle identity transfer completion
|
|
8
|
-
* This hook processes the identity_transfer_complete event and deletes the identity from the source device
|
|
9
|
-
*/
|
|
10
|
-
export function useIdentityTransfer({
|
|
11
|
-
identityCore,
|
|
12
|
-
currentDeviceId,
|
|
13
|
-
activeSessionId,
|
|
14
|
-
getPublicKey,
|
|
15
|
-
deleteIdentityAndClearAccount,
|
|
16
|
-
logger
|
|
17
|
-
}) {
|
|
18
|
-
const getTransferCode = useTransferStore(state => state.getTransferCode);
|
|
19
|
-
const clearTransferCode = useTransferStore(state => state.clearTransferCode);
|
|
20
|
-
const updateTransferState = useTransferStore(state => state.updateTransferState);
|
|
21
|
-
const handleIdentityTransferComplete = useCallback(async data => {
|
|
22
|
-
try {
|
|
23
|
-
logger('Received identity transfer complete notification', {
|
|
24
|
-
transferId: data.transferId,
|
|
25
|
-
sourceDeviceId: data.sourceDeviceId,
|
|
26
|
-
currentDeviceId,
|
|
27
|
-
hasActiveSession: activeSessionId !== null,
|
|
28
|
-
publicKey: data.publicKey.substring(0, 16) + '...'
|
|
29
|
-
});
|
|
30
|
-
const storedTransfer = getTransferCode(data.transferId);
|
|
31
|
-
if (!storedTransfer) {
|
|
32
|
-
logger('Transfer code not found for transferId', {
|
|
33
|
-
transferId: data.transferId
|
|
34
|
-
});
|
|
35
|
-
toast.error('Transfer verification failed: Code not found. Identity will not be deleted.');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const currentPublicKey = await getPublicKey();
|
|
39
|
-
if (!currentPublicKey) {
|
|
40
|
-
logger('No public key found on device - cannot verify transfer', {
|
|
41
|
-
transferId: data.transferId
|
|
42
|
-
});
|
|
43
|
-
toast.error('Transfer verification failed: No identity found on device. Identity will not be deleted.');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const isSourceDevice = currentPublicKey === storedTransfer.publicKey;
|
|
47
|
-
if (!isSourceDevice) {
|
|
48
|
-
logger('Current device public key does not match stored transfer public key - this is not the source device', {
|
|
49
|
-
transferId: data.transferId,
|
|
50
|
-
currentPublicKey: currentPublicKey.substring(0, 16) + '...',
|
|
51
|
-
storedPublicKey: storedTransfer.publicKey.substring(0, 16) + '...'
|
|
52
|
-
});
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const publicKeyMatches = data.publicKey === storedTransfer.publicKey;
|
|
56
|
-
if (!publicKeyMatches) {
|
|
57
|
-
logger('Public key mismatch for transfer', {
|
|
58
|
-
transferId: data.transferId,
|
|
59
|
-
receivedPublicKey: data.publicKey.substring(0, 16) + '...',
|
|
60
|
-
storedPublicKey: storedTransfer.publicKey.substring(0, 16) + '...'
|
|
61
|
-
});
|
|
62
|
-
toast.error('Transfer verification failed: Public key mismatch. Identity will not be deleted.');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const transferAge = Date.now() - storedTransfer.timestamp;
|
|
66
|
-
const tenMinutes = 10 * 60 * 1000;
|
|
67
|
-
if (transferAge > tenMinutes) {
|
|
68
|
-
logger('Transfer confirmation received too late', {
|
|
69
|
-
transferId: data.transferId,
|
|
70
|
-
age: transferAge,
|
|
71
|
-
ageMinutes: Math.round(transferAge / 60000)
|
|
72
|
-
});
|
|
73
|
-
toast.error('Transfer verification failed: Confirmation received too late. Identity will not be deleted.');
|
|
74
|
-
clearTransferCode(data.transferId);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
logger('All transfer verifications passed, deleting identity from source device', {
|
|
78
|
-
transferId: data.transferId,
|
|
79
|
-
sourceDeviceId: data.sourceDeviceId,
|
|
80
|
-
publicKey: data.publicKey.substring(0, 16) + '...'
|
|
81
|
-
});
|
|
82
|
-
try {
|
|
83
|
-
const identityStillExists = identityCore ? await identityCore.hasIdentity() : false;
|
|
84
|
-
if (!identityStillExists) {
|
|
85
|
-
logger('Identity already deleted - skipping deletion', {
|
|
86
|
-
transferId: data.transferId
|
|
87
|
-
});
|
|
88
|
-
await updateTransferState(data.transferId, 'completed');
|
|
89
|
-
await clearTransferCode(data.transferId);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
await deleteIdentityAndClearAccount(false, false, true);
|
|
93
|
-
const identityDeleted = identityCore ? !(await identityCore.hasIdentity()) : true;
|
|
94
|
-
if (!identityDeleted) {
|
|
95
|
-
logger('Identity deletion failed - identity still exists', {
|
|
96
|
-
transferId: data.transferId
|
|
97
|
-
});
|
|
98
|
-
await updateTransferState(data.transferId, 'failed');
|
|
99
|
-
throw new Error('Identity deletion failed - identity still exists');
|
|
100
|
-
}
|
|
101
|
-
await updateTransferState(data.transferId, 'completed');
|
|
102
|
-
await clearTransferCode(data.transferId);
|
|
103
|
-
logger('Identity successfully deleted and transfer code cleared', {
|
|
104
|
-
transferId: data.transferId
|
|
105
|
-
});
|
|
106
|
-
toast.success('Identity successfully transferred and removed from this device');
|
|
107
|
-
} catch (deleteError) {
|
|
108
|
-
logger('Error during identity deletion', deleteError);
|
|
109
|
-
await updateTransferState(data.transferId, 'failed');
|
|
110
|
-
throw deleteError;
|
|
111
|
-
}
|
|
112
|
-
} catch (error) {
|
|
113
|
-
logger('Failed to delete identity after transfer', error);
|
|
114
|
-
toast.error(error?.message || 'Failed to remove identity from this device. Please try again manually from Security Settings.');
|
|
115
|
-
}
|
|
116
|
-
}, [deleteIdentityAndClearAccount, logger, getTransferCode, clearTransferCode, updateTransferState, currentDeviceId, activeSessionId, getPublicKey, identityCore]);
|
|
117
|
-
return {
|
|
118
|
-
handleIdentityTransferComplete
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=useIdentityTransfer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","toast","useTransferStore","useIdentityTransfer","identityCore","currentDeviceId","activeSessionId","getPublicKey","deleteIdentityAndClearAccount","logger","getTransferCode","state","clearTransferCode","updateTransferState","handleIdentityTransferComplete","data","transferId","sourceDeviceId","hasActiveSession","publicKey","substring","storedTransfer","error","currentPublicKey","isSourceDevice","storedPublicKey","publicKeyMatches","receivedPublicKey","transferAge","Date","now","timestamp","tenMinutes","age","ageMinutes","Math","round","identityStillExists","hasIdentity","identityDeleted","Error","success","deleteError","message"],"sourceRoot":"../../../../src","sources":["ui/hooks/useIdentityTransfer.ts"],"mappings":";;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EAAE;UAAEO,UAAU,EAAED,IAAI,CAACC;QAAW,CAAC,CAAC;QAClGf,KAAK,CAACwC,OAAO,CAAC,gEAAgE,CAAC;MACjF,CAAC,CAAC,OAAOC,WAAgB,EAAE;QACzBjC,MAAM,CAAC,gCAAgC,EAAEiC,WAAW,CAAC;QACrD,MAAM7B,mBAAmB,CAACE,IAAI,CAACC,UAAU,EAAE,QAAQ,CAAC;QACpD,MAAM0B,WAAW;MACnB;IACF,CAAC,CAAC,OAAOpB,KAAU,EAAE;MACnBb,MAAM,CAAC,0CAA0C,EAAEa,KAAK,CAAC;MACzDrB,KAAK,CAACqB,KAAK,CAACA,KAAK,EAAEqB,OAAO,IAAI,+FAA+F,CAAC;IAChI;EACF,CAAC,EACD,CAACnC,6BAA6B,EAAEC,MAAM,EAAEC,eAAe,EAAEE,iBAAiB,EAAEC,mBAAmB,EAAER,eAAe,EAAEC,eAAe,EAAEC,YAAY,EAAEH,YAAY,CAC/J,CAAC;EAED,OAAO;IAAEU;EAA+B,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import { useStorage } from './useStorage';
|
|
5
|
-
import { useTransferStore } from '../stores/transferStore';
|
|
6
|
-
const TRANSFER_CODES_STORAGE_KEY = 'oxy_transfer_codes';
|
|
7
|
-
const ACTIVE_TRANSFER_STORAGE_KEY = 'oxy_active_transfer_id';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Hook to handle persistence of transfer codes to storage
|
|
11
|
-
* This hook automatically loads transfer codes on mount and persists them when they change
|
|
12
|
-
*/
|
|
13
|
-
export function useTransferCodesPersistence(storageKeyPrefix = 'oxy_session') {
|
|
14
|
-
const TRANSFER_CODES_KEY = `${storageKeyPrefix}_transfer_codes`;
|
|
15
|
-
const ACTIVE_TRANSFER_KEY = `${storageKeyPrefix}_active_transfer_id`;
|
|
16
|
-
const {
|
|
17
|
-
storage,
|
|
18
|
-
isReady: isStorageReady
|
|
19
|
-
} = useStorage();
|
|
20
|
-
const isRestored = useTransferStore(state => state.isRestored);
|
|
21
|
-
const restoreFromStorage = useTransferStore(state => state.restoreFromStorage);
|
|
22
|
-
const markRestored = useTransferStore(state => state.markRestored);
|
|
23
|
-
const cleanupExpired = useTransferStore(state => state.cleanupExpired);
|
|
24
|
-
const {
|
|
25
|
-
transferCodes,
|
|
26
|
-
activeTransferId
|
|
27
|
-
} = useTransferStore(state => ({
|
|
28
|
-
transferCodes: state.transferCodes,
|
|
29
|
-
activeTransferId: state.activeTransferId
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
// Load transfer codes from storage on startup (only once)
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (!storage || !isStorageReady || isRestored) return;
|
|
35
|
-
const loadTransferCodes = async () => {
|
|
36
|
-
try {
|
|
37
|
-
const storedCodes = await storage.getItem(TRANSFER_CODES_KEY);
|
|
38
|
-
const storedActiveTransferId = await storage.getItem(ACTIVE_TRANSFER_KEY);
|
|
39
|
-
const parsedCodes = storedCodes ? JSON.parse(storedCodes) : {};
|
|
40
|
-
const activeTransferId = storedActiveTransferId || null;
|
|
41
|
-
restoreFromStorage(parsedCodes, activeTransferId);
|
|
42
|
-
markRestored();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
// Mark as restored even on error to prevent retries
|
|
45
|
-
markRestored();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
loadTransferCodes();
|
|
49
|
-
}, [storage, isStorageReady, isRestored, restoreFromStorage, markRestored, TRANSFER_CODES_KEY, ACTIVE_TRANSFER_KEY]);
|
|
50
|
-
|
|
51
|
-
// Persist transfer codes to storage whenever store changes
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (!storage || !isStorageReady || !isRestored) return;
|
|
54
|
-
const persistTransferCodes = async () => {
|
|
55
|
-
try {
|
|
56
|
-
await storage.setItem(TRANSFER_CODES_KEY, JSON.stringify(transferCodes));
|
|
57
|
-
if (activeTransferId) {
|
|
58
|
-
await storage.setItem(ACTIVE_TRANSFER_KEY, activeTransferId);
|
|
59
|
-
} else {
|
|
60
|
-
await storage.removeItem(ACTIVE_TRANSFER_KEY);
|
|
61
|
-
}
|
|
62
|
-
} catch (error) {
|
|
63
|
-
// Silently fail - persistence errors are not critical
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
persistTransferCodes();
|
|
67
|
-
}, [transferCodes, activeTransferId, storage, isStorageReady, isRestored, TRANSFER_CODES_KEY, ACTIVE_TRANSFER_KEY]);
|
|
68
|
-
|
|
69
|
-
// Cleanup expired transfer codes (every minute)
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const cleanup = setInterval(() => {
|
|
72
|
-
cleanupExpired();
|
|
73
|
-
}, 60000);
|
|
74
|
-
return () => clearInterval(cleanup);
|
|
75
|
-
}, [cleanupExpired]);
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=useTransferCodesPersistence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useStorage","useTransferStore","TRANSFER_CODES_STORAGE_KEY","ACTIVE_TRANSFER_STORAGE_KEY","useTransferCodesPersistence","storageKeyPrefix","TRANSFER_CODES_KEY","ACTIVE_TRANSFER_KEY","storage","isReady","isStorageReady","isRestored","state","restoreFromStorage","markRestored","cleanupExpired","transferCodes","activeTransferId","loadTransferCodes","storedCodes","getItem","storedActiveTransferId","parsedCodes","JSON","parse","error","persistTransferCodes","setItem","stringify","removeItem","cleanup","setInterval","clearInterval"],"sourceRoot":"../../../../src","sources":["ui/hooks/useTransferCodesPersistence.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,MAAMC,0BAA0B,GAAG,oBAAoB;AACvD,MAAMC,2BAA2B,GAAG,wBAAwB;;AAE5D;AACA;AACA;AAC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
-
import { useQuery } from '@tanstack/react-query';
|
|
4
|
-
import { useTransferStore } from '../stores/transferStore';
|
|
5
|
-
/**
|
|
6
|
-
* Query keys for transfer-related queries
|
|
7
|
-
*/
|
|
8
|
-
export const transferQueryKeys = {
|
|
9
|
-
pending: () => ['transfers', 'pending']
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Hook to check all pending transfers for completion
|
|
14
|
-
* Used when app comes back online
|
|
15
|
-
*
|
|
16
|
-
* This version accepts oxyServices and isAuthenticated as parameters to avoid
|
|
17
|
-
* circular dependency when used inside OxyContext
|
|
18
|
-
*/
|
|
19
|
-
export const useCheckPendingTransfers = (oxyServices, isAuthenticated) => {
|
|
20
|
-
const getAllPendingTransfers = useTransferStore(state => state.getAllPendingTransfers);
|
|
21
|
-
const pendingTransfers = getAllPendingTransfers();
|
|
22
|
-
return useQuery({
|
|
23
|
-
queryKey: [...transferQueryKeys.pending(), pendingTransfers.map(t => t.transferId).join(',')],
|
|
24
|
-
queryFn: async () => {
|
|
25
|
-
if (!oxyServices || pendingTransfers.length === 0) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
const results = [];
|
|
29
|
-
|
|
30
|
-
// Check each pending transfer
|
|
31
|
-
for (const {
|
|
32
|
-
transferId,
|
|
33
|
-
data
|
|
34
|
-
} of pendingTransfers) {
|
|
35
|
-
try {
|
|
36
|
-
const response = await oxyServices.makeRequest('GET', `/api/identity/check-transfer/${transferId}`, undefined, {
|
|
37
|
-
cache: false
|
|
38
|
-
});
|
|
39
|
-
if (response.completed && response.publicKey === data.publicKey) {
|
|
40
|
-
results.push({
|
|
41
|
-
transferId,
|
|
42
|
-
completed: true,
|
|
43
|
-
data: response
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
results.push({
|
|
47
|
-
transferId,
|
|
48
|
-
completed: false
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
// Handle 401 errors gracefully - skip this transfer
|
|
53
|
-
if (error?.status === 401 || error?.message?.includes('401') || error?.message?.includes('authentication')) {
|
|
54
|
-
if (__DEV__) {
|
|
55
|
-
console.warn(`[useCheckPendingTransfers] Authentication required for transfer ${transferId}, skipping`);
|
|
56
|
-
}
|
|
57
|
-
results.push({
|
|
58
|
-
transferId,
|
|
59
|
-
completed: false
|
|
60
|
-
});
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
// For other errors, mark as not completed
|
|
64
|
-
results.push({
|
|
65
|
-
transferId,
|
|
66
|
-
completed: false
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return results;
|
|
71
|
-
},
|
|
72
|
-
enabled: (isAuthenticated ?? false) && !!oxyServices && pendingTransfers.length > 0,
|
|
73
|
-
staleTime: 30 * 1000,
|
|
74
|
-
// 30 seconds
|
|
75
|
-
gcTime: 5 * 60 * 1000,
|
|
76
|
-
// 5 minutes
|
|
77
|
-
retry: false // Don't retry - we'll check again on next reconnect
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=useTransferQueries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","useTransferStore","transferQueryKeys","pending","useCheckPendingTransfers","oxyServices","isAuthenticated","getAllPendingTransfers","state","pendingTransfers","queryKey","map","t","transferId","join","queryFn","length","results","data","response","makeRequest","undefined","cache","completed","publicKey","push","error","status","message","includes","__DEV__","console","warn","enabled","staleTime","gcTime","retry"],"sourceRoot":"../../../../src","sources":["ui/hooks/useTransferQueries.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,gBAAgB,QAAQ,yBAAyB;AAG1D;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,OAAO,EAAEA,CAAA,KAAM,CAAC,WAAW,EAAE,SAAS;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO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CAAC,IAAIH,KAAK,EAAEE,OAAO,EAAEC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YAC1G,IAAIC,OAAO,EAAE;cACXC,OAAO,CAACC,IAAI,CAAC,mEAAmEnB,UAAU,YAAY,CAAC;YACzG;YACAI,OAAO,CAACQ,IAAI,CAAC;cACXZ,UAAU;cACVU,SAAS,EAAE;YACb,CAAC,CAAC;YACF;UACF;UACA;UACAN,OAAO,CAACQ,IAAI,CAAC;YACXZ,UAAU;YACVU,SAAS,EAAE;UACb,CAAC,CAAC;QACJ;MACF;MAEA,OAAON,OAAO;IAChB,CAAC;IACDgB,OAAO,EAAE,CAAC3B,eAAe,IAAI,KAAK,KAAK,CAAC,CAACD,WAAW,IAAII,gBAAgB,CAACO,MAAM,GAAG,CAAC;IACnFkB,SAAS,EAAE,EAAE,GAAG,IAAI;IAAE;IACtBC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAAE;IACvBC,KAAK,EAAE,KAAK,CAAE;EAChB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { create } from 'zustand';
|
|
4
|
-
import { useShallow } from 'zustand/react/shallow';
|
|
5
|
-
const FIFTEEN_MINUTES = 15 * 60 * 1000;
|
|
6
|
-
const initialState = {
|
|
7
|
-
transferCodes: {},
|
|
8
|
-
activeTransferId: null,
|
|
9
|
-
isRestored: false
|
|
10
|
-
};
|
|
11
|
-
export const useTransferStore = create((set, get) => ({
|
|
12
|
-
...initialState,
|
|
13
|
-
storeTransferCode: (transferId, code, sourceDeviceId, publicKey) => {
|
|
14
|
-
set(state => ({
|
|
15
|
-
transferCodes: {
|
|
16
|
-
...state.transferCodes,
|
|
17
|
-
[transferId]: {
|
|
18
|
-
code,
|
|
19
|
-
sourceDeviceId,
|
|
20
|
-
publicKey,
|
|
21
|
-
timestamp: Date.now(),
|
|
22
|
-
state: 'pending'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
activeTransferId: transferId
|
|
26
|
-
}));
|
|
27
|
-
},
|
|
28
|
-
getTransferCode: transferId => {
|
|
29
|
-
const state = get();
|
|
30
|
-
return state.transferCodes[transferId] || null;
|
|
31
|
-
},
|
|
32
|
-
clearTransferCode: transferId => {
|
|
33
|
-
set(state => {
|
|
34
|
-
const {
|
|
35
|
-
[transferId]: removed,
|
|
36
|
-
...rest
|
|
37
|
-
} = state.transferCodes;
|
|
38
|
-
const newActiveTransferId = state.activeTransferId === transferId ? null : state.activeTransferId;
|
|
39
|
-
return {
|
|
40
|
-
transferCodes: rest,
|
|
41
|
-
activeTransferId: newActiveTransferId
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
updateTransferState: (transferId, newState) => {
|
|
46
|
-
set(state => {
|
|
47
|
-
const existing = state.transferCodes[transferId];
|
|
48
|
-
if (!existing) {
|
|
49
|
-
return state;
|
|
50
|
-
}
|
|
51
|
-
const updated = {
|
|
52
|
-
...existing,
|
|
53
|
-
state: newState
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Clear active transfer if completed or failed
|
|
57
|
-
const newActiveTransferId = (newState === 'completed' || newState === 'failed') && state.activeTransferId === transferId ? null : state.activeTransferId;
|
|
58
|
-
return {
|
|
59
|
-
transferCodes: {
|
|
60
|
-
...state.transferCodes,
|
|
61
|
-
[transferId]: updated
|
|
62
|
-
},
|
|
63
|
-
activeTransferId: newActiveTransferId
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
getAllPendingTransfers: () => {
|
|
68
|
-
const state = get();
|
|
69
|
-
const pending = [];
|
|
70
|
-
Object.entries(state.transferCodes).forEach(([transferId, data]) => {
|
|
71
|
-
if (data.state === 'pending') {
|
|
72
|
-
pending.push({
|
|
73
|
-
transferId,
|
|
74
|
-
data
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return pending;
|
|
79
|
-
},
|
|
80
|
-
getActiveTransferId: () => {
|
|
81
|
-
return get().activeTransferId;
|
|
82
|
-
},
|
|
83
|
-
setActiveTransferId: transferId => {
|
|
84
|
-
set({
|
|
85
|
-
activeTransferId: transferId
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
restoreFromStorage: (codes, activeTransferId) => {
|
|
89
|
-
const now = Date.now();
|
|
90
|
-
const validCodes = {};
|
|
91
|
-
|
|
92
|
-
// Only restore non-expired pending transfers
|
|
93
|
-
Object.entries(codes).forEach(([transferId, data]) => {
|
|
94
|
-
if (data.state === 'pending' && now - data.timestamp < FIFTEEN_MINUTES) {
|
|
95
|
-
validCodes[transferId] = data;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Verify active transfer is still valid
|
|
100
|
-
let validActiveTransferId = activeTransferId;
|
|
101
|
-
if (activeTransferId && (!validCodes[activeTransferId] || validCodes[activeTransferId].state !== 'pending')) {
|
|
102
|
-
validActiveTransferId = null;
|
|
103
|
-
}
|
|
104
|
-
set({
|
|
105
|
-
transferCodes: validCodes,
|
|
106
|
-
activeTransferId: validActiveTransferId,
|
|
107
|
-
isRestored: true
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
markRestored: () => {
|
|
111
|
-
set({
|
|
112
|
-
isRestored: true
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
cleanupExpired: () => {
|
|
116
|
-
const now = Date.now();
|
|
117
|
-
set(state => {
|
|
118
|
-
const validCodes = {};
|
|
119
|
-
let newActiveTransferId = state.activeTransferId;
|
|
120
|
-
Object.entries(state.transferCodes).forEach(([transferId, data]) => {
|
|
121
|
-
const age = now - data.timestamp;
|
|
122
|
-
if (age < FIFTEEN_MINUTES) {
|
|
123
|
-
validCodes[transferId] = data;
|
|
124
|
-
} else if (transferId === state.activeTransferId) {
|
|
125
|
-
newActiveTransferId = null;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return {
|
|
129
|
-
transferCodes: validCodes,
|
|
130
|
-
activeTransferId: newActiveTransferId
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
reset: () => {
|
|
135
|
-
set(initialState);
|
|
136
|
-
},
|
|
137
|
-
clearAll: () => {
|
|
138
|
-
// Delegate to reset to maintain single source of truth
|
|
139
|
-
get().reset();
|
|
140
|
-
}
|
|
141
|
-
}));
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Hook to get transfer codes for persistence
|
|
145
|
-
*/
|
|
146
|
-
export const useTransferCodesForPersistence = () => {
|
|
147
|
-
return useTransferStore(useShallow(state => ({
|
|
148
|
-
transferCodes: state.transferCodes,
|
|
149
|
-
activeTransferId: state.activeTransferId
|
|
150
|
-
})));
|
|
151
|
-
};
|
|
152
|
-
//# sourceMappingURL=transferStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["create","useShallow","FIFTEEN_MINUTES","initialState","transferCodes","activeTransferId","isRestored","useTransferStore","set","get","storeTransferCode","transferId","code","sourceDeviceId","publicKey","state","timestamp","Date","now","getTransferCode","clearTransferCode","removed","rest","newActiveTransferId","updateTransferState","newState","existing","updated","getAllPendingTransfers","pending","Object","entries","forEach","data","push","getActiveTransferId","setActiveTransferId","restoreFromStorage","codes","validCodes","validActiveTransferId","markRestored","cleanupExpired","age","reset","clearAll","useTransferCodesForPersistence"],"sourceRoot":"../../../../src","sources":["ui/stores/transferStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,UAAU,QAAQ,uBAAuB;AAmClD,MAAMC,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAEtC,MAAMC,YAAY,GAAG;EACnBC,aAAa,EAAE,CAAC,CAAqC;EACrDC,gBAAgB,EAAE,IAAqB;EACvCC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGP,MAAM,CAAgB,CAACQ,GAAG,EA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EmC,UAAU;QACzBlC,gBAAgB,EAAEkB;MACpB,CAAC;IACH,CAAC,CAAC;EACJ,CAAC;EAEDqB,KAAK,EAAEA,CAAA,KAAM;IACXpC,GAAG,CAACL,YAAY,CAAC;EACnB,CAAC;EAED0C,QAAQ,EAAEA,CAAA,KAAM;IACd;IACApC,GAAG,CAAC,CAAC,CAACmC,KAAK,CAAC,CAAC;EACf;AACF,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA,OAAO,MAAME,8BAA8B,GAAGA,CAAA,KAAM;EAClD,OAAOvC,gBAAgB,CACrBN,UAAU,CAAEc,KAAK,KAAM;IACrBX,aAAa,EAAEW,KAAK,CAACX,aAAa;IAClCC,gBAAgB,EAAEU,KAAK,CAACV;EAC1B,CAAC,CAAC,CACJ,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo 54 Crypto Adapter
|
|
3
|
-
*
|
|
4
|
-
* Uses expo-crypto which works in both React Native and Web
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Crypto Adapter Interface
|
|
8
|
-
*/
|
|
9
|
-
export interface CryptoAdapter {
|
|
10
|
-
getRandomBytes(length: number): Promise<Uint8Array>;
|
|
11
|
-
digestStringAsync(algorithm: 'SHA256' | 'SHA512', data: string): Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Create Expo Crypto Adapter
|
|
15
|
-
*/
|
|
16
|
-
export declare function createExpoCryptoAdapter(): Promise<CryptoAdapter>;
|
|
17
|
-
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../src/adapters/expo/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,iBAAiB,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,aAAa,CAAC,CAkBtE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo 54 Fetch Adapter
|
|
3
|
-
*
|
|
4
|
-
* Uses native fetch which works in both React Native and Web
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Fetch Adapter Interface
|
|
8
|
-
*/
|
|
9
|
-
export interface FetchAdapter {
|
|
10
|
-
fetch(url: string, options?: RequestInit): Promise<Response>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Create Expo Fetch Adapter
|
|
14
|
-
*/
|
|
15
|
-
export declare function createExpoFetchAdapter(): Promise<FetchAdapter>;
|
|
16
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/adapters/expo/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,YAAY,CAAC,CAUpE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo 54 Platform Adapter
|
|
3
|
-
*
|
|
4
|
-
* Provides storage, crypto, and fetch adapters for Expo 54 (React Native + Web)
|
|
5
|
-
*/
|
|
6
|
-
import { type StorageAdapter } from './storage';
|
|
7
|
-
import { type CryptoAdapter } from './crypto';
|
|
8
|
-
import { type FetchAdapter } from './fetch';
|
|
9
|
-
import type { Platform as PlatformType } from '../../core/identity-session/types';
|
|
10
|
-
/**
|
|
11
|
-
* Platform Adapter Interface
|
|
12
|
-
*/
|
|
13
|
-
export interface PlatformAdapter {
|
|
14
|
-
storage: StorageAdapter;
|
|
15
|
-
crypto: CryptoAdapter;
|
|
16
|
-
fetch: FetchAdapter;
|
|
17
|
-
platform: PlatformType;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Create Expo Platform Adapter
|
|
21
|
-
*/
|
|
22
|
-
export declare function createExpoAdapter(): Promise<PlatformAdapter>;
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/expo/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,CAwBlE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo 54 Storage Adapter
|
|
3
|
-
*
|
|
4
|
-
* Handles storage for React Native (expo-secure-store + AsyncStorage) and Web (localStorage)
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Storage Adapter Interface
|
|
8
|
-
*/
|
|
9
|
-
export interface StorageAdapter {
|
|
10
|
-
secureGet(key: string): Promise<string | null>;
|
|
11
|
-
secureSet(key: string, value: string): Promise<void>;
|
|
12
|
-
secureDelete(key: string): Promise<void>;
|
|
13
|
-
isSecureStorageAvailable(): boolean;
|
|
14
|
-
get(key: string): Promise<string | null>;
|
|
15
|
-
set(key: string, value: string): Promise<void>;
|
|
16
|
-
remove(key: string): Promise<void>;
|
|
17
|
-
clear(): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Create Expo Storage Adapter
|
|
21
|
-
*/
|
|
22
|
-
export declare function createExpoStorageAdapter(): Promise<StorageAdapter>;
|
|
23
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/adapters/expo/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8DH;;GAEG;AACH,MAAM,WAAW,cAAc;IAE7B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,wBAAwB,IAAI,OAAO,CAAC;IAGpC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,cAAc,CAAC,CA4IxE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform Adapters
|
|
3
|
-
*
|
|
4
|
-
* Factory function to create the appropriate platform adapter.
|
|
5
|
-
* Supports Expo 54 (frontend) and Node.js (backend).
|
|
6
|
-
*/
|
|
7
|
-
import { type PlatformAdapter as ExpoPlatformAdapter } from './expo';
|
|
8
|
-
import type { PlatformAdapter as NodePlatformAdapter } from './node';
|
|
9
|
-
export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
|
|
10
|
-
/**
|
|
11
|
-
* Detect platform and create appropriate adapter
|
|
12
|
-
*
|
|
13
|
-
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
14
|
-
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
15
|
-
*/
|
|
16
|
-
export declare function createPlatformAdapter(): Promise<PlatformAdapter>;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAExE;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CA4BtE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node.js Crypto Adapter
|
|
3
|
-
*
|
|
4
|
-
* Uses Node's built-in crypto module
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Crypto Adapter Interface
|
|
8
|
-
*/
|
|
9
|
-
export interface CryptoAdapter {
|
|
10
|
-
getRandomBytes(length: number): Promise<Uint8Array>;
|
|
11
|
-
digestStringAsync(algorithm: 'SHA256' | 'SHA512', data: string): Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Create Node Crypto Adapter
|
|
15
|
-
*/
|
|
16
|
-
export declare function createNodeCryptoAdapter(): Promise<CryptoAdapter>;
|
|
17
|
-
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../src/adapters/node/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,iBAAiB,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,aAAa,CAAC,CAkBtE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node.js Fetch Adapter
|
|
3
|
-
*
|
|
4
|
-
* Uses node-fetch or native fetch (Node 18+)
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Fetch Adapter Interface
|
|
8
|
-
*/
|
|
9
|
-
export interface FetchAdapter {
|
|
10
|
-
fetch(url: string, options?: RequestInit): Promise<Response>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Create Node Fetch Adapter
|
|
14
|
-
*/
|
|
15
|
-
export declare function createNodeFetchAdapter(): Promise<FetchAdapter>;
|
|
16
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/adapters/node/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkCH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,YAAY,CAAC,CASpE"}
|