353 lines
16 KiB
TypeScript
353 lines
16 KiB
TypeScript
/* Metro module 8978; source: modules/webauthn/native/NativeCeremonies.tsx; dependencies: [5, 27, 3, 5084, 1244, 477, 8979, 8980, 1581, 2] */
|
|
function _fun69969(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69969, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:6, offset: 0x01cea309, size: 301 bytes, params: 8, frame: 21
|
|
var object2;
|
|
let env0_0 = require;
|
|
const closure = registerSecurityKey;
|
|
const mutateAndroidRegisterChallengeForDiscoverable = function(a0) {
|
|
var env0_0 = a0;
|
|
return _fun69978;
|
|
};
|
|
const closure2 = registerAndroidCredentialManagerPasskey;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_3 = (require(27) /* metro dependency 27 */).NativeModules;
|
|
let value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('WebAuthnUtils');
|
|
object2 = {};
|
|
Object.defineProperty(object2, 'hasAndroidPasskeySupport', {get: _fun69980, set: undefined, enumerable: true,
|
|
configurable: true});
|
|
Object.defineProperty(object2, 'shouldDisplayAndroidFidoSelector', {get: _fun69981, set: undefined,
|
|
enumerable: true, configurable: true});
|
|
object2.getPasskeyAuthenticator = getPasskeyAuthenticator;
|
|
object2.registerAndroidCredentialManagerPasskey = closure2;
|
|
object2.registerAndroidDevicePasskey = registerAndroidDevicePasskey;
|
|
object2.registerPasskey = registerPasskey;
|
|
object2.registerSecurityKey = closure;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/webauthn/native/NativeCeremonies.tsx');
|
|
exports.default = object2;
|
|
}
|
|
|
|
function _promptForRegisterCredential() { // fn#69970, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:164, offset: 0x01cea436, size: 50 bytes, params: 1, frame: 14
|
|
return env0_2(_fun69972).apply(this, arguments);
|
|
}
|
|
|
|
function registerSecurityKey({onRegisterSuccess, setError, setRegistering}) { // fn#69973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:433, offset: 0x01cea50d, size: 147 bytes, params: 2, frame: 15
|
|
let value = a1;
|
|
const r4 = value !== undefined ? value : NativeModules.DCDSecurityKeyManager.register;
|
|
if (setError !== undefined) {
|
|
setError('');
|
|
}
|
|
setRegistering(true);
|
|
value = (function() {
|
|
return _promptForRegisterCredential.apply(this, arguments);
|
|
})(r4);
|
|
value = value.then(onRegisterSuccess);
|
|
value = value.catch(function(a0) {
|
|
if (setError === undefined) {
|
|
throw a0;
|
|
}
|
|
setError(require(dependencyMap[4]).intl.string(require(dependencyMap[4]).t.xSCvBf));
|
|
throw a0;
|
|
});
|
|
return value.finally(function() {
|
|
return setRegistering(false);
|
|
});
|
|
}
|
|
|
|
function mutateAndroidRegisterChallengeForDiscoverable(a0) { // fn#69977, offset: 0x01cea627, size: 18 bytes, params: 2, frame: 2
|
|
const env0_0 = a0;
|
|
return _fun69978;
|
|
}
|
|
|
|
function registerAndroidCredentialManagerPasskey(a0) { // fn#69979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:980, offset: 0x01cea688, size: 45 bytes, params: 2, frame: 13
|
|
const registerSecurityKeyBinding = registerSecurityKey;
|
|
const mutateAndroidRegisterChallengeForDiscoverableBinding = mutateAndroidRegisterChallengeForDiscoverable;
|
|
const DCDSecurityKeyManager = NativeModules.DCDSecurityKeyManager;
|
|
return registerSecurityKeyBinding(a0,
|
|
mutateAndroidRegisterChallengeForDiscoverableBinding(DCDSecurityKeyManager.registerPasskey));
|
|
}
|
|
|
|
function _fun69980() { // fn#69980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:1156, offset: 0x01cea6b5, size: 71 bytes, params: 1, frame: 13
|
|
return (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() && NativeModules.DCDSecurityKeyManager?.registerPasskey != null;
|
|
}
|
|
|
|
function _fun69981() { // fn#69981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:1289, offset: 0x01cea6fc, size: 73 bytes, params: 1, frame: 13
|
|
var r0;
|
|
var value;
|
|
const isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
|
|
if (isAndroid2) {
|
|
value = require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */;
|
|
value = !value.isMetaQuest();
|
|
r0 = value;
|
|
} else {
|
|
r0 = isAndroid2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getPasskeyAuthenticator() { // fn#69982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:1404, offset: 0x01cea745, size: 132 bytes, params: 1, frame: 16
|
|
var authenticatePasskey;
|
|
const DCDSecurityKeyManager = NativeModules.DCDSecurityKeyManager;
|
|
const env0_0 = DCDSecurityKeyManager.authenticate;
|
|
if ((require(477) /* metro dependency 477: PlatformUtils */).isAndroid() && NativeModules.DCDSecurityKeyManager?.authenticatePasskey != null) {
|
|
authenticatePasskey = NativeModules.DCDSecurityKeyManager.authenticatePasskey;
|
|
}
|
|
return env0_2(_fun69984);
|
|
}
|
|
|
|
function registerAndroidDevicePasskey(a0) { // fn#69985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:1968, offset: 0x01cea8c7, size: 45 bytes, params: 2, frame: 13
|
|
const registerSecurityKeyBinding = registerSecurityKey;
|
|
const mutateAndroidRegisterChallengeForDiscoverableBinding = mutateAndroidRegisterChallengeForDiscoverable;
|
|
const DCDSecurityKeyManager = NativeModules.DCDSecurityKeyManager;
|
|
return registerSecurityKeyBinding(a0,
|
|
mutateAndroidRegisterChallengeForDiscoverableBinding(DCDSecurityKeyManager.register));
|
|
}
|
|
|
|
function registerPasskey(a0) { // fn#69986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:2136, offset: 0x01cea8f4, size: 63 bytes, params: 2, frame: 13
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
return platformUtilsModule.isAndroid() ? registerAndroidCredentialManagerPasskey(a0) : registerSecurityKey(a0);
|
|
}
|
|
|
|
async function _fun69972() { // fn#69972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:243, offset: 0x01cea47c, size: 145 bytes, params: 1, frame: 16
|
|
let value = a0;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const r6 = value !== undefined ? value : env2_3.DCDSecurityKeyManager.register;
|
|
await undefined;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
value = env2_0(env2_1[3]);
|
|
await value.startRegisterWebAuthnCredential();
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
const ticket = value.ticket;
|
|
const challenge = value.challenge;
|
|
const object2 = {ticket: ticket};
|
|
await r6(challenge);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
object2.credential = value;
|
|
return object2;
|
|
}
|
|
|
|
function _fun69978(a0) { // fn#69978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:869, offset: 0x01cea639, size: 79 bytes, params: 2, frame: 12
|
|
let JSON = global.JSON;
|
|
let value = JSON.parse(a0);
|
|
value.publicKey.authenticatorSelection.residentKey = 'required';
|
|
const binding = env0_0;
|
|
JSON = global.JSON;
|
|
value = JSON.stringify(value);
|
|
return binding(value);
|
|
}
|
|
|
|
async function _fun69984(a0) { // fn#69984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9163:1635, offset: 0x01cea7dd, size: 234 bytes, params: 2, frame: 18
|
|
var items2;
|
|
var value6;
|
|
var error;
|
|
var code;
|
|
var binding;
|
|
var value7;
|
|
var IgnorableWebAuthnError;
|
|
var prototype;
|
|
var ignorableWebAuthnError;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = copyRestArgs(0, undefined);
|
|
await undefined;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
code = error.code;
|
|
if (code === 'AbortError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
if (code === 'NotAllowedError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_0;
|
|
value7 = binding(env2_1[7]);
|
|
value7.captureWebAuthnException(error);
|
|
binding = env2_4;
|
|
binding.error(error);
|
|
throw error;
|
|
}
|
|
try {
|
|
items2 = [];
|
|
} catch (error) {
|
|
code = error.code;
|
|
if (code === 'AbortError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
if (code === 'NotAllowedError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_0;
|
|
value7 = binding(env2_1[7]);
|
|
value7.captureWebAuthnException(error);
|
|
binding = env2_4;
|
|
binding.error(error);
|
|
throw error;
|
|
}
|
|
try {
|
|
arraySpread(items2, value, 0, undefined);
|
|
} catch (error) {
|
|
code = error.code;
|
|
if (code === 'AbortError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
if (code === 'NotAllowedError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_0;
|
|
value7 = binding(env2_1[7]);
|
|
value7.captureWebAuthnException(error);
|
|
binding = env2_4;
|
|
binding.error(error);
|
|
throw error;
|
|
}
|
|
try {
|
|
value = apply(require, items2, undefined, undefined);
|
|
} catch (error) {
|
|
code = error.code;
|
|
if (code === 'AbortError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
if (code === 'NotAllowedError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_0;
|
|
value7 = binding(env2_1[7]);
|
|
value7.captureWebAuthnException(error);
|
|
binding = env2_4;
|
|
binding.error(error);
|
|
throw error;
|
|
}
|
|
await value;
|
|
try {
|
|
value = undefined;
|
|
value6 = false;
|
|
} catch (error) {
|
|
code = error.code;
|
|
if (code === 'AbortError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
if (code === 'NotAllowedError') {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_4;
|
|
binding.warn(error);
|
|
binding = env2_0;
|
|
IgnorableWebAuthnError = binding(env2_1[6]).IgnorableWebAuthnError;
|
|
prototype = IgnorableWebAuthnError.prototype;
|
|
value = Object.create(prototype, {constructor: {value: IgnorableWebAuthnError}});
|
|
ignorableWebAuthnError = new IgnorableWebAuthnError();
|
|
value = ignorableWebAuthnError instanceof Object ? ignorableWebAuthnError : value;
|
|
throw value;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_0;
|
|
value7 = binding(env2_1[7]);
|
|
value7.captureWebAuthnException(error);
|
|
binding = env2_4;
|
|
binding.error(error);
|
|
throw error;
|
|
}
|
|
return value6 ? value : value;
|
|
}
|
|
|