74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
// Metro module 5646 (f5647).
|
|
import { NativeModules } from "react-native";
|
|
import Logger from "../debug/Logger";
|
|
import { encodeUserIdForWebAuthn } from "./WebAuthnUtils";
|
|
let c3486_4 = new Logger("SignalHelpers.native");
|
|
const WEBAUTHN_ORIGIN = window.GLOBAL_ENV.WEBAUTHN_ORIGIN;
|
|
class SignalHelpers {
|
|
constructor() {
|
|
return {
|
|
__proto__: new.target.prototype
|
|
};
|
|
}
|
|
static async signalAllAcceptedCredentials(credentials, c14975_1) {
|
|
L11: {
|
|
if (NativeModules.DCDSecurityKeyManager.signalAllAcceptedCredentials !== void 0) {
|
|
const encodedId = encodeUserIdForWebAuthn(c14975_1);
|
|
const allAcceptedCredentialIds = credentials.map((credential) => credential.cred_id).filter((item) => item !== "");
|
|
c3486_4.info("signalAllAcceptedCredentials", {
|
|
rpId: WEBAUTHN_ORIGIN,
|
|
encodedId,
|
|
allAcceptedCredentialIds,
|
|
credentials
|
|
});
|
|
await NativeModules.DCDSecurityKeyManager.signalAllAcceptedCredentials(WEBAUTHN_ORIGIN, encodedId, allAcceptedCredentialIds).catch(c3486_4.warn);
|
|
break L11;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
static async signalCurrentUserDetails(c14976_0) {
|
|
let username, email;
|
|
L15: {
|
|
if (NativeModules.DCDSecurityKeyManager.signalCurrentUserDetails !== void 0) {
|
|
const encodedId = encodeUserIdForWebAuthn(c14976_0.id);
|
|
const email2 = c14976_0.email;
|
|
email = email2;
|
|
if (email2 == null) {
|
|
email = c14976_0.global_name;
|
|
}
|
|
username = email;
|
|
if (email == null) {
|
|
username = c14976_0.username;
|
|
}
|
|
const name = username;
|
|
const username2 = c14976_0.username;
|
|
c3486_4.info("signalCurrentUserDetails", {
|
|
rpId: WEBAUTHN_ORIGIN,
|
|
encodedId,
|
|
name,
|
|
displayName: username2
|
|
});
|
|
await NativeModules.DCDSecurityKeyManager.signalCurrentUserDetails(WEBAUTHN_ORIGIN, encodedId, name, username2).catch(c3486_4.warn);
|
|
break L15;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
static async signalUnknownCredential(c14977_0) {
|
|
L14: {
|
|
if (NativeModules.DCDSecurityKeyManager.signalUnknownCredential !== void 0) {
|
|
const credentialId = typeof c14977_0 === "string" ? JSON.parse(c14977_0).id : c14977_0.cred_id;
|
|
c3486_4.info("signalUnknownCredential", {
|
|
rpId: WEBAUTHN_ORIGIN,
|
|
credentialId
|
|
});
|
|
await NativeModules.DCDSecurityKeyManager.signalUnknownCredential(WEBAUTHN_ORIGIN, credentialId).catch(c3486_4.warn);
|
|
break L14;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
}
|
|
export default SignalHelpers;
|