- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
149 lines
6.1 KiB
Java
149 lines
6.1 KiB
Java
package androidx.credentials.webauthn;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.credentials.webauthn.WebAuthnUtils;
|
|
import com.google.android.gms.fido.u2f.api.common.ClientData;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.collections.CollectionsKt___CollectionsKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
/* loaded from: classes.dex */
|
|
public final class PublicKeyCredentialCreationOptions {
|
|
private String attestation;
|
|
private AuthenticatorSelectionCriteria authenticatorSelection;
|
|
private final byte[] challenge;
|
|
private List<PublicKeyCredentialDescriptor> excludeCredentials;
|
|
private final JSONObject json;
|
|
private final List<PublicKeyCredentialParameters> pubKeyCredParams;
|
|
private final PublicKeyCredentialRpEntity rp;
|
|
private long timeout;
|
|
private final PublicKeyCredentialUserEntity user;
|
|
|
|
public final String getAttestation() {
|
|
return this.attestation;
|
|
}
|
|
|
|
public final AuthenticatorSelectionCriteria getAuthenticatorSelection() {
|
|
return this.authenticatorSelection;
|
|
}
|
|
|
|
public final byte[] getChallenge() {
|
|
return this.challenge;
|
|
}
|
|
|
|
public final List<PublicKeyCredentialDescriptor> getExcludeCredentials() {
|
|
return this.excludeCredentials;
|
|
}
|
|
|
|
public final JSONObject getJson() {
|
|
return this.json;
|
|
}
|
|
|
|
public final List<PublicKeyCredentialParameters> getPubKeyCredParams() {
|
|
return this.pubKeyCredParams;
|
|
}
|
|
|
|
public final PublicKeyCredentialRpEntity getRp() {
|
|
return this.rp;
|
|
}
|
|
|
|
public final long getTimeout() {
|
|
return this.timeout;
|
|
}
|
|
|
|
public final PublicKeyCredentialUserEntity getUser() {
|
|
return this.user;
|
|
}
|
|
|
|
public final void setAttestation(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
|
this.attestation = str;
|
|
}
|
|
|
|
public final void setAuthenticatorSelection(AuthenticatorSelectionCriteria authenticatorSelectionCriteria) {
|
|
Intrinsics.checkNotNullParameter(authenticatorSelectionCriteria, "<set-?>");
|
|
this.authenticatorSelection = authenticatorSelectionCriteria;
|
|
}
|
|
|
|
public final void setExcludeCredentials(List<PublicKeyCredentialDescriptor> list) {
|
|
Intrinsics.checkNotNullParameter(list, "<set-?>");
|
|
this.excludeCredentials = list;
|
|
}
|
|
|
|
public final void setTimeout(long j) {
|
|
this.timeout = j;
|
|
}
|
|
|
|
public PublicKeyCredentialCreationOptions(String requestJson) {
|
|
Intrinsics.checkNotNullParameter(requestJson, "requestJson");
|
|
JSONObject jSONObject = new JSONObject(requestJson);
|
|
this.json = jSONObject;
|
|
String challengeString = jSONObject.getString(ClientData.KEY_CHALLENGE);
|
|
WebAuthnUtils.Companion companion = WebAuthnUtils.Companion;
|
|
Intrinsics.checkNotNullExpressionValue(challengeString, "challengeString");
|
|
this.challenge = companion.b64Decode(challengeString);
|
|
JSONObject jSONObject2 = jSONObject.getJSONObject("rp");
|
|
String string = jSONObject2.getString("name");
|
|
Intrinsics.checkNotNullExpressionValue(string, "rpJson.getString(\"name\")");
|
|
String string2 = jSONObject2.getString("id");
|
|
Intrinsics.checkNotNullExpressionValue(string2, "rpJson.getString(\"id\")");
|
|
this.rp = new PublicKeyCredentialRpEntity(string, string2);
|
|
JSONObject jSONObject3 = jSONObject.getJSONObject("user");
|
|
String string3 = jSONObject3.getString("id");
|
|
Intrinsics.checkNotNullExpressionValue(string3, "rpUser.getString(\"id\")");
|
|
byte[] b64Decode = companion.b64Decode(string3);
|
|
String string4 = jSONObject3.getString("name");
|
|
Intrinsics.checkNotNullExpressionValue(string4, "rpUser.getString(\"name\")");
|
|
String string5 = jSONObject3.getString("displayName");
|
|
Intrinsics.checkNotNullExpressionValue(string5, "rpUser.getString(\"displayName\")");
|
|
this.user = new PublicKeyCredentialUserEntity(string4, b64Decode, string5);
|
|
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 string6 = jSONObject4.getString("type");
|
|
Intrinsics.checkNotNullExpressionValue(string6, "e.getString(\"type\")");
|
|
arrayList.add(new PublicKeyCredentialParameters(string6, jSONObject4.getLong("alg")));
|
|
}
|
|
List<PublicKeyCredentialParameters> list = CollectionsKt___CollectionsKt.toList(arrayList);
|
|
this.pubKeyCredParams = list;
|
|
this.timeout = this.json.optLong("timeout", 0L);
|
|
this.excludeCredentials = CollectionsKt__CollectionsKt.emptyList();
|
|
this.authenticatorSelection = new AuthenticatorSelectionCriteria("platform", "required", false, null, 12, null);
|
|
String optString = this.json.optString("attestation", "none");
|
|
Intrinsics.checkNotNullExpressionValue(optString, "json.optString(\"attestation\", \"none\")");
|
|
this.attestation = optString;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Challenge ");
|
|
sb.append(this.challenge);
|
|
sb.append("()");
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("rp ");
|
|
sb2.append(this.rp);
|
|
StringBuilder sb3 = new StringBuilder();
|
|
sb3.append("user ");
|
|
sb3.append(this.user);
|
|
StringBuilder sb4 = new StringBuilder();
|
|
sb4.append("pubKeyCredParams ");
|
|
sb4.append(list);
|
|
StringBuilder sb5 = new StringBuilder();
|
|
sb5.append("timeout ");
|
|
sb5.append(this.timeout);
|
|
StringBuilder sb6 = new StringBuilder();
|
|
sb6.append("excludeCredentials ");
|
|
sb6.append(this.excludeCredentials);
|
|
StringBuilder sb7 = new StringBuilder();
|
|
sb7.append("authenticatorSelection ");
|
|
sb7.append(this.authenticatorSelection);
|
|
StringBuilder sb8 = new StringBuilder();
|
|
sb8.append("attestation ");
|
|
sb8.append(this.attestation);
|
|
}
|
|
}
|