// Metro module 14770 (f14771). import { useState, useMemo, useCallback } from "react"; import { NativeModules } from "react-native"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { intl, t } from "../../../../intl/index.native"; import { RadioGroup } from "../../../../design/void/native"; import { isAndroid } from "../../../../utils/PlatformUtils"; import { HTTPResponseError } from "../../../../_bundle/sendRequest"; import { captureWebAuthnException } from "../../../../utils/MFAUtils"; import MfaOptionScreen from "./MfaOptionScreen"; import { KeyImage } from "../components/KeyImage"; import NativeCeremonies from "../../../webauthn/native/NativeCeremonies"; import MFAButton from "../components/button"; let useStyles, c10416_7, c10416_8; const AndroidAuthRadioGroup = function AndroidAuthRadioGroup(props) { const { authenticatorSelection, setAuthenticator, inProgress } = props; return setAuthenticator(event.value)} value={authenticatorSelection} disabled={inProgress} withSpacing />; }; useStyles = createStyles({ radioItem: { backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH, borderRadius: Module712.radii.md } }); c10416_7 = { AUTHENTICATE: 0, 0: "AUTHENTICATE", ANDROID_PASSKEY: 1, 1: "ANDROID_PASSKEY" }; const r43 = {}; r43[c10416_7.AUTHENTICATE] = NativeModules.DCDSecurityKeyManager.authenticate; r43[c10416_7.ANDROID_PASSKEY] = NativeModules.DCDSecurityKeyManager.authenticatePasskey; c10416_8 = r43; export default function WebAuthnScreen(props) { let memo; const { mfaChallenge, finish } = props; memo = void 0; let [disabled, setState] = useState(false); const [error, setState2] = useState(void 0); const [state, setAuthenticator2] = useState(isAndroid() ? c10416_7.ANDROID_PASSKEY : c10416_7.AUTHENTICATE); const [state2, setState3] = useState(false); const challenge = mfaChallenge.methods.find((method) => method.type === "webauthn").challenge; memo = useMemo(() => c10416_8[state], [state]); const callback = useCallback(() => { setState2(void 0); setState(true); memo(challenge).then((result) => finish({ mfaType: "webauthn", data: result })).then(() => setState3(true)).catch((error) => { if (error instanceof HTTPResponseError) { setState2(intl.string(t.xSCvBf)); } else { captureWebAuthnException(error, {}); setState2(error.message); } }).finally(() => setState(false)); }, [memo, challenge, finish]); const props2 = { headerText: intl.string(t.saHocI), subtitle: intl.string(t.YpMrqM), headerImage: , content: NativeCeremonies.shouldDisplayAndroidFidoSelector && , submit: null, screenProps: null, mfaMethod: "webauthn", error: null }; const props3 = { variant: "primary", text: intl.string(t.Xr3Eks), loading: disabled ? disabled : state2, disabled: null, onPress: null }; if (!disabled) { disabled = state2; } props3.disabled = disabled; props3.onPress = callback; props2.submit = ; props2.screenProps = { mfaChallenge, finish }; props2.error = error; return ; }; export { c10416_7 as AuthenticatorOption };