Files
discord-decomp/sources/modules/mfa/native/screens/WebAuthnScreen.tsx
T
2026-07-28 01:06:53 +03:00

174 lines
10 KiB
TypeScript

/* Metro module 14213; source: modules/mfa/native/screens/WebAuthnScreen.tsx; dependencies: [57, 31, 27, 33, 4501, 697, 1244, 1305, 477, 507, 8980, 14214, 13262, 8978, 14217, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import MfaOptionScreen from './MfaOptionScreen.tsx'; /* Metro dependency 14214 */
import Button from '../components/button.tsx'; /* Metro dependency 14217 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as PlatformUtilsModule from '../../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as HTTPUtilsModule from '../../../../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as NativeModule from '../../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as KeyImageModule from '../components/KeyImage.tsx'; /* Metro dependency 13262 */
function _fun107488(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:6, offset: 0x022fe3c2, size: 367 bytes, params: 8, frame: 25
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const NativeModules = (ReactNativeModule).NativeModules;
const createStyles = CreateStylesModule.createStyles;
const object2 = {};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object2.backgroundColor = BACKGROUND_SURFACE_HIGH;
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
const env0_6 = Reflect.apply(createStyles, CreateStylesModule, [{radioItem: object2}]);
object = {AUTHENTICATE: 0};
object[0] = 'AUTHENTICATE';
object.ANDROID_PASSKEY = 1;
object[1] = 'ANDROID_PASSKEY';
const object3 = {};
const AUTHENTICATE = object.AUTHENTICATE;
let DCDSecurityKeyManager = NativeModules.DCDSecurityKeyManager;
object3[AUTHENTICATE] = DCDSecurityKeyManager.authenticate;
const ANDROID_PASSKEY = object.ANDROID_PASSKEY;
DCDSecurityKeyManager = NativeModules.DCDSecurityKeyManager;
object3[ANDROID_PASSKEY] = DCDSecurityKeyManager.authenticatePasskey;
(FileImportTrackerModule).fileFinishedImporting('modules/mfa/native/screens/WebAuthnScreen.tsx');
exports.default = WebAuthnScreen;
exports.AuthenticatorOption = object;
function AndroidAuthRadioGroup({authenticatorSelection, setAuthenticator, inProgress}) { // fn#107489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:504, offset: 0x022fe531, size: 268 bytes, params: 2, frame: 22
const styles = useStyles();
let object = {};
const ANDROID_PASSKEY = env0_7.ANDROID_PASSKEY;
object.value = ANDROID_PASSKEY;
const intl = (IndexNativeModule).intl;
let string = intl.string;
const PVVXRI = (IndexNativeModule).t.PVVXRI;
object.name = Reflect.apply(string, intl, [PVVXRI]);
const items2 = [object];
object = {};
const AUTHENTICATE = env0_7.AUTHENTICATE;
object.value = AUTHENTICATE;
string = intl.string;
const TKop3X = (IndexNativeModule).t.TKop3X;
object.name = Reflect.apply(string, intl, [TKop3X]);
items2[1] = object;
const RadioGroup = (NativeModule).RadioGroup;
return (
<RadioGroup
style={styles.radioItem}
options={items2}
onChange={function({value}) {
return setAuthenticator(value);
}}
value={authenticatorSelection}
disabled={inProgress}
withSpacing
/>
);
}
function WebAuthnScreen({mfaChallenge, finish}) { // fn#107491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:954, offset: 0x022fe63d, size: 729 bytes, params: 2, frame: 29
let env0_4 = undefined;
let binding = env0_4;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, [false]);
const binding2 = undefined;
const value3 = binding2(value2, 2);
const property = value3[0];
const env0_1 = value3[1];
useState = binding.useState;
const value4 = binding2(Reflect.apply(useState, binding, [undefined]), 2);
const property2 = value4[0];
const env0_2 = value4[1];
useState = binding.useState;
const isAndroid2 = (PlatformUtilsModule).isAndroid();
const binding3 = env0_7;
const value5 = Reflect.apply(useState, binding, [isAndroid2 ? binding3.ANDROID_PASSKEY : binding3.AUTHENTICATE]);
binding = undefined;
const value6 = binding(value5, 2);
const property3 = value6[0];
const property4 = value6[1];
const binding4 = env0_4;
useState = binding4.useState;
const value7 = binding(Reflect.apply(useState, binding4, [false]), 2);
const property5 = value7[0];
env0_4 = value7[1];
const methods = mfaChallenge.methods;
const challenge = methods.find(function(a0) {
return a0.type === 'webauthn';
}).challenge;
const useMemo = binding4.useMemo;
const value9 = binding4.useCallback(_fun107494, [Reflect.apply(useMemo, binding4, [_fun107493, [property3]]),
challenge, finish]);
object = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
object.headerText = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.saHocI]);
string = intl.string;
const YpMrqM = (require(1244) /* metro dependency 1244: indexNative */).t.YpMrqM;
object.subtitle = Reflect.apply(string, intl, [YpMrqM]);
const KeyImage = (KeyImageModule).KeyImage;
object.headerImage = <KeyImage />;
object.content = (importDefault(8978) /* metro dependency 8978: NativeCeremonies */).shouldDisplayAndroidFidoSelector && <AndroidAuthRadioGroup authenticatorSelection={property3} setAuthenticator={property4} inProgress={property || property5} />;
const defaultImport2 = Button;
string = intl.string;
const Xr3Eks = (require(1244) /* metro dependency 1244: indexNative */).t.Xr3Eks;
object.submit = ((Component) => <Component variant="primary" text={Reflect.apply(string, intl,
[Xr3Eks])} loading={property || property5} disabled={property || property5} onPress={value9} />)(defaultImport2);
object.screenProps = {mfaChallenge: mfaChallenge, finish: finish};
object.mfaMethod = 'webauthn';
object.error = property2;
return <MfaOptionScreen {...object} />;
function _fun107493() { // fn#107493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:1289, offset: 0x022fe928, size: 20 bytes, params: 1, frame: 2
return env1_8[Module00057];
}
function _fun107494() { // fn#107494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:1321, offset: 0x022fe93c, size: 112 bytes, params: 1, frame: 13
env0_2(undefined);
env0_1(true);
let value = env0_6(challenge);
value = value.then(function(a0) {
return finish({mfaType: 'webauthn', data: a0});
});
value = value.then(_fun107496);
value = value.catch(_fun107497);
value.finally(_fun107498);
function _fun107496() { // fn#107496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:1395, offset: 0x020587be, size: 18 bytes, params: 1, frame: 11
return env1_4(true);
}
function _fun107497(a0) { // fn#107497, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:1414, offset: 0x022fe9ce, size: 163 bytes, params: 2, frame: 16
var binding;
var value2;
var intl;
let value = environment.__proto__.__proto__;
const HTTPResponseError = (HTTPUtilsModule).HTTPResponseError;
if (a0 instanceof HTTPResponseError) {
value2 = environment.__proto__;
binding = env1_2;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
binding(intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xSCvBf));
} else {
value = require(8980) /* metro dependency 8980: MFAUtils */;
value.captureWebAuthnException(a0, {});
value = environment.__proto__;
env1_2(a0.message);
}
}
function _fun107498() { // fn#107498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14410:1565, offset: 0x00e6aafb, size: 18 bytes, params: 1, frame: 11
return env1_1(false);
}
}
}
}
global.__d(_fun107488, 14213, [57, 31, 27, 33, 4501, 697, 1244, 1305, 477, 507, 8980, 14214, 13262, 8978, 14217,
2]) /* metro module 14213, dependencies: [57, 31, 27, 33, 4501, 697, 1244, 1305, 477, 507, 8980, 14214, 13262, 8978, 14217, 2] */;