@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,400 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.IdentityManager = void 0;
|
|
7
|
-
var _errors = require("./errors");
|
|
8
|
-
var _core = require("../../crypto/core");
|
|
9
|
-
/**
|
|
10
|
-
* Identity Manager
|
|
11
|
-
*
|
|
12
|
-
* Manages cryptographic identity (OxyID) - SOLO NATIVE
|
|
13
|
-
* Handles key generation, storage, import, export, and signing operations.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const ec = (0, _core.getEllipticCurve)();
|
|
17
|
-
const STORAGE_KEYS = {
|
|
18
|
-
PRIVATE_KEY: 'oxy_identity_private_key',
|
|
19
|
-
PUBLIC_KEY: 'oxy_identity_public_key',
|
|
20
|
-
BACKUP_PRIVATE_KEY: 'oxy_identity_backup_private_key',
|
|
21
|
-
BACKUP_PUBLIC_KEY: 'oxy_identity_backup_public_key',
|
|
22
|
-
BACKUP_TIMESTAMP: 'oxy_identity_backup_timestamp'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Identity Manager Class
|
|
27
|
-
*/
|
|
28
|
-
class IdentityManager {
|
|
29
|
-
cachedPublicKey = null;
|
|
30
|
-
cachedHasIdentity = null;
|
|
31
|
-
constructor(adapter) {
|
|
32
|
-
this.adapter = adapter;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Invalidate cached identity state
|
|
37
|
-
*/
|
|
38
|
-
invalidateCache() {
|
|
39
|
-
this.cachedPublicKey = null;
|
|
40
|
-
this.cachedHasIdentity = null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Check if identity operations are available (only on native)
|
|
45
|
-
*/
|
|
46
|
-
ensureNativePlatform() {
|
|
47
|
-
if (this.adapter.platform !== 'native') {
|
|
48
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.IDENTITY_NOT_AVAILABLE_ON_WEB, 'Identity operations are only available on native platforms (iOS/Android)');
|
|
49
|
-
}
|
|
50
|
-
if (!this.adapter.storage.isSecureStorageAvailable()) {
|
|
51
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.SECURE_STORAGE_NOT_AVAILABLE, 'Secure storage is not available on this platform');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Convert Uint8Array to hexadecimal string
|
|
57
|
-
*/
|
|
58
|
-
uint8ArrayToHex(bytes) {
|
|
59
|
-
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Generate a new ECDSA secp256k1 key pair
|
|
64
|
-
*/
|
|
65
|
-
async generateKeyPair() {
|
|
66
|
-
this.ensureNativePlatform();
|
|
67
|
-
const randomBytes = await this.adapter.crypto.getRandomBytes(32);
|
|
68
|
-
const privateKeyHex = this.uint8ArrayToHex(randomBytes);
|
|
69
|
-
const keyPair = ec.keyFromPrivate(privateKeyHex);
|
|
70
|
-
return {
|
|
71
|
-
privateKey: keyPair.getPrivate('hex'),
|
|
72
|
-
publicKey: keyPair.getPublic('hex')
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Create a new identity (generate and store key pair)
|
|
78
|
-
*/
|
|
79
|
-
async createIdentity() {
|
|
80
|
-
this.ensureNativePlatform();
|
|
81
|
-
const {
|
|
82
|
-
privateKey,
|
|
83
|
-
publicKey
|
|
84
|
-
} = await this.generateKeyPair();
|
|
85
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PRIVATE_KEY, privateKey);
|
|
86
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PUBLIC_KEY, publicKey);
|
|
87
|
-
|
|
88
|
-
// Update cache
|
|
89
|
-
this.cachedPublicKey = publicKey;
|
|
90
|
-
this.cachedHasIdentity = true;
|
|
91
|
-
return publicKey;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Import an existing key pair (e.g., from backup file)
|
|
96
|
-
*/
|
|
97
|
-
async importKeyPair(privateKey) {
|
|
98
|
-
this.ensureNativePlatform();
|
|
99
|
-
if (!(0, _core.isValidPrivateKey)(privateKey)) {
|
|
100
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.INVALID_PRIVATE_KEY, 'Invalid private key format');
|
|
101
|
-
}
|
|
102
|
-
const keyPair = ec.keyFromPrivate(privateKey);
|
|
103
|
-
const publicKey = keyPair.getPublic('hex');
|
|
104
|
-
if (!(0, _core.isValidPublicKey)(publicKey)) {
|
|
105
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.INVALID_PUBLIC_KEY, 'Failed to derive valid public key from private key');
|
|
106
|
-
}
|
|
107
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PRIVATE_KEY, privateKey);
|
|
108
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PUBLIC_KEY, publicKey);
|
|
109
|
-
|
|
110
|
-
// Update cache
|
|
111
|
-
this.cachedPublicKey = publicKey;
|
|
112
|
-
this.cachedHasIdentity = true;
|
|
113
|
-
return publicKey;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get the stored private key
|
|
118
|
-
* WARNING: Only use this for signing operations within the app
|
|
119
|
-
*/
|
|
120
|
-
async getPrivateKey() {
|
|
121
|
-
this.ensureNativePlatform();
|
|
122
|
-
try {
|
|
123
|
-
return await this.adapter.storage.secureGet(STORAGE_KEYS.PRIVATE_KEY);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.warn('[IdentityManager] Failed to access secure store:', error);
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Get the stored public key (cached for performance)
|
|
132
|
-
*/
|
|
133
|
-
async getPublicKey() {
|
|
134
|
-
if (this.adapter.platform !== 'native') {
|
|
135
|
-
return null; // Identity only exists on native
|
|
136
|
-
}
|
|
137
|
-
if (this.cachedPublicKey !== null) {
|
|
138
|
-
return this.cachedPublicKey;
|
|
139
|
-
}
|
|
140
|
-
try {
|
|
141
|
-
const publicKey = await this.adapter.storage.secureGet(STORAGE_KEYS.PUBLIC_KEY);
|
|
142
|
-
|
|
143
|
-
// Cache result (null is a valid cache value meaning no identity)
|
|
144
|
-
this.cachedPublicKey = publicKey;
|
|
145
|
-
return publicKey;
|
|
146
|
-
} catch (error) {
|
|
147
|
-
// If secure store is not available, return null (no identity)
|
|
148
|
-
this.cachedPublicKey = null;
|
|
149
|
-
console.warn('[IdentityManager] Failed to access secure store:', error);
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Check if an identity (key pair) exists on this device (cached for performance)
|
|
156
|
-
*/
|
|
157
|
-
async hasIdentity() {
|
|
158
|
-
if (this.adapter.platform !== 'native') {
|
|
159
|
-
return false; // Identity only exists on native
|
|
160
|
-
}
|
|
161
|
-
if (this.cachedHasIdentity !== null) {
|
|
162
|
-
return this.cachedHasIdentity;
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
const privateKey = await this.getPrivateKey();
|
|
166
|
-
const hasIdentity = privateKey !== null;
|
|
167
|
-
|
|
168
|
-
// Cache result
|
|
169
|
-
this.cachedHasIdentity = hasIdentity;
|
|
170
|
-
return hasIdentity;
|
|
171
|
-
} catch (error) {
|
|
172
|
-
// If we can't check, assume no identity (safer default)
|
|
173
|
-
this.cachedHasIdentity = false;
|
|
174
|
-
console.warn('[IdentityManager] Failed to check identity:', error);
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Delete the stored identity (both keys)
|
|
181
|
-
*/
|
|
182
|
-
async deleteIdentity(skipBackup = false, force = false, userConfirmed = false) {
|
|
183
|
-
this.ensureNativePlatform();
|
|
184
|
-
|
|
185
|
-
// CRITICAL SAFEGUARD: Require explicit user confirmation unless force is true
|
|
186
|
-
if (!force && !userConfirmed) {
|
|
187
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.IDENTITY_DELETE_FAILED, 'Identity deletion requires explicit user confirmation');
|
|
188
|
-
}
|
|
189
|
-
if (!force) {
|
|
190
|
-
const hasIdentity = await this.hasIdentity();
|
|
191
|
-
if (!hasIdentity) {
|
|
192
|
-
return; // Nothing to delete
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// ALWAYS create backup before deletion unless explicitly skipped
|
|
197
|
-
if (!skipBackup) {
|
|
198
|
-
try {
|
|
199
|
-
const backupSuccess = await this.backupIdentity();
|
|
200
|
-
if (!backupSuccess) {
|
|
201
|
-
console.warn('[IdentityManager] Failed to backup identity before deletion - proceeding anyway');
|
|
202
|
-
}
|
|
203
|
-
} catch (backupError) {
|
|
204
|
-
console.warn('[IdentityManager] Failed to backup identity before deletion:', backupError);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
await this.adapter.storage.secureDelete(STORAGE_KEYS.PRIVATE_KEY);
|
|
208
|
-
await this.adapter.storage.secureDelete(STORAGE_KEYS.PUBLIC_KEY);
|
|
209
|
-
|
|
210
|
-
// Invalidate cache
|
|
211
|
-
this.invalidateCache();
|
|
212
|
-
|
|
213
|
-
// Also clear backup if force deletion
|
|
214
|
-
if (force) {
|
|
215
|
-
try {
|
|
216
|
-
await this.adapter.storage.secureDelete(STORAGE_KEYS.BACKUP_PRIVATE_KEY);
|
|
217
|
-
await this.adapter.storage.secureDelete(STORAGE_KEYS.BACKUP_PUBLIC_KEY);
|
|
218
|
-
await this.adapter.storage.remove(STORAGE_KEYS.BACKUP_TIMESTAMP);
|
|
219
|
-
} catch (error) {
|
|
220
|
-
// Ignore backup deletion errors
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Backup identity to SecureStore (separate backup storage)
|
|
227
|
-
*/
|
|
228
|
-
async backupIdentity() {
|
|
229
|
-
this.ensureNativePlatform();
|
|
230
|
-
try {
|
|
231
|
-
const privateKey = await this.getPrivateKey();
|
|
232
|
-
const publicKey = await this.getPublicKey();
|
|
233
|
-
if (!privateKey || !publicKey) {
|
|
234
|
-
return false; // Nothing to backup
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Store backup in SecureStore (still secure, but separate from primary storage)
|
|
238
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.BACKUP_PRIVATE_KEY, privateKey);
|
|
239
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.BACKUP_PUBLIC_KEY, publicKey);
|
|
240
|
-
await this.adapter.storage.set(STORAGE_KEYS.BACKUP_TIMESTAMP, Date.now().toString());
|
|
241
|
-
return true;
|
|
242
|
-
} catch (error) {
|
|
243
|
-
console.error('[IdentityManager] Failed to backup identity:', error);
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Restore identity from backup if primary storage is corrupted
|
|
250
|
-
*/
|
|
251
|
-
async restoreIdentityFromBackup() {
|
|
252
|
-
this.ensureNativePlatform();
|
|
253
|
-
try {
|
|
254
|
-
// Invalidate cache before restoring to ensure fresh state
|
|
255
|
-
this.invalidateCache();
|
|
256
|
-
|
|
257
|
-
// Check if backup exists
|
|
258
|
-
const backupPrivateKey = await this.adapter.storage.secureGet(STORAGE_KEYS.BACKUP_PRIVATE_KEY);
|
|
259
|
-
const backupPublicKey = await this.adapter.storage.secureGet(STORAGE_KEYS.BACKUP_PUBLIC_KEY);
|
|
260
|
-
if (!backupPrivateKey || !backupPublicKey) {
|
|
261
|
-
return false; // No backup available
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Verify backup integrity
|
|
265
|
-
if (!(0, _core.isValidPrivateKey)(backupPrivateKey)) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
if (!(0, _core.isValidPublicKey)(backupPublicKey)) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Verify keys match
|
|
273
|
-
const derivedPublicKey = (0, _core.derivePublicKey)(backupPrivateKey);
|
|
274
|
-
if (derivedPublicKey !== backupPublicKey) {
|
|
275
|
-
return false; // Backup keys don't match
|
|
276
|
-
}
|
|
277
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PRIVATE_KEY, backupPrivateKey);
|
|
278
|
-
await this.adapter.storage.secureSet(STORAGE_KEYS.PUBLIC_KEY, backupPublicKey);
|
|
279
|
-
const restored = await this.verifyIdentityIntegrity();
|
|
280
|
-
if (restored) {
|
|
281
|
-
// Update cache
|
|
282
|
-
this.cachedPublicKey = backupPublicKey;
|
|
283
|
-
this.cachedHasIdentity = true;
|
|
284
|
-
await this.adapter.storage.set(STORAGE_KEYS.BACKUP_TIMESTAMP, Date.now().toString());
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
return false;
|
|
288
|
-
} catch (error) {
|
|
289
|
-
console.error('[IdentityManager] Failed to restore identity from backup:', error);
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Verify identity integrity - checks if keys are valid and accessible
|
|
296
|
-
*/
|
|
297
|
-
async verifyIdentityIntegrity() {
|
|
298
|
-
this.ensureNativePlatform();
|
|
299
|
-
try {
|
|
300
|
-
const privateKey = await this.getPrivateKey();
|
|
301
|
-
const publicKey = await this.getPublicKey();
|
|
302
|
-
if (!privateKey || !publicKey) {
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Validate private key format
|
|
307
|
-
if (!(0, _core.isValidPrivateKey)(privateKey)) {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Validate public key format
|
|
312
|
-
if (!(0, _core.isValidPublicKey)(publicKey)) {
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Verify public key can be derived from private key
|
|
317
|
-
const derivedPublicKey = (0, _core.derivePublicKey)(privateKey);
|
|
318
|
-
if (derivedPublicKey !== publicKey) {
|
|
319
|
-
return false; // Keys don't match
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// Verify we can create a key pair object (tests elliptic curve operations)
|
|
323
|
-
const keyPair = await this.getKeyPairObject();
|
|
324
|
-
if (!keyPair) {
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
return true;
|
|
328
|
-
} catch (error) {
|
|
329
|
-
console.error('[IdentityManager] Identity integrity check failed:', error);
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Get the elliptic curve key object from the stored private key
|
|
336
|
-
* Used internally for signing operations
|
|
337
|
-
*/
|
|
338
|
-
async getKeyPairObject() {
|
|
339
|
-
this.ensureNativePlatform();
|
|
340
|
-
const privateKey = await this.getPrivateKey();
|
|
341
|
-
if (!privateKey) return null;
|
|
342
|
-
return ec.keyFromPrivate(privateKey);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Decrypt backup data and import identity
|
|
347
|
-
*/
|
|
348
|
-
async decryptAndImportBackup(backupData, password) {
|
|
349
|
-
this.ensureNativePlatform();
|
|
350
|
-
try {
|
|
351
|
-
// Convert hex strings to Uint8Array
|
|
352
|
-
const saltBytes = new Uint8Array(backupData.salt.match(/.{1,2}/g)?.map(byte => parseInt(byte, 16)) || []);
|
|
353
|
-
const ivBytes = new Uint8Array(backupData.iv.match(/.{1,2}/g)?.map(byte => parseInt(byte, 16)) || []);
|
|
354
|
-
|
|
355
|
-
// Derive key from password (same algorithm as EncryptedBackupGenerator)
|
|
356
|
-
const saltHex = Array.from(saltBytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
357
|
-
let key = password + saltHex;
|
|
358
|
-
for (let i = 0; i < 10000; i++) {
|
|
359
|
-
key = await this.adapter.crypto.digestStringAsync('SHA256', key);
|
|
360
|
-
}
|
|
361
|
-
const keyBytes = new Uint8Array(32);
|
|
362
|
-
for (let i = 0; i < 64 && i < key.length; i += 2) {
|
|
363
|
-
keyBytes[i / 2] = parseInt(key.substring(i, i + 2), 16);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Decrypt private key (XOR decryption - same as encryption)
|
|
367
|
-
const encryptedBytes = Buffer.from(backupData.encrypted, 'base64');
|
|
368
|
-
const decryptedBytes = new Uint8Array(encryptedBytes.length);
|
|
369
|
-
for (let i = 0; i < encryptedBytes.length; i++) {
|
|
370
|
-
decryptedBytes[i] = encryptedBytes[i] ^ keyBytes[i % keyBytes.length] ^ ivBytes[i % ivBytes.length];
|
|
371
|
-
}
|
|
372
|
-
const privateKey = new TextDecoder().decode(decryptedBytes);
|
|
373
|
-
|
|
374
|
-
// Import the key pair
|
|
375
|
-
return await this.importKeyPair(privateKey);
|
|
376
|
-
} catch (error) {
|
|
377
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.BACKUP_DECRYPTION_FAILED, `Failed to decrypt backup: ${error instanceof Error ? error.message : String(error)}`);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Sign a challenge using the stored private key
|
|
383
|
-
*/
|
|
384
|
-
async signChallenge(challenge) {
|
|
385
|
-
this.ensureNativePlatform();
|
|
386
|
-
const keyPair = await this.getKeyPairObject();
|
|
387
|
-
if (!keyPair) {
|
|
388
|
-
throw (0, _errors.createIdentitySessionError)(_errors.IdentitySessionErrorCodes.IDENTITY_NOT_FOUND, 'No identity found. Please create or import an identity first.');
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// Hash the challenge
|
|
392
|
-
const messageHash = await this.adapter.crypto.digestStringAsync('SHA256', challenge);
|
|
393
|
-
|
|
394
|
-
// Sign the hash
|
|
395
|
-
const signature = keyPair.sign(messageHash);
|
|
396
|
-
return signature.toDER('hex');
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
exports.IdentityManager = IdentityManager;
|
|
400
|
-
//# sourceMappingURL=IdentityManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","_core","ec","getEllipticCurve","STORAGE_KEYS","PRIVATE_KEY","PUBLIC_KEY","BACKUP_PRIVATE_KEY","BACKUP_PUBLIC_KEY","BACKUP_TIMESTAMP","IdentityManager","cachedPublicKey","cachedHasIdentity","constructor","adapter","invalidateCache","ensureNativePlatform","platform","createIdentitySessionError","IdentitySessionErrorCodes","IDENTITY_NOT_AVAILABLE_ON_WEB","storage","isSecureStorageAvailable","SECURE_STORAGE_NOT_AVAILABLE","uint8ArrayToHex","bytes","Array","from","map","b","toString","padStart","join","generateKeyPair","randomBytes","crypto","getRandomBytes","privateKeyHex","keyPair","keyFromPrivate","privateKey","getPrivate","publicKey","getPublic","createIdentity","secureSet","importKeyPair","isValidPrivateKey","INVALID_PRIVATE_KEY","isValidPublicKey","INVALID_PUBLIC_KEY","getPrivateKey","secureGet","error","console","warn","getPublicKey","hasIdentity","deleteIdentity","skipBackup","force","userConfirmed","IDENTITY_DELETE_FAILED","backupSuccess","backupIdentity","backupError","secureDelete","remove","set","Date","now","restoreIdentityFromBackup","backupPrivateKey","backupPublicKey","derivedPublicKey","derivePublicKey","restored","verifyIdentityIntegrity","getKeyPairObject","decryptAndImportBackup","backupData","password","saltBytes","Uint8Array","salt","match","byte","parseInt","ivBytes","iv","saltHex","key","i","digestStringAsync","keyBytes","length","substring","encryptedBytes","Buffer","encrypted","decryptedBytes","TextDecoder","decode","BACKUP_DECRYPTION_FAILED","Error","message","String","signChallenge","challenge","IDENTITY_NOT_FOUND","messageHash","signature","sign","toDER","exports"],"sourceRoot":"../../../../src","sources":["core/identity-session/IdentityManager.ts"],"mappings":";;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;;AAiBA,MAAME,EAAE,GAAG,IAAAC,sBAAgB,EAAC,CAAC;AAE7B,MAAMC,YAAY,GAAG;EACnBC,WAAW,EAAE,0BAA0B;EACvCC,UAAU,EAAE,yBAAyB;EACrCC,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