// Metro module 9199 (f9200). import { NativeModules } from "react-native"; import { isMetaQuest } from "../modules/device/MetaQuestUtils.android"; import Module9200 from "../_bundle/Module9200"; import SentryUtils_native from "./SentryUtils.native"; let r16 = window?.crypto; if (r16 == null) { r16 = window?.msCrypto; } const msCrypto = r16; const r3 = "Uint8Array" in window; const r22 = msCrypto != null && "getRandomValues" in msCrypto && r3; const r29 = NativeModules.DCDSecurityKeyManager != null && !isMetaQuest(); export function encodeTotpSecret(a0) { return a0.replace(/[\s._-]+/g, "").toUpperCase(); } export { r22 as hasCrypto }; export { r29 as hasWebAuthn }; export function generateTotpSecret() { return Module9200.encode(msCrypto.getRandomValues(new Uint8Array(20))).toString("utf8").replace(/=/g, "").toLowerCase().replace(/(\w{4})/g, "$1 ").trim(); } export function encodeTotpSecretAsUrl(a0, a1, r3 = "Discord") { return `otpauth://totp/${encodeURI(r3)}:${encodeURI(a0)}?secret=${a1.replace(/[\s._-]+/g, "").toUpperCase()}&issuer=${encodeURIComponent(r3)}`; } export function captureWebAuthnException(a0, a1) { SentryUtils_native.captureException(a0, { ...a1, tags: { ...a1?.tags, app_context: "webauthn" } }); }