@oxyhq/services 5.15.9 → 5.16.1
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/lib/commonjs/core/OxyServices.js +0 -1
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.assets.js +15 -0
- package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.auth.js +3 -6
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.devices.js +1 -1
- package/lib/commonjs/core/mixins/OxyServices.devices.js.map +1 -1
- package/lib/commonjs/core/mixins/index.js +11 -12
- package/lib/commonjs/core/mixins/index.js.map +1 -1
- package/lib/commonjs/crypto/signatureService.js +3 -2
- package/lib/commonjs/crypto/signatureService.js.map +1 -1
- package/lib/commonjs/i18n/locales/ar-SA.json +1 -9
- package/lib/commonjs/i18n/locales/ca-ES.json +1 -9
- package/lib/commonjs/i18n/locales/de-DE.json +1 -9
- package/lib/commonjs/i18n/locales/en-US.json +3 -21
- package/lib/commonjs/i18n/locales/es-ES.json +3 -21
- package/lib/commonjs/i18n/locales/fr-FR.json +1 -9
- package/lib/commonjs/i18n/locales/it-IT.json +1 -9
- package/lib/commonjs/i18n/locales/ja-JP.json +1 -9
- package/lib/commonjs/i18n/locales/ko-KR.json +1 -9
- package/lib/commonjs/i18n/locales/pt-PT.json +1 -9
- package/lib/commonjs/i18n/locales/zh-CN.json +1 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +24 -4
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +217 -100
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -319
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +16 -7
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +0 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +43 -29
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +14 -1
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/module/core/OxyServices.js +0 -1
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.assets.js +15 -0
- package/lib/module/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.auth.js +3 -6
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.devices.js +1 -1
- package/lib/module/core/mixins/OxyServices.devices.js.map +1 -1
- package/lib/module/core/mixins/index.js +1 -2
- package/lib/module/core/mixins/index.js.map +1 -1
- package/lib/module/crypto/signatureService.js +3 -2
- package/lib/module/crypto/signatureService.js.map +1 -1
- package/lib/module/i18n/locales/ar-SA.json +1 -9
- package/lib/module/i18n/locales/ca-ES.json +1 -9
- package/lib/module/i18n/locales/de-DE.json +1 -9
- package/lib/module/i18n/locales/en-US.json +3 -21
- package/lib/module/i18n/locales/es-ES.json +3 -21
- package/lib/module/i18n/locales/fr-FR.json +1 -9
- package/lib/module/i18n/locales/it-IT.json +1 -9
- package/lib/module/i18n/locales/ja-JP.json +1 -9
- package/lib/module/i18n/locales/ko-KR.json +1 -9
- package/lib/module/i18n/locales/pt-PT.json +1 -9
- package/lib/module/i18n/locales/zh-CN.json +1 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +24 -4
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +217 -100
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +2 -319
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +16 -7
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +0 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +44 -29
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +14 -1
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +0 -1
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts +7 -1
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +3 -4
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts +1 -4
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +2 -64
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/crypto/signatureService.d.ts +2 -1
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +22 -1
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/types/bip39.d.ts +1 -0
- package/lib/typescript/types/buffer.d.ts +1 -0
- package/lib/typescript/types/color.d.ts +1 -0
- package/lib/typescript/types/elliptic.d.ts +1 -0
- package/lib/typescript/types/expo-crypto.d.ts +1 -0
- package/lib/typescript/types/expo-secure-store.d.ts +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +11 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +13 -5
- package/lib/typescript/ui/context/hooks/useAuthOperations.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/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +4 -0
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/core/OxyServices.ts +0 -1
- package/src/core/mixins/OxyServices.assets.ts +16 -1
- package/src/core/mixins/OxyServices.auth.ts +3 -8
- package/src/core/mixins/OxyServices.devices.ts +1 -4
- package/src/core/mixins/index.ts +2 -5
- package/src/crypto/index.ts +1 -0
- package/src/crypto/keyManager.ts +1 -0
- package/src/crypto/polyfill.ts +1 -0
- package/src/crypto/recoveryPhrase.ts +1 -0
- package/src/crypto/signatureService.ts +4 -5
- package/src/i18n/locales/ar-SA.json +1 -9
- package/src/i18n/locales/ca-ES.json +1 -9
- package/src/i18n/locales/de-DE.json +1 -9
- package/src/i18n/locales/en-US.json +3 -21
- package/src/i18n/locales/es-ES.json +3 -21
- package/src/i18n/locales/fr-FR.json +1 -9
- package/src/i18n/locales/it-IT.json +1 -9
- package/src/i18n/locales/ja-JP.json +1 -9
- package/src/i18n/locales/ko-KR.json +1 -9
- package/src/i18n/locales/pt-PT.json +1 -9
- package/src/i18n/locales/zh-CN.json +1 -9
- package/src/index.ts +4 -1
- package/src/models/interfaces.ts +24 -1
- package/src/types/bip39.d.ts +1 -0
- package/src/types/buffer.d.ts +1 -0
- package/src/types/color.d.ts +1 -0
- package/src/types/elliptic.d.ts +1 -0
- package/src/types/expo-crypto.d.ts +1 -0
- package/src/types/expo-secure-store.d.ts +1 -0
- package/src/ui/context/OxyContext.tsx +35 -3
- package/src/ui/context/hooks/useAuthOperations.ts +212 -98
- package/src/ui/screens/AccountSettingsScreen.tsx +1 -201
- package/src/ui/screens/OxyAuthScreen.tsx +16 -8
- package/src/ui/screens/PrivacySettingsScreen.tsx +0 -2
- package/src/ui/screens/SessionManagementScreen.tsx +43 -26
- package/src/ui/stores/authStore.ts +31 -2
- package/lib/commonjs/core/mixins/OxyServices.totp.js +0 -53
- package/lib/commonjs/core/mixins/OxyServices.totp.js.map +0 -1
- package/lib/commonjs/ui/components/profile/TwoFactorSetupModal.js +0 -467
- package/lib/commonjs/ui/components/profile/TwoFactorSetupModal.js.map +0 -1
- package/lib/module/core/mixins/OxyServices.totp.js +0 -49
- package/lib/module/core/mixins/OxyServices.totp.js.map +0 -1
- package/lib/module/ui/components/profile/TwoFactorSetupModal.js +0 -460
- package/lib/module/ui/components/profile/TwoFactorSetupModal.js.map +0 -1
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts +0 -66
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts.map +0 -1
- package/lib/typescript/ui/components/profile/TwoFactorSetupModal.d.ts +0 -11
- package/lib/typescript/ui/components/profile/TwoFactorSetupModal.d.ts.map +0 -1
- package/src/core/mixins/OxyServices.totp.ts +0 -36
- package/src/ui/components/profile/TwoFactorSetupModal.tsx +0 -442
|
@@ -23,10 +23,8 @@ import { EditEmailModal } from '../components/profile/EditEmailModal';
|
|
|
23
23
|
import { EditBioModal } from '../components/profile/EditBioModal';
|
|
24
24
|
import { EditLocationModal } from '../components/profile/EditLocationModal';
|
|
25
25
|
import { EditLinksModal } from '../components/profile/EditLinksModal';
|
|
26
|
-
import { TwoFactorSetupModal } from '../components/profile/TwoFactorSetupModal';
|
|
27
26
|
import { getDisplayName } from '../utils/user-utils';
|
|
28
27
|
import { TTLCache, registerCacheForCleanup } from '../../utils/cache';
|
|
29
|
-
import QRCode from 'react-native-qrcode-svg';
|
|
30
28
|
import { useOxy } from '../context/OxyContext';
|
|
31
29
|
import { SECTION_GAP_LARGE, COMPONENT_GAP, HEADER_PADDING_TOP_SETTINGS, createScreenContentStyle } from '../constants/spacing';
|
|
32
30
|
|
|
@@ -82,14 +80,6 @@ const AccountSettingsScreen = ({
|
|
|
82
80
|
const [quickActionsSectionY, setQuickActionsSectionY] = useState(null);
|
|
83
81
|
const [securitySectionY, setSecuritySectionY] = useState(null);
|
|
84
82
|
|
|
85
|
-
// Two-Factor (TOTP) state
|
|
86
|
-
const [totpSetupUrl, setTotpSetupUrl] = useState(null);
|
|
87
|
-
const [totpCode, setTotpCode] = useState('');
|
|
88
|
-
const [isTotpBusy, setIsTotpBusy] = useState(false);
|
|
89
|
-
const [showRecoveryModal, setShowRecoveryModal] = useState(false);
|
|
90
|
-
const [generatedBackupCodes, setGeneratedBackupCodes] = useState(null);
|
|
91
|
-
const [generatedRecoveryKey, setGeneratedRecoveryKey] = useState(null);
|
|
92
|
-
|
|
93
83
|
// Animation refs
|
|
94
84
|
const saveButtonScale = useRef(new Animated.Value(1)).current;
|
|
95
85
|
|
|
@@ -110,7 +100,6 @@ const AccountSettingsScreen = ({
|
|
|
110
100
|
const [showEditBioModal, setShowEditBioModal] = useState(false);
|
|
111
101
|
const [showEditLocationModal, setShowEditLocationModal] = useState(false);
|
|
112
102
|
const [showEditLinksModal, setShowEditLinksModal] = useState(false);
|
|
113
|
-
const [showTwoFactorModal, setShowTwoFactorModal] = useState(false);
|
|
114
103
|
|
|
115
104
|
// Location and links state (for display only - modals handle editing)
|
|
116
105
|
const [locations, setLocations] = useState([]);
|
|
@@ -295,9 +284,6 @@ const AccountSettingsScreen = ({
|
|
|
295
284
|
case 'links':
|
|
296
285
|
setTempLinksWithMetadata([...linksMetadata]);
|
|
297
286
|
break;
|
|
298
|
-
case 'twoFactor':
|
|
299
|
-
// No temp state needed for twoFactor
|
|
300
|
-
break;
|
|
301
287
|
}
|
|
302
288
|
}, [displayName, lastName, username, email, bio, locations, linksMetadata]);
|
|
303
289
|
const cancelEditing = useCallback(() => {
|
|
@@ -388,8 +374,6 @@ const AccountSettingsScreen = ({
|
|
|
388
374
|
return bio;
|
|
389
375
|
case 'location':
|
|
390
376
|
case 'links':
|
|
391
|
-
case 'twoFactor':
|
|
392
|
-
return '';
|
|
393
377
|
default:
|
|
394
378
|
return '';
|
|
395
379
|
}
|
|
@@ -490,7 +474,6 @@ const AccountSettingsScreen = ({
|
|
|
490
474
|
const handleOpenBioModal = useCallback(() => setShowEditBioModal(true), []);
|
|
491
475
|
const handleOpenLocationModal = useCallback(() => setShowEditLocationModal(true), []);
|
|
492
476
|
const handleOpenLinksModal = useCallback(() => setShowEditLinksModal(true), []);
|
|
493
|
-
const handleOpenTwoFactorModal = useCallback(() => setShowTwoFactorModal(true), []);
|
|
494
477
|
|
|
495
478
|
// Handler to refresh data after modal saves
|
|
496
479
|
// Note: Access user directly from store when invoked to get latest value,
|
|
@@ -569,9 +552,6 @@ const AccountSettingsScreen = ({
|
|
|
569
552
|
case 'links':
|
|
570
553
|
setShowEditLinksModal(true);
|
|
571
554
|
break;
|
|
572
|
-
case 'twoFactor':
|
|
573
|
-
setShowTwoFactorModal(true);
|
|
574
|
-
break;
|
|
575
555
|
}
|
|
576
556
|
}, 300);
|
|
577
557
|
}
|
|
@@ -693,186 +673,9 @@ const AccountSettingsScreen = ({
|
|
|
693
673
|
// Memoize display name for avatar
|
|
694
674
|
const displayNameForAvatar = useMemo(() => getDisplayName(user), [user]);
|
|
695
675
|
|
|
696
|
-
// Legacy renderEditingField function (
|
|
676
|
+
// Legacy renderEditingField function (fallback)
|
|
697
677
|
const renderEditingField = type => {
|
|
698
678
|
if (!type) return null;
|
|
699
|
-
if (type === 'twoFactor') {
|
|
700
|
-
const enabled = !!user?.privacySettings?.twoFactorEnabled;
|
|
701
|
-
return /*#__PURE__*/_jsx(View, {
|
|
702
|
-
style: [styles.editingFieldContainer, {
|
|
703
|
-
backgroundColor: colors.background
|
|
704
|
-
}],
|
|
705
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
706
|
-
style: styles.editingFieldContent,
|
|
707
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
708
|
-
style: styles.newValueSection,
|
|
709
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
710
|
-
style: styles.editingFieldHeader,
|
|
711
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
712
|
-
style: [styles.editingFieldLabel, {
|
|
713
|
-
color: colors.text
|
|
714
|
-
}],
|
|
715
|
-
children: "Two\u2011Factor Authentication (TOTP)"
|
|
716
|
-
})
|
|
717
|
-
}), !enabled ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
718
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
719
|
-
style: styles.editingFieldDescription,
|
|
720
|
-
children: "Protect your account with a 6\u2011digit code from an authenticator app. Scan the QR code then enter the code to enable."
|
|
721
|
-
}), !totpSetupUrl ? /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
722
|
-
style: [styles.primaryButton, {
|
|
723
|
-
backgroundColor: colors.iconSecurity
|
|
724
|
-
}],
|
|
725
|
-
disabled: isTotpBusy,
|
|
726
|
-
onPress: async () => {
|
|
727
|
-
if (!activeSessionId) {
|
|
728
|
-
toast.error(t('editProfile.toasts.noActiveSession') || 'No active session');
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
setIsTotpBusy(true);
|
|
732
|
-
try {
|
|
733
|
-
const {
|
|
734
|
-
otpauthUrl
|
|
735
|
-
} = await oxyServices.startTotpEnrollment(activeSessionId);
|
|
736
|
-
setTotpSetupUrl(otpauthUrl);
|
|
737
|
-
} catch (e) {
|
|
738
|
-
toast.error(e?.message || t('editProfile.toasts.totpStartFailed') || 'Failed to start TOTP enrollment');
|
|
739
|
-
} finally {
|
|
740
|
-
setIsTotpBusy(false);
|
|
741
|
-
}
|
|
742
|
-
},
|
|
743
|
-
children: [/*#__PURE__*/_jsx(Ionicons, {
|
|
744
|
-
name: "shield-checkmark",
|
|
745
|
-
size: 18,
|
|
746
|
-
color: "#fff"
|
|
747
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
748
|
-
style: styles.primaryButtonText,
|
|
749
|
-
children: "Generate QR Code"
|
|
750
|
-
})]
|
|
751
|
-
}) : /*#__PURE__*/_jsxs(View, {
|
|
752
|
-
style: {
|
|
753
|
-
alignItems: 'center',
|
|
754
|
-
gap: 16
|
|
755
|
-
},
|
|
756
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
757
|
-
style: {
|
|
758
|
-
padding: 16,
|
|
759
|
-
backgroundColor: '#fff',
|
|
760
|
-
borderRadius: 16
|
|
761
|
-
},
|
|
762
|
-
children: /*#__PURE__*/_jsx(QRCode, {
|
|
763
|
-
value: totpSetupUrl,
|
|
764
|
-
size: 180
|
|
765
|
-
})
|
|
766
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
767
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
768
|
-
style: styles.editingFieldLabel,
|
|
769
|
-
children: "Enter 6\u2011digit code"
|
|
770
|
-
}), /*#__PURE__*/_jsx(TextInput, {
|
|
771
|
-
style: styles.editingFieldInput,
|
|
772
|
-
keyboardType: "number-pad",
|
|
773
|
-
placeholder: "123456",
|
|
774
|
-
value: totpCode,
|
|
775
|
-
onChangeText: setTotpCode,
|
|
776
|
-
maxLength: 6
|
|
777
|
-
})]
|
|
778
|
-
}), /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
779
|
-
style: [styles.primaryButton, {
|
|
780
|
-
backgroundColor: colors.iconSecurity
|
|
781
|
-
}],
|
|
782
|
-
disabled: isTotpBusy || totpCode.length !== 6,
|
|
783
|
-
onPress: async () => {
|
|
784
|
-
if (!activeSessionId) {
|
|
785
|
-
toast.error(t('editProfile.toasts.noActiveSession') || 'No active session');
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
setIsTotpBusy(true);
|
|
789
|
-
try {
|
|
790
|
-
const result = await oxyServices.verifyTotpEnrollment(activeSessionId, totpCode);
|
|
791
|
-
await updateUser({
|
|
792
|
-
privacySettings: {
|
|
793
|
-
twoFactorEnabled: true
|
|
794
|
-
}
|
|
795
|
-
}, oxyServices);
|
|
796
|
-
if (result?.backupCodes || result?.recoveryKey) {
|
|
797
|
-
setGeneratedBackupCodes(result.backupCodes || null);
|
|
798
|
-
setGeneratedRecoveryKey(result.recoveryKey || null);
|
|
799
|
-
setShowRecoveryModal(true);
|
|
800
|
-
} else {
|
|
801
|
-
toast.success(t('editProfile.toasts.twoFactorEnabled') || 'Two‑Factor Authentication enabled');
|
|
802
|
-
setEditingField(null);
|
|
803
|
-
}
|
|
804
|
-
} catch (e) {
|
|
805
|
-
toast.error(e?.message || t('editProfile.toasts.invalidCode') || 'Invalid code');
|
|
806
|
-
} finally {
|
|
807
|
-
setIsTotpBusy(false);
|
|
808
|
-
}
|
|
809
|
-
},
|
|
810
|
-
children: [/*#__PURE__*/_jsx(Ionicons, {
|
|
811
|
-
name: "checkmark-circle",
|
|
812
|
-
size: 18,
|
|
813
|
-
color: "#fff"
|
|
814
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
815
|
-
style: styles.primaryButtonText,
|
|
816
|
-
children: "Verify & Enable"
|
|
817
|
-
})]
|
|
818
|
-
})]
|
|
819
|
-
})]
|
|
820
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
821
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
822
|
-
style: styles.editingFieldDescription,
|
|
823
|
-
children: "Two\u2011Factor Authentication is currently enabled. To disable, enter a code from your authenticator app."
|
|
824
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
825
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
826
|
-
style: styles.editingFieldLabel,
|
|
827
|
-
children: "Enter 6\u2011digit code"
|
|
828
|
-
}), /*#__PURE__*/_jsx(TextInput, {
|
|
829
|
-
style: styles.editingFieldInput,
|
|
830
|
-
keyboardType: "number-pad",
|
|
831
|
-
placeholder: "123456",
|
|
832
|
-
value: totpCode,
|
|
833
|
-
onChangeText: setTotpCode,
|
|
834
|
-
maxLength: 6
|
|
835
|
-
})]
|
|
836
|
-
}), /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
837
|
-
style: [styles.primaryButton, {
|
|
838
|
-
backgroundColor: colors.sidebarIconSharing
|
|
839
|
-
}],
|
|
840
|
-
disabled: isTotpBusy || totpCode.length !== 6,
|
|
841
|
-
onPress: async () => {
|
|
842
|
-
if (!activeSessionId) {
|
|
843
|
-
toast.error(t('editProfile.toasts.noActiveSession') || 'No active session');
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
setIsTotpBusy(true);
|
|
847
|
-
try {
|
|
848
|
-
await oxyServices.disableTotp(activeSessionId, totpCode);
|
|
849
|
-
await updateUser({
|
|
850
|
-
privacySettings: {
|
|
851
|
-
twoFactorEnabled: false
|
|
852
|
-
}
|
|
853
|
-
}, oxyServices);
|
|
854
|
-
toast.success(t('editProfile.toasts.twoFactorDisabled') || 'Two‑Factor Authentication disabled');
|
|
855
|
-
setEditingField(null);
|
|
856
|
-
} catch (e) {
|
|
857
|
-
toast.error(e?.message || t('editProfile.toasts.disableFailed') || 'Failed to disable');
|
|
858
|
-
} finally {
|
|
859
|
-
setIsTotpBusy(false);
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
children: [/*#__PURE__*/_jsx(Ionicons, {
|
|
863
|
-
name: "close-circle",
|
|
864
|
-
size: 18,
|
|
865
|
-
color: "#fff"
|
|
866
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
867
|
-
style: styles.primaryButtonText,
|
|
868
|
-
children: "Disable 2FA"
|
|
869
|
-
})]
|
|
870
|
-
})]
|
|
871
|
-
})]
|
|
872
|
-
})
|
|
873
|
-
})
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
679
|
if (type === 'displayName') {
|
|
877
680
|
return /*#__PURE__*/_jsx(View, {
|
|
878
681
|
style: [styles.editingFieldContainer, {
|
|
@@ -1468,111 +1271,6 @@ const AccountSettingsScreen = ({
|
|
|
1468
1271
|
}],
|
|
1469
1272
|
children: t('accountOverview.items.editProfile.subtitle') || t('editProfile.subtitle') || 'Manage your profile and preferences'
|
|
1470
1273
|
})]
|
|
1471
|
-
}), showRecoveryModal && /*#__PURE__*/_jsx(View, {
|
|
1472
|
-
style: {
|
|
1473
|
-
position: 'absolute',
|
|
1474
|
-
top: 0,
|
|
1475
|
-
left: 0,
|
|
1476
|
-
right: 0,
|
|
1477
|
-
bottom: 0,
|
|
1478
|
-
backgroundColor: 'rgba(0,0,0,0.6)',
|
|
1479
|
-
zIndex: 50,
|
|
1480
|
-
padding: 16,
|
|
1481
|
-
justifyContent: 'center'
|
|
1482
|
-
},
|
|
1483
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
1484
|
-
style: {
|
|
1485
|
-
backgroundColor: '#fff',
|
|
1486
|
-
borderRadius: 20,
|
|
1487
|
-
padding: 20,
|
|
1488
|
-
maxHeight: '80%'
|
|
1489
|
-
},
|
|
1490
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
1491
|
-
style: {
|
|
1492
|
-
fontSize: 18,
|
|
1493
|
-
fontWeight: '700',
|
|
1494
|
-
marginBottom: 12
|
|
1495
|
-
},
|
|
1496
|
-
children: "Save These Codes Now"
|
|
1497
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
1498
|
-
style: {
|
|
1499
|
-
fontSize: 14,
|
|
1500
|
-
color: '#444',
|
|
1501
|
-
marginBottom: 12
|
|
1502
|
-
},
|
|
1503
|
-
children: "Backup codes and your Recovery Key are shown only once. Store them securely (paper or password manager)."
|
|
1504
|
-
}), generatedBackupCodes && generatedBackupCodes.length > 0 && /*#__PURE__*/_jsxs(View, {
|
|
1505
|
-
style: {
|
|
1506
|
-
marginBottom: 12
|
|
1507
|
-
},
|
|
1508
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
1509
|
-
style: {
|
|
1510
|
-
fontSize: 16,
|
|
1511
|
-
fontWeight: '600',
|
|
1512
|
-
marginBottom: 8
|
|
1513
|
-
},
|
|
1514
|
-
children: "Backup Codes"
|
|
1515
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
1516
|
-
style: {
|
|
1517
|
-
backgroundColor: '#F8F9FA',
|
|
1518
|
-
borderRadius: 12,
|
|
1519
|
-
padding: 12
|
|
1520
|
-
},
|
|
1521
|
-
children: generatedBackupCodes.map((c, idx) => /*#__PURE__*/_jsx(Text, {
|
|
1522
|
-
style: {
|
|
1523
|
-
fontFamily: Platform.OS === 'web' ? 'monospace' : 'monospace',
|
|
1524
|
-
fontSize: 14,
|
|
1525
|
-
marginBottom: 4
|
|
1526
|
-
},
|
|
1527
|
-
children: c
|
|
1528
|
-
}, idx))
|
|
1529
|
-
})]
|
|
1530
|
-
}), generatedRecoveryKey && /*#__PURE__*/_jsxs(View, {
|
|
1531
|
-
style: {
|
|
1532
|
-
marginBottom: 12
|
|
1533
|
-
},
|
|
1534
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
1535
|
-
style: {
|
|
1536
|
-
fontSize: 16,
|
|
1537
|
-
fontWeight: '600',
|
|
1538
|
-
marginBottom: 8
|
|
1539
|
-
},
|
|
1540
|
-
children: "Recovery Key"
|
|
1541
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
1542
|
-
style: {
|
|
1543
|
-
backgroundColor: '#F8F9FA',
|
|
1544
|
-
borderRadius: 12,
|
|
1545
|
-
padding: 12
|
|
1546
|
-
},
|
|
1547
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
1548
|
-
style: {
|
|
1549
|
-
fontFamily: Platform.OS === 'web' ? 'monospace' : 'monospace',
|
|
1550
|
-
fontSize: 14
|
|
1551
|
-
},
|
|
1552
|
-
children: generatedRecoveryKey
|
|
1553
|
-
})
|
|
1554
|
-
})]
|
|
1555
|
-
}), /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
1556
|
-
style: [styles.primaryButton, {
|
|
1557
|
-
backgroundColor: colors.iconSecurity,
|
|
1558
|
-
alignSelf: 'flex-end',
|
|
1559
|
-
marginTop: 8
|
|
1560
|
-
}],
|
|
1561
|
-
onPress: () => {
|
|
1562
|
-
setShowRecoveryModal(false);
|
|
1563
|
-
setEditingField(null);
|
|
1564
|
-
toast.success(t('editProfile.toasts.twoFactorEnabled') || 'Two‑Factor Authentication enabled');
|
|
1565
|
-
},
|
|
1566
|
-
children: [/*#__PURE__*/_jsx(Ionicons, {
|
|
1567
|
-
name: "checkmark",
|
|
1568
|
-
size: 18,
|
|
1569
|
-
color: "#fff"
|
|
1570
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
1571
|
-
style: styles.primaryButtonText,
|
|
1572
|
-
children: "I saved them"
|
|
1573
|
-
})]
|
|
1574
|
-
})]
|
|
1575
|
-
})
|
|
1576
1274
|
}), /*#__PURE__*/_jsxs(View, {
|
|
1577
1275
|
ref: ref => {
|
|
1578
1276
|
avatarSectionRef.current = ref;
|
|
@@ -1803,17 +1501,7 @@ const AccountSettingsScreen = ({
|
|
|
1803
1501
|
}],
|
|
1804
1502
|
children: t('editProfile.sections.security') || 'SECURITY'
|
|
1805
1503
|
}), /*#__PURE__*/_jsx(View, {
|
|
1806
|
-
style: styles.groupedSectionWrapper
|
|
1807
|
-
children: /*#__PURE__*/_jsx(GroupedSection, {
|
|
1808
|
-
items: [{
|
|
1809
|
-
id: 'two-factor',
|
|
1810
|
-
icon: 'shield-lock',
|
|
1811
|
-
iconColor: colors.sidebarIconSecurity,
|
|
1812
|
-
title: t('editProfile.items.twoFactor.title') || 'Two‑Factor Authentication',
|
|
1813
|
-
subtitle: user?.privacySettings?.twoFactorEnabled ? t('editProfile.items.twoFactor.enabled') || 'Enabled' : t('editProfile.items.twoFactor.disabled') || 'Disabled (recommended)',
|
|
1814
|
-
onPress: handleOpenTwoFactorModal
|
|
1815
|
-
}]
|
|
1816
|
-
})
|
|
1504
|
+
style: styles.groupedSectionWrapper
|
|
1817
1505
|
})]
|
|
1818
1506
|
})]
|
|
1819
1507
|
})
|
|
@@ -1854,11 +1542,6 @@ const AccountSettingsScreen = ({
|
|
|
1854
1542
|
initialLinks: linksMetadata,
|
|
1855
1543
|
theme: normalizedTheme,
|
|
1856
1544
|
onSave: handleModalSave
|
|
1857
|
-
}), /*#__PURE__*/_jsx(TwoFactorSetupModal, {
|
|
1858
|
-
visible: showTwoFactorModal,
|
|
1859
|
-
onClose: () => setShowTwoFactorModal(false),
|
|
1860
|
-
isEnabled: !!user?.privacySettings?.twoFactorEnabled,
|
|
1861
|
-
theme: normalizedTheme
|
|
1862
1545
|
})]
|
|
1863
1546
|
});
|
|
1864
1547
|
};
|