package androidx.credentials; import android.graphics.drawable.Icon; import android.os.Bundle; import androidx.annotation.RequiresApi; import androidx.credentials.CreateCredentialRequest; import androidx.credentials.internal.FrameworkClassParsingException; import androidx.credentials.internal.RequestValidationHelper; import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import org.json.JSONObject; /* loaded from: classes.dex */ public final class CreatePublicKeyCredentialRequest extends CreateCredentialRequest { public static final String BUNDLE_KEY_CLIENT_DATA_HASH = "androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH"; public static final String BUNDLE_KEY_REQUEST_JSON = "androidx.credentials.BUNDLE_KEY_REQUEST_JSON"; public static final String BUNDLE_VALUE_SUBTYPE_CREATE_PUBLIC_KEY_CREDENTIAL_REQUEST = "androidx.credentials.BUNDLE_VALUE_SUBTYPE_CREATE_PUBLIC_KEY_CREDENTIAL_REQUEST"; public static final Companion Companion = new Companion(null); private final byte[] clientDataHash; private final String requestJson; /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson) { this(requestJson, null, false, null, false, 30, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson, byte[] bArr) { this(requestJson, bArr, false, null, false, 28, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson, byte[] bArr, boolean z) { this(requestJson, bArr, z, null, false, 24, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson, byte[] bArr, boolean z, String str) { this(requestJson, bArr, z, str, false, 16, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } public /* synthetic */ CreatePublicKeyCredentialRequest(String str, byte[] bArr, boolean z, boolean z2, CreateCredentialRequest.DisplayInfo displayInfo, String str2, Bundle bundle, Bundle bundle2, DefaultConstructorMarker defaultConstructorMarker) { this(str, bArr, z, z2, displayInfo, str2, bundle, bundle2); } public final byte[] getClientDataHash() { return this.clientDataHash; } public final String getRequestJson() { return this.requestJson; } public /* synthetic */ CreatePublicKeyCredentialRequest(String str, byte[] bArr, boolean z, boolean z2, CreateCredentialRequest.DisplayInfo displayInfo, String str2, Bundle bundle, Bundle bundle2, int i, DefaultConstructorMarker defaultConstructorMarker) { this(str, bArr, z, z2, displayInfo, (i & 32) != 0 ? null : str2, (i & 64) != 0 ? Companion.toCredentialDataBundle$credentials_release(str, bArr) : bundle, (i & 128) != 0 ? Companion.toCandidateDataBundle$credentials_release(str, bArr) : bundle2); } private CreatePublicKeyCredentialRequest(String str, byte[] bArr, boolean z, boolean z2, CreateCredentialRequest.DisplayInfo displayInfo, String str2, Bundle bundle, Bundle bundle2) { super(PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL, bundle, bundle2, false, z, displayInfo, str2, z2); this.requestJson = str; this.clientDataHash = bArr; if (!RequestValidationHelper.Companion.isValidJSON(str)) { throw new IllegalArgumentException("requestJson must not be empty, and must be a valid JSON".toString()); } } public /* synthetic */ CreatePublicKeyCredentialRequest(String str, byte[] bArr, boolean z, String str2, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) { this(str, (i & 2) != 0 ? null : bArr, (i & 4) != 0 ? false : z, (i & 8) != 0 ? null : str2, (i & 16) != 0 ? false : z2); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson, byte[] bArr, boolean z, String str, boolean z2) { this(requestJson, bArr, z2, z, Companion.getRequestDisplayInfo$credentials_release$default(Companion, requestJson, null, 2, null), str, null, null, PsExtractor.AUDIO_STREAM, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public CreatePublicKeyCredentialRequest(String requestJson, byte[] bArr, boolean z, String str, String str2, boolean z2) { this(requestJson, bArr, z2, z, Companion.getRequestDisplayInfo$credentials_release(requestJson, str2), str, null, null, PsExtractor.AUDIO_STREAM, null); Intrinsics.checkNotNullParameter(requestJson, "requestJson"); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } public static /* synthetic */ CreateCredentialRequest.DisplayInfo getRequestDisplayInfo$credentials_release$default(Companion companion, String str, String str2, int i, Object obj) { if ((i & 2) != 0) { str2 = null; } return companion.getRequestDisplayInfo$credentials_release(str, str2); } public final CreateCredentialRequest.DisplayInfo getRequestDisplayInfo$credentials_release(String requestJson, String str) { Intrinsics.checkNotNullParameter(requestJson, "requestJson"); try { JSONObject jSONObject = new JSONObject(requestJson).getJSONObject("user"); String userName = jSONObject.getString("name"); String string = jSONObject.isNull("displayName") ? null : jSONObject.getString("displayName"); Intrinsics.checkNotNullExpressionValue(userName, "userName"); return new CreateCredentialRequest.DisplayInfo(userName, string, (Icon) null, str); } catch (Exception unused) { throw new IllegalArgumentException("user.name must be defined in requestJson"); } } public static /* synthetic */ Bundle toCredentialDataBundle$credentials_release$default(Companion companion, String str, byte[] bArr, int i, Object obj) { if ((i & 2) != 0) { bArr = null; } return companion.toCredentialDataBundle$credentials_release(str, bArr); } public final Bundle toCredentialDataBundle$credentials_release(String requestJson, byte[] bArr) { Intrinsics.checkNotNullParameter(requestJson, "requestJson"); Bundle bundle = new Bundle(); bundle.putString(PublicKeyCredential.BUNDLE_KEY_SUBTYPE, CreatePublicKeyCredentialRequest.BUNDLE_VALUE_SUBTYPE_CREATE_PUBLIC_KEY_CREDENTIAL_REQUEST); bundle.putString("androidx.credentials.BUNDLE_KEY_REQUEST_JSON", requestJson); bundle.putByteArray("androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH", bArr); return bundle; } public final Bundle toCandidateDataBundle$credentials_release(String requestJson, byte[] bArr) { Intrinsics.checkNotNullParameter(requestJson, "requestJson"); Bundle bundle = new Bundle(); bundle.putString(PublicKeyCredential.BUNDLE_KEY_SUBTYPE, CreatePublicKeyCredentialRequest.BUNDLE_VALUE_SUBTYPE_CREATE_PUBLIC_KEY_CREDENTIAL_REQUEST); bundle.putString("androidx.credentials.BUNDLE_KEY_REQUEST_JSON", requestJson); bundle.putByteArray("androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH", bArr); return bundle; } @RequiresApi(23) public final CreatePublicKeyCredentialRequest createFrom$credentials_release(Bundle data, String str, Bundle candidateQueryData) { CreateCredentialRequest.DisplayInfo requestDisplayInfo$credentials_release$default; Intrinsics.checkNotNullParameter(data, "data"); Intrinsics.checkNotNullParameter(candidateQueryData, "candidateQueryData"); try { String string = data.getString("androidx.credentials.BUNDLE_KEY_REQUEST_JSON"); Intrinsics.checkNotNull(string); byte[] byteArray = data.getByteArray("androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH"); boolean z = data.getBoolean("androidx.credentials.BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS", false); try { requestDisplayInfo$credentials_release$default = CreateCredentialRequest.DisplayInfo.Companion.createFrom(data); } catch (IllegalArgumentException unused) { requestDisplayInfo$credentials_release$default = getRequestDisplayInfo$credentials_release$default(this, string, null, 2, null); } return new CreatePublicKeyCredentialRequest(string, byteArray, data.getBoolean("androidx.credentials.BUNDLE_KEY_IS_AUTO_SELECT_ALLOWED", false), z, requestDisplayInfo$credentials_release$default, str, data, candidateQueryData, null); } catch (Exception unused2) { throw new FrameworkClassParsingException(); } } } }