package androidx.credentials.webauthn;

import androidx.credentials.webauthn.WebAuthnUtils;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import androidx.media3.extractor.text.ttml.TtmlNode;
import com.google.android.gms.fido.u2f.api.common.ClientData;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import defpackage.cr4;
import defpackage.ik2;
import defpackage.kp6;
import defpackage.m38;
import defpackage.y41;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import kotlin.Metadata;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes.dex */
@m38
@Metadata(d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0012\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u001a\u0010\u0005\u001a\u00020\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\u0004R\u001a\u0010\t\u001a\u00020\nX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u0011\u0010\u000f\u001a\u00020\u0010¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012R \u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00150\u0014X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0016\u0010\u0017\"\u0004\b\u0018\u0010\u0019R\u0011\u0010\u001a\u001a\u00020\u001b¢\u0006\b\n\u0000\u001a\u0004\b\u001c\u0010\u001dR\u0017\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020\u001f0\u0014¢\u0006\b\n\u0000\u001a\u0004\b \u0010\u0017R\u0011\u0010!\u001a\u00020\"¢\u0006\b\n\u0000\u001a\u0004\b#\u0010$R\u001a\u0010%\u001a\u00020&X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b'\u0010(\"\u0004\b)\u0010*R\u0011\u0010+\u001a\u00020,¢\u0006\b\n\u0000\u001a\u0004\b-\u0010.¨\u0006/"}, d2 = {"Landroidx/credentials/webauthn/PublicKeyCredentialCreationOptions;", "", "requestJson", "", "(Ljava/lang/String;)V", "attestation", "getAttestation", "()Ljava/lang/String;", "setAttestation", "authenticatorSelection", "Landroidx/credentials/webauthn/AuthenticatorSelectionCriteria;", "getAuthenticatorSelection", "()Landroidx/credentials/webauthn/AuthenticatorSelectionCriteria;", "setAuthenticatorSelection", "(Landroidx/credentials/webauthn/AuthenticatorSelectionCriteria;)V", ClientData.KEY_CHALLENGE, "", "getChallenge", "()[B", "excludeCredentials", "", "Landroidx/credentials/webauthn/PublicKeyCredentialDescriptor;", "getExcludeCredentials", "()Ljava/util/List;", "setExcludeCredentials", "(Ljava/util/List;)V", "json", "Lorg/json/JSONObject;", "getJson", "()Lorg/json/JSONObject;", "pubKeyCredParams", "Landroidx/credentials/webauthn/PublicKeyCredentialParameters;", "getPubKeyCredParams", "rp", "Landroidx/credentials/webauthn/PublicKeyCredentialRpEntity;", "getRp", "()Landroidx/credentials/webauthn/PublicKeyCredentialRpEntity;", "timeout", "", "getTimeout", "()J", "setTimeout", "(J)V", "user", "Landroidx/credentials/webauthn/PublicKeyCredentialUserEntity;", "getUser", "()Landroidx/credentials/webauthn/PublicKeyCredentialUserEntity;", "credentials_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class PublicKeyCredentialCreationOptions {

    @kp6
    private String attestation;

    @kp6
    private AuthenticatorSelectionCriteria authenticatorSelection;

    @kp6
    private final byte[] challenge;

    @kp6
    private List<PublicKeyCredentialDescriptor> excludeCredentials;

    @kp6
    private final JSONObject json;

    @kp6
    private final List<PublicKeyCredentialParameters> pubKeyCredParams;

    @kp6
    private final PublicKeyCredentialRpEntity rp;
    private long timeout;

    @kp6
    private final PublicKeyCredentialUserEntity user;

    public PublicKeyCredentialCreationOptions(@kp6 String str) throws JSONException {
        cr4.g(str, "requestJson");
        JSONObject jSONObject = new JSONObject(str);
        this.json = jSONObject;
        String string = jSONObject.getString(ClientData.KEY_CHALLENGE);
        WebAuthnUtils.Companion companion = WebAuthnUtils.INSTANCE;
        cr4.f(string, "challengeString");
        this.challenge = companion.b64Decode(string);
        JSONObject jSONObject2 = jSONObject.getJSONObject("rp");
        String string2 = jSONObject2.getString(AppMeasurementSdk.ConditionalUserProperty.NAME);
        cr4.f(string2, "rpJson.getString(\"name\")");
        String string3 = jSONObject2.getString(TtmlNode.ATTR_ID);
        cr4.f(string3, "rpJson.getString(\"id\")");
        this.rp = new PublicKeyCredentialRpEntity(string2, string3);
        JSONObject jSONObject3 = jSONObject.getJSONObject("user");
        String string4 = jSONObject3.getString(TtmlNode.ATTR_ID);
        cr4.f(string4, "rpUser.getString(\"id\")");
        byte[] bArrB64Decode = companion.b64Decode(string4);
        String string5 = jSONObject3.getString(AppMeasurementSdk.ConditionalUserProperty.NAME);
        cr4.f(string5, "rpUser.getString(\"name\")");
        String string6 = jSONObject3.getString("displayName");
        cr4.f(string6, "rpUser.getString(\"displayName\")");
        this.user = new PublicKeyCredentialUserEntity(string5, bArrB64Decode, string6);
        JSONArray jSONArray = jSONObject.getJSONArray("pubKeyCredParams");
        ArrayList arrayList = new ArrayList();
        int length = jSONArray.length();
        for (int i = 0; i < length; i++) {
            JSONObject jSONObject4 = jSONArray.getJSONObject(i);
            String string7 = jSONObject4.getString(SessionDescription.ATTR_TYPE);
            cr4.f(string7, "e.getString(\"type\")");
            arrayList.add(new PublicKeyCredentialParameters(string7, jSONObject4.getLong("alg")));
        }
        List<PublicKeyCredentialParameters> listBo = y41.bo(arrayList);
        this.pubKeyCredParams = listBo;
        this.timeout = this.json.optLong("timeout", 0L);
        this.excludeCredentials = ik2.a;
        this.authenticatorSelection = new AuthenticatorSelectionCriteria("platform", "required", false, null, 12, null);
        String strOptString = this.json.optString("attestation", "none");
        cr4.f(strOptString, "json.optString(\"attestation\", \"none\")");
        this.attestation = strOptString;
        Objects.toString(this.rp);
        Objects.toString(this.user);
        Objects.toString(listBo);
        Objects.toString(this.excludeCredentials);
        Objects.toString(this.authenticatorSelection);
    }

    @kp6
    public final String getAttestation() {
        return this.attestation;
    }

    @kp6
    public final AuthenticatorSelectionCriteria getAuthenticatorSelection() {
        return this.authenticatorSelection;
    }

    @kp6
    public final byte[] getChallenge() {
        return this.challenge;
    }

    @kp6
    public final List<PublicKeyCredentialDescriptor> getExcludeCredentials() {
        return this.excludeCredentials;
    }

    @kp6
    public final JSONObject getJson() {
        return this.json;
    }

    @kp6
    public final List<PublicKeyCredentialParameters> getPubKeyCredParams() {
        return this.pubKeyCredParams;
    }

    @kp6
    public final PublicKeyCredentialRpEntity getRp() {
        return this.rp;
    }

    public final long getTimeout() {
        return this.timeout;
    }

    @kp6
    public final PublicKeyCredentialUserEntity getUser() {
        return this.user;
    }

    public final void setAttestation(@kp6 String str) {
        cr4.g(str, "<set-?>");
        this.attestation = str;
    }

    public final void setAuthenticatorSelection(@kp6 AuthenticatorSelectionCriteria authenticatorSelectionCriteria) {
        cr4.g(authenticatorSelectionCriteria, "<set-?>");
        this.authenticatorSelection = authenticatorSelectionCriteria;
    }

    public final void setExcludeCredentials(@kp6 List<PublicKeyCredentialDescriptor> list) {
        cr4.g(list, "<set-?>");
        this.excludeCredentials = list;
    }

    public final void setTimeout(long j) {
        this.timeout = j;
    }
}
