Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,149 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import androidx.credentials.webauthn.WebAuthnUtils;
import com.google.android.gms.fido.u2f.api.common.ClientData;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.security.MessageDigest;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class AuthenticatorAssertionResponse implements AuthenticatorResponse {
private byte[] authenticatorData;
private final boolean be;
private final boolean bs;
private final byte[] clientDataHash;
private JSONObject clientJson;
private final byte[] credentialId;
private final String origin;
private final String packageName;
private final PublicKeyCredentialRequestOptions requestOptions;
private byte[] signature;
private final boolean up;
private byte[] userHandle;
private final boolean uv;
public final byte[] getAuthenticatorData() {
return this.authenticatorData;
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public JSONObject getClientJson() {
return this.clientJson;
}
public final byte[] getSignature() {
return this.signature;
}
public final void setAuthenticatorData(byte[] bArr) {
Intrinsics.checkNotNullParameter(bArr, "<set-?>");
this.authenticatorData = bArr;
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public void setClientJson(JSONObject jSONObject) {
Intrinsics.checkNotNullParameter(jSONObject, "<set-?>");
this.clientJson = jSONObject;
}
public final void setSignature(byte[] bArr) {
Intrinsics.checkNotNullParameter(bArr, "<set-?>");
this.signature = bArr;
}
public AuthenticatorAssertionResponse(PublicKeyCredentialRequestOptions requestOptions, byte[] credentialId, String origin, boolean z, boolean z2, boolean z3, boolean z4, byte[] userHandle, String str, byte[] bArr) {
Intrinsics.checkNotNullParameter(requestOptions, "requestOptions");
Intrinsics.checkNotNullParameter(credentialId, "credentialId");
Intrinsics.checkNotNullParameter(origin, "origin");
Intrinsics.checkNotNullParameter(userHandle, "userHandle");
this.requestOptions = requestOptions;
this.credentialId = credentialId;
this.origin = origin;
this.up = z;
this.uv = z2;
this.be = z3;
this.bs = z4;
this.userHandle = userHandle;
this.packageName = str;
this.clientDataHash = bArr;
this.clientJson = new JSONObject();
this.signature = new byte[0];
getClientJson().put("type", "webauthn.get");
getClientJson().put(ClientData.KEY_CHALLENGE, WebAuthnUtils.Companion.b64Encode(requestOptions.getChallenge()));
getClientJson().put("origin", origin);
if (str != null) {
getClientJson().put("androidPackageName", str);
}
this.authenticatorData = defaultAuthenticatorData();
}
public /* synthetic */ AuthenticatorAssertionResponse(PublicKeyCredentialRequestOptions publicKeyCredentialRequestOptions, byte[] bArr, String str, boolean z, boolean z2, boolean z3, boolean z4, byte[] bArr2, String str2, byte[] bArr3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(publicKeyCredentialRequestOptions, bArr, str, z, z2, z3, z4, bArr2, (i & 256) != 0 ? null : str2, (i & 512) != 0 ? null : bArr3);
}
/* JADX WARN: Multi-variable type inference failed */
public final byte[] defaultAuthenticatorData() {
byte[] plus;
byte[] plus2;
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] bytes = this.requestOptions.getRpId().getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
byte[] rpHash = messageDigest.digest(bytes);
boolean z = this.up;
boolean z2 = z;
if (this.uv) {
z2 = (z ? 1 : 0) | 4;
}
boolean z3 = z2;
if (this.be) {
z3 = (z2 ? 1 : 0) | '\b';
}
int i = z3;
if (this.bs) {
i = (z3 ? 1 : 0) | 16;
}
Intrinsics.checkNotNullExpressionValue(rpHash, "rpHash");
plus = ArraysKt___ArraysJvmKt.plus(rpHash, new byte[]{(byte) i});
plus2 = ArraysKt___ArraysJvmKt.plus(plus, new byte[]{0, 0, 0, 0});
return plus2;
}
public final byte[] dataToSign() {
byte[] plus;
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] bArr = this.clientDataHash;
if (bArr == null) {
String jSONObject = getClientJson().toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "clientJson.toString()");
byte[] bytes = jSONObject.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
bArr = messageDigest.digest(bytes);
Intrinsics.checkNotNullExpressionValue(bArr, "md.digest(clientJson.toString().toByteArray())");
}
plus = ArraysKt___ArraysJvmKt.plus(this.authenticatorData, bArr);
return plus;
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public JSONObject json() {
String jSONObject = getClientJson().toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "clientJson.toString()");
byte[] bytes = jSONObject.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
JSONObject jSONObject2 = new JSONObject();
if (this.clientDataHash == null) {
jSONObject2.put("clientDataJSON", WebAuthnUtils.Companion.b64Encode(bytes));
}
WebAuthnUtils.Companion companion = WebAuthnUtils.Companion;
jSONObject2.put("authenticatorData", companion.b64Encode(this.authenticatorData));
jSONObject2.put(InAppPurchaseMetaData.KEY_SIGNATURE, companion.b64Encode(this.signature));
jSONObject2.put("userHandle", companion.b64Encode(this.userHandle));
return jSONObject2;
}
}

View File

@@ -0,0 +1,158 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import com.google.android.gms.fido.u2f.api.common.ClientData;
import com.tapjoy.TapjoyConstants;
import java.security.MessageDigest;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import org.json.JSONArray;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class AuthenticatorAttestationResponse implements AuthenticatorResponse {
private byte[] attestationObject;
private final boolean be;
private final boolean bs;
private final byte[] clientDataHash;
private JSONObject clientJson;
private final byte[] credentialId;
private final byte[] credentialPublicKey;
private final String origin;
private final String packageName;
private final PublicKeyCredentialCreationOptions requestOptions;
private final boolean up;
private final boolean uv;
public final byte[] getAttestationObject() {
return this.attestationObject;
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public JSONObject getClientJson() {
return this.clientJson;
}
public final void setAttestationObject(byte[] bArr) {
Intrinsics.checkNotNullParameter(bArr, "<set-?>");
this.attestationObject = bArr;
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public void setClientJson(JSONObject jSONObject) {
Intrinsics.checkNotNullParameter(jSONObject, "<set-?>");
this.clientJson = jSONObject;
}
public AuthenticatorAttestationResponse(PublicKeyCredentialCreationOptions requestOptions, byte[] credentialId, byte[] credentialPublicKey, String origin, boolean z, boolean z2, boolean z3, boolean z4, String str, byte[] bArr) {
Intrinsics.checkNotNullParameter(requestOptions, "requestOptions");
Intrinsics.checkNotNullParameter(credentialId, "credentialId");
Intrinsics.checkNotNullParameter(credentialPublicKey, "credentialPublicKey");
Intrinsics.checkNotNullParameter(origin, "origin");
this.requestOptions = requestOptions;
this.credentialId = credentialId;
this.credentialPublicKey = credentialPublicKey;
this.origin = origin;
this.up = z;
this.uv = z2;
this.be = z3;
this.bs = z4;
this.packageName = str;
this.clientDataHash = bArr;
this.clientJson = new JSONObject();
getClientJson().put("type", "webauthn.create");
getClientJson().put(ClientData.KEY_CHALLENGE, WebAuthnUtils.Companion.b64Encode(requestOptions.getChallenge()));
getClientJson().put("origin", origin);
if (str != null) {
getClientJson().put("androidPackageName", str);
}
this.attestationObject = defaultAttestationObject$credentials_release();
}
public /* synthetic */ AuthenticatorAttestationResponse(PublicKeyCredentialCreationOptions publicKeyCredentialCreationOptions, byte[] bArr, byte[] bArr2, String str, boolean z, boolean z2, boolean z3, boolean z4, String str2, byte[] bArr3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(publicKeyCredentialCreationOptions, bArr, bArr2, str, z, z2, z3, z4, (i & 256) != 0 ? null : str2, (i & 512) != 0 ? null : bArr3);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v15 */
/* JADX WARN: Type inference failed for: r1v16 */
/* JADX WARN: Type inference failed for: r1v24 */
/* JADX WARN: Type inference failed for: r1v25 */
/* JADX WARN: Type inference failed for: r1v7 */
private final byte[] authData() {
byte[] plus;
byte[] plus2;
byte[] plus3;
byte[] plus4;
byte[] plus5;
byte[] plus6;
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] bytes = this.requestOptions.getRp().getId().getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
byte[] rpHash = messageDigest.digest(bytes);
boolean z = this.up;
boolean z2 = z;
if (this.uv) {
z2 = (z ? 1 : 0) | 4;
}
boolean z3 = z2;
if (this.be) {
z3 = (z2 ? 1 : 0) | '\b';
}
?? r1 = z3;
if (this.bs) {
r1 = (z3 ? 1 : 0) | 16;
}
int i = r1 | 64;
byte[] bArr = new byte[16];
for (int i2 = 0; i2 < 16; i2++) {
bArr[i2] = 0;
}
byte[] bArr2 = this.credentialId;
byte[] bArr3 = {(byte) (bArr2.length >> 8), (byte) bArr2.length};
Intrinsics.checkNotNullExpressionValue(rpHash, "rpHash");
plus = ArraysKt___ArraysJvmKt.plus(rpHash, new byte[]{(byte) i});
plus2 = ArraysKt___ArraysJvmKt.plus(plus, new byte[]{0, 0, 0, 0});
plus3 = ArraysKt___ArraysJvmKt.plus(plus2, bArr);
plus4 = ArraysKt___ArraysJvmKt.plus(plus3, bArr3);
plus5 = ArraysKt___ArraysJvmKt.plus(plus4, this.credentialId);
plus6 = ArraysKt___ArraysJvmKt.plus(plus5, this.credentialPublicKey);
return plus6;
}
public final byte[] defaultAttestationObject$credentials_release() {
Map emptyMap;
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put("fmt", "none");
emptyMap = MapsKt__MapsKt.emptyMap();
linkedHashMap.put("attStmt", emptyMap);
linkedHashMap.put("authData", authData());
return new Cbor().encode(linkedHashMap);
}
@Override // androidx.credentials.webauthn.AuthenticatorResponse
public JSONObject json() {
List listOf;
String jSONObject = getClientJson().toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "clientJson.toString()");
byte[] bytes = jSONObject.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
JSONObject jSONObject2 = new JSONObject();
if (this.clientDataHash == null) {
jSONObject2.put("clientDataJSON", WebAuthnUtils.Companion.b64Encode(bytes));
}
jSONObject2.put("attestationObject", WebAuthnUtils.Companion.b64Encode(this.attestationObject));
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{TapjoyConstants.LOG_LEVEL_INTERNAL, "hybrid"});
jSONObject2.put("transports", new JSONArray((Collection) listOf));
return jSONObject2;
}
}

View File

@@ -0,0 +1,14 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public interface AuthenticatorResponse {
JSONObject getClientJson();
JSONObject json();
void setClientJson(JSONObject jSONObject);
}

View File

@@ -0,0 +1,102 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class AuthenticatorSelectionCriteria {
private final String authenticatorAttachment;
private final boolean requireResidentKey;
private final String residentKey;
private final String userVerification;
public static /* synthetic */ AuthenticatorSelectionCriteria copy$default(AuthenticatorSelectionCriteria authenticatorSelectionCriteria, String str, String str2, boolean z, String str3, int i, Object obj) {
if ((i & 1) != 0) {
str = authenticatorSelectionCriteria.authenticatorAttachment;
}
if ((i & 2) != 0) {
str2 = authenticatorSelectionCriteria.residentKey;
}
if ((i & 4) != 0) {
z = authenticatorSelectionCriteria.requireResidentKey;
}
if ((i & 8) != 0) {
str3 = authenticatorSelectionCriteria.userVerification;
}
return authenticatorSelectionCriteria.copy(str, str2, z, str3);
}
public final String component1() {
return this.authenticatorAttachment;
}
public final String component2() {
return this.residentKey;
}
public final boolean component3() {
return this.requireResidentKey;
}
public final String component4() {
return this.userVerification;
}
public final AuthenticatorSelectionCriteria copy(String authenticatorAttachment, String residentKey, boolean z, String userVerification) {
Intrinsics.checkNotNullParameter(authenticatorAttachment, "authenticatorAttachment");
Intrinsics.checkNotNullParameter(residentKey, "residentKey");
Intrinsics.checkNotNullParameter(userVerification, "userVerification");
return new AuthenticatorSelectionCriteria(authenticatorAttachment, residentKey, z, userVerification);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof AuthenticatorSelectionCriteria)) {
return false;
}
AuthenticatorSelectionCriteria authenticatorSelectionCriteria = (AuthenticatorSelectionCriteria) obj;
return Intrinsics.areEqual(this.authenticatorAttachment, authenticatorSelectionCriteria.authenticatorAttachment) && Intrinsics.areEqual(this.residentKey, authenticatorSelectionCriteria.residentKey) && this.requireResidentKey == authenticatorSelectionCriteria.requireResidentKey && Intrinsics.areEqual(this.userVerification, authenticatorSelectionCriteria.userVerification);
}
public final String getAuthenticatorAttachment() {
return this.authenticatorAttachment;
}
public final boolean getRequireResidentKey() {
return this.requireResidentKey;
}
public final String getResidentKey() {
return this.residentKey;
}
public final String getUserVerification() {
return this.userVerification;
}
public int hashCode() {
return (((((this.authenticatorAttachment.hashCode() * 31) + this.residentKey.hashCode()) * 31) + Boolean.hashCode(this.requireResidentKey)) * 31) + this.userVerification.hashCode();
}
public String toString() {
return "AuthenticatorSelectionCriteria(authenticatorAttachment=" + this.authenticatorAttachment + ", residentKey=" + this.residentKey + ", requireResidentKey=" + this.requireResidentKey + ", userVerification=" + this.userVerification + ')';
}
public AuthenticatorSelectionCriteria(String authenticatorAttachment, String residentKey, boolean z, String userVerification) {
Intrinsics.checkNotNullParameter(authenticatorAttachment, "authenticatorAttachment");
Intrinsics.checkNotNullParameter(residentKey, "residentKey");
Intrinsics.checkNotNullParameter(userVerification, "userVerification");
this.authenticatorAttachment = authenticatorAttachment;
this.residentKey = residentKey;
this.requireResidentKey = z;
this.userVerification = userVerification;
}
public /* synthetic */ AuthenticatorSelectionCriteria(String str, String str2, boolean z, String str3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, str2, (i & 4) != 0 ? false : z, (i & 8) != 0 ? "preferred" : str3);
}
}

View File

@@ -0,0 +1,377 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt___RangesKt;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class Cbor {
private final int TYPE_UNSIGNED_INT;
private final int TYPE_NEGATIVE_INT = 1;
private final int TYPE_BYTE_STRING = 2;
private final int TYPE_TEXT_STRING = 3;
private final int TYPE_ARRAY = 4;
private final int TYPE_MAP = 5;
private final int TYPE_TAG = 6;
private final int TYPE_FLOAT = 7;
public final int getTYPE_ARRAY() {
return this.TYPE_ARRAY;
}
public final int getTYPE_BYTE_STRING() {
return this.TYPE_BYTE_STRING;
}
public final int getTYPE_FLOAT() {
return this.TYPE_FLOAT;
}
public final int getTYPE_MAP() {
return this.TYPE_MAP;
}
public final int getTYPE_NEGATIVE_INT() {
return this.TYPE_NEGATIVE_INT;
}
public final int getTYPE_TAG() {
return this.TYPE_TAG;
}
public final int getTYPE_TEXT_STRING() {
return this.TYPE_TEXT_STRING;
}
public final int getTYPE_UNSIGNED_INT() {
return this.TYPE_UNSIGNED_INT;
}
public static final class Item {
private final Object item;
private final int len;
public static /* synthetic */ Item copy$default(Item item, Object obj, int i, int i2, Object obj2) {
if ((i2 & 1) != 0) {
obj = item.item;
}
if ((i2 & 2) != 0) {
i = item.len;
}
return item.copy(obj, i);
}
public final Object component1() {
return this.item;
}
public final int component2() {
return this.len;
}
public final Item copy(Object item, int i) {
Intrinsics.checkNotNullParameter(item, "item");
return new Item(item, i);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Item)) {
return false;
}
Item item = (Item) obj;
return Intrinsics.areEqual(this.item, item.item) && this.len == item.len;
}
public final Object getItem() {
return this.item;
}
public final int getLen() {
return this.len;
}
public int hashCode() {
return (this.item.hashCode() * 31) + Integer.hashCode(this.len);
}
public String toString() {
return "Item(item=" + this.item + ", len=" + this.len + ')';
}
public Item(Object item, int i) {
Intrinsics.checkNotNullParameter(item, "item");
this.item = item;
this.len = i;
}
}
public static final class Arg {
private final long arg;
private final int len;
public static /* synthetic */ Arg copy$default(Arg arg, long j, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
j = arg.arg;
}
if ((i2 & 2) != 0) {
i = arg.len;
}
return arg.copy(j, i);
}
public final long component1() {
return this.arg;
}
public final int component2() {
return this.len;
}
public final Arg copy(long j, int i) {
return new Arg(j, i);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Arg)) {
return false;
}
Arg arg = (Arg) obj;
return this.arg == arg.arg && this.len == arg.len;
}
public final long getArg() {
return this.arg;
}
public final int getLen() {
return this.len;
}
public int hashCode() {
return (Long.hashCode(this.arg) * 31) + Integer.hashCode(this.len);
}
public String toString() {
return "Arg(arg=" + this.arg + ", len=" + this.len + ')';
}
public Arg(long j, int i) {
this.arg = j;
this.len = i;
}
}
public final Object decode(byte[] data) {
Intrinsics.checkNotNullParameter(data, "data");
return parseItem(data, 0).getItem();
}
/* JADX WARN: Type inference failed for: r2v0, types: [T, java.util.LinkedHashMap] */
public final byte[] encode(Object data) {
byte[] plus;
byte[] encodeToByteArray;
byte[] plus2;
byte[] plus3;
Intrinsics.checkNotNullParameter(data, "data");
if (data instanceof Number) {
if (data instanceof Double) {
throw new IllegalArgumentException("Don't support doubles yet");
}
long longValue = ((Number) data).longValue();
if (longValue >= 0) {
return createArg(this.TYPE_UNSIGNED_INT, longValue);
}
return createArg(this.TYPE_NEGATIVE_INT, (-1) - longValue);
}
if (data instanceof byte[]) {
plus3 = ArraysKt___ArraysJvmKt.plus(createArg(this.TYPE_BYTE_STRING, r6.length), (byte[]) data);
return plus3;
}
if (data instanceof String) {
byte[] createArg = createArg(this.TYPE_TEXT_STRING, r6.length());
encodeToByteArray = StringsKt__StringsJVMKt.encodeToByteArray((String) data);
plus2 = ArraysKt___ArraysJvmKt.plus(createArg, encodeToByteArray);
return plus2;
}
if (data instanceof List) {
byte[] createArg2 = createArg(this.TYPE_ARRAY, r6.size());
for (Object obj : (List) data) {
Intrinsics.checkNotNull(obj);
createArg2 = ArraysKt___ArraysJvmKt.plus(createArg2, encode(obj));
}
return createArg2;
}
if (data instanceof Map) {
byte[] createArg3 = createArg(this.TYPE_MAP, r6.size());
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
objectRef.element = new LinkedHashMap();
for (Map.Entry entry : ((Map) data).entrySet()) {
Map map = (Map) objectRef.element;
Object key = entry.getKey();
Intrinsics.checkNotNull(key);
byte[] encode = encode(key);
Object value = entry.getValue();
Intrinsics.checkNotNull(value);
map.put(encode, encode(value));
}
ArrayList arrayList = new ArrayList(((Map) objectRef.element).keySet());
CollectionsKt___CollectionsKt.sortedWith(arrayList, new Comparator() { // from class: androidx.credentials.webauthn.Cbor$$ExternalSyntheticLambda0
@Override // java.util.Comparator
public final int compare(Object obj2, Object obj3) {
int encode$lambda$0;
encode$lambda$0 = Cbor.encode$lambda$0(Ref.ObjectRef.this, (byte[]) obj2, (byte[]) obj3);
return encode$lambda$0;
}
});
Iterator it = arrayList.iterator();
while (it.hasNext()) {
byte[] key2 = (byte[]) it.next();
Intrinsics.checkNotNullExpressionValue(key2, "key");
plus = ArraysKt___ArraysJvmKt.plus(createArg3, key2);
Object obj2 = ((Map) objectRef.element).get(key2);
Intrinsics.checkNotNull(obj2);
createArg3 = ArraysKt___ArraysJvmKt.plus(plus, (byte[]) obj2);
}
return createArg3;
}
throw new IllegalArgumentException("Bad type");
}
/* JADX INFO: Access modifiers changed from: private */
public static final int encode$lambda$0(Ref.ObjectRef objectRef, byte[] bArr, byte[] bArr2) {
Object obj = ((Map) objectRef.element).get(bArr);
Intrinsics.checkNotNull(obj);
byte[] bArr3 = (byte[]) obj;
Object obj2 = ((Map) objectRef.element).get(bArr2);
Intrinsics.checkNotNull(obj2);
byte[] bArr4 = (byte[]) obj2;
if (bArr.length > bArr2.length) {
return 1;
}
if (bArr.length >= bArr2.length) {
if (bArr3.length > bArr4.length) {
return 1;
}
if (bArr3.length >= bArr4.length) {
return 0;
}
}
return -1;
}
private final int getType(byte[] bArr, int i) {
return (bArr[i] & 255) >> 5;
}
private final Arg getArg(byte[] bArr, int i) {
long j = bArr[i] & 31;
if (j < 24) {
return new Arg(j, 1);
}
if (j == 24) {
return new Arg(bArr[i + 1] & 255, 2);
}
if (j == 25) {
return new Arg((bArr[i + 2] & 255) | ((bArr[i + 1] & 255) << 8), 3);
}
if (j == 26) {
return new Arg((bArr[i + 4] & 255) | ((bArr[i + 1] & 255) << 24) | ((bArr[i + 2] & 255) << 16) | ((bArr[i + 3] & 255) << 8), 5);
}
throw new IllegalArgumentException("Bad arg");
}
private final Item parseItem(byte[] bArr, int i) {
Map map;
IntRange until;
byte[] sliceArray;
IntRange until2;
byte[] sliceArray2;
int type = getType(bArr, i);
Arg arg = getArg(bArr, i);
System.out.println((Object) ("Type " + type + ' ' + arg.getArg() + ' ' + arg.getLen()));
if (type == this.TYPE_UNSIGNED_INT) {
return new Item(Long.valueOf(arg.getArg()), arg.getLen());
}
if (type == this.TYPE_NEGATIVE_INT) {
return new Item(Long.valueOf((-1) - arg.getArg()), arg.getLen());
}
if (type == this.TYPE_BYTE_STRING) {
until2 = RangesKt___RangesKt.until(arg.getLen() + i, i + arg.getLen() + ((int) arg.getArg()));
sliceArray2 = ArraysKt___ArraysKt.sliceArray(bArr, until2);
return new Item(sliceArray2, arg.getLen() + ((int) arg.getArg()));
}
if (type == this.TYPE_TEXT_STRING) {
until = RangesKt___RangesKt.until(arg.getLen() + i, i + arg.getLen() + ((int) arg.getArg()));
sliceArray = ArraysKt___ArraysKt.sliceArray(bArr, until);
return new Item(new String(sliceArray, Charsets.UTF_8), arg.getLen() + ((int) arg.getArg()));
}
int i2 = 0;
if (type == this.TYPE_ARRAY) {
ArrayList arrayList = new ArrayList();
int len = arg.getLen();
int arg2 = (int) arg.getArg();
while (i2 < arg2) {
Item parseItem = parseItem(bArr, i + len);
arrayList.add(parseItem.getItem());
len += parseItem.getLen();
i2++;
}
return new Item(CollectionsKt___CollectionsKt.toList(arrayList), len);
}
if (type == this.TYPE_MAP) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
int len2 = arg.getLen();
int arg3 = (int) arg.getArg();
while (i2 < arg3) {
Item parseItem2 = parseItem(bArr, i + len2);
int len3 = len2 + parseItem2.getLen();
Item parseItem3 = parseItem(bArr, i + len3);
len2 = len3 + parseItem3.getLen();
linkedHashMap.put(parseItem2.getItem(), parseItem3.getItem());
i2++;
}
map = MapsKt__MapsKt.toMap(linkedHashMap);
return new Item(map, len2);
}
throw new IllegalArgumentException("Bad type");
}
private final byte[] createArg(int i, long j) {
int i2 = i << 5;
int i3 = (int) j;
if (j < 24) {
return new byte[]{(byte) ((i2 | i3) & 255)};
}
if (j <= 255) {
return new byte[]{(byte) ((i2 | 24) & 255), (byte) (i3 & 255)};
}
if (j <= 65535) {
return new byte[]{(byte) ((i2 | 25) & 255), (byte) ((i3 >> 8) & 255), (byte) (i3 & 255)};
}
if (j <= 4294967295L) {
return new byte[]{(byte) ((i2 | 26) & 255), (byte) ((i3 >> 24) & 255), (byte) ((i3 >> 16) & 255), (byte) ((i3 >> 8) & 255), (byte) (i3 & 255)};
}
throw new IllegalArgumentException("bad Arg");
}
}

View File

@@ -0,0 +1,49 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import com.ironsource.cr;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class FidoPublicKeyCredential {
private final String authenticatorAttachment;
private final byte[] rawId;
private final AuthenticatorResponse response;
public final String getAuthenticatorAttachment() {
return this.authenticatorAttachment;
}
public final byte[] getRawId() {
return this.rawId;
}
public final AuthenticatorResponse getResponse() {
return this.response;
}
public FidoPublicKeyCredential(byte[] rawId, AuthenticatorResponse response, String authenticatorAttachment) {
Intrinsics.checkNotNullParameter(rawId, "rawId");
Intrinsics.checkNotNullParameter(response, "response");
Intrinsics.checkNotNullParameter(authenticatorAttachment, "authenticatorAttachment");
this.rawId = rawId;
this.response = response;
this.authenticatorAttachment = authenticatorAttachment;
}
public final String json() {
String b64Encode = WebAuthnUtils.Companion.b64Encode(this.rawId);
JSONObject jSONObject = new JSONObject();
jSONObject.put("id", b64Encode);
jSONObject.put("rawId", b64Encode);
jSONObject.put("type", "public-key");
jSONObject.put("authenticatorAttachment", this.authenticatorAttachment);
jSONObject.put(cr.n, this.response.json());
jSONObject.put("clientExtensionResults", new JSONObject());
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "ret.toString()");
return jSONObject2;
}
}

View File

@@ -0,0 +1,148 @@
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);
}
}

View File

@@ -0,0 +1,87 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import java.util.Arrays;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class PublicKeyCredentialDescriptor {
private final byte[] id;
private final List<String> transports;
private final String type;
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ PublicKeyCredentialDescriptor copy$default(PublicKeyCredentialDescriptor publicKeyCredentialDescriptor, String str, byte[] bArr, List list, int i, Object obj) {
if ((i & 1) != 0) {
str = publicKeyCredentialDescriptor.type;
}
if ((i & 2) != 0) {
bArr = publicKeyCredentialDescriptor.id;
}
if ((i & 4) != 0) {
list = publicKeyCredentialDescriptor.transports;
}
return publicKeyCredentialDescriptor.copy(str, bArr, list);
}
public final String component1() {
return this.type;
}
public final byte[] component2() {
return this.id;
}
public final List<String> component3() {
return this.transports;
}
public final PublicKeyCredentialDescriptor copy(String type, byte[] id, List<String> transports) {
Intrinsics.checkNotNullParameter(type, "type");
Intrinsics.checkNotNullParameter(id, "id");
Intrinsics.checkNotNullParameter(transports, "transports");
return new PublicKeyCredentialDescriptor(type, id, transports);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PublicKeyCredentialDescriptor)) {
return false;
}
PublicKeyCredentialDescriptor publicKeyCredentialDescriptor = (PublicKeyCredentialDescriptor) obj;
return Intrinsics.areEqual(this.type, publicKeyCredentialDescriptor.type) && Intrinsics.areEqual(this.id, publicKeyCredentialDescriptor.id) && Intrinsics.areEqual(this.transports, publicKeyCredentialDescriptor.transports);
}
public final byte[] getId() {
return this.id;
}
public final List<String> getTransports() {
return this.transports;
}
public final String getType() {
return this.type;
}
public int hashCode() {
return (((this.type.hashCode() * 31) + Arrays.hashCode(this.id)) * 31) + this.transports.hashCode();
}
public String toString() {
return "PublicKeyCredentialDescriptor(type=" + this.type + ", id=" + Arrays.toString(this.id) + ", transports=" + this.transports + ')';
}
public PublicKeyCredentialDescriptor(String type, byte[] id, List<String> transports) {
Intrinsics.checkNotNullParameter(type, "type");
Intrinsics.checkNotNullParameter(id, "id");
Intrinsics.checkNotNullParameter(transports, "transports");
this.type = type;
this.id = id;
this.transports = transports;
}
}

View File

@@ -0,0 +1,67 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class PublicKeyCredentialParameters {
private final long alg;
private final String type;
public static /* synthetic */ PublicKeyCredentialParameters copy$default(PublicKeyCredentialParameters publicKeyCredentialParameters, String str, long j, int i, Object obj) {
if ((i & 1) != 0) {
str = publicKeyCredentialParameters.type;
}
if ((i & 2) != 0) {
j = publicKeyCredentialParameters.alg;
}
return publicKeyCredentialParameters.copy(str, j);
}
public final String component1() {
return this.type;
}
public final long component2() {
return this.alg;
}
public final PublicKeyCredentialParameters copy(String type, long j) {
Intrinsics.checkNotNullParameter(type, "type");
return new PublicKeyCredentialParameters(type, j);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PublicKeyCredentialParameters)) {
return false;
}
PublicKeyCredentialParameters publicKeyCredentialParameters = (PublicKeyCredentialParameters) obj;
return Intrinsics.areEqual(this.type, publicKeyCredentialParameters.type) && this.alg == publicKeyCredentialParameters.alg;
}
public final long getAlg() {
return this.alg;
}
public final String getType() {
return this.type;
}
public int hashCode() {
return (this.type.hashCode() * 31) + Long.hashCode(this.alg);
}
public String toString() {
return "PublicKeyCredentialParameters(type=" + this.type + ", alg=" + this.alg + ')';
}
public PublicKeyCredentialParameters(String type, long j) {
Intrinsics.checkNotNullParameter(type, "type");
this.type = type;
this.alg = j;
}
}

View File

@@ -0,0 +1,54 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import androidx.credentials.webauthn.WebAuthnUtils;
import com.google.android.gms.fido.u2f.api.common.ClientData;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class PublicKeyCredentialRequestOptions {
private final byte[] challenge;
private final JSONObject json;
private final String rpId;
private final long timeout;
private final String userVerification;
public final byte[] getChallenge() {
return this.challenge;
}
public final JSONObject getJson() {
return this.json;
}
public final String getRpId() {
return this.rpId;
}
public final long getTimeout() {
return this.timeout;
}
public final String getUserVerification() {
return this.userVerification;
}
public PublicKeyCredentialRequestOptions(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);
this.timeout = jSONObject.optLong("timeout", 0L);
String optString = jSONObject.optString("rpId", "");
Intrinsics.checkNotNullExpressionValue(optString, "json.optString(\"rpId\", \"\")");
this.rpId = optString;
String optString2 = jSONObject.optString("userVerification", "preferred");
Intrinsics.checkNotNullExpressionValue(optString2, "json.optString(\"userVerification\", \"preferred\")");
this.userVerification = optString2;
}
}

View File

@@ -0,0 +1,69 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class PublicKeyCredentialRpEntity {
private final String id;
private final String name;
public static /* synthetic */ PublicKeyCredentialRpEntity copy$default(PublicKeyCredentialRpEntity publicKeyCredentialRpEntity, String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str = publicKeyCredentialRpEntity.name;
}
if ((i & 2) != 0) {
str2 = publicKeyCredentialRpEntity.id;
}
return publicKeyCredentialRpEntity.copy(str, str2);
}
public final String component1() {
return this.name;
}
public final String component2() {
return this.id;
}
public final PublicKeyCredentialRpEntity copy(String name, String id) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(id, "id");
return new PublicKeyCredentialRpEntity(name, id);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PublicKeyCredentialRpEntity)) {
return false;
}
PublicKeyCredentialRpEntity publicKeyCredentialRpEntity = (PublicKeyCredentialRpEntity) obj;
return Intrinsics.areEqual(this.name, publicKeyCredentialRpEntity.name) && Intrinsics.areEqual(this.id, publicKeyCredentialRpEntity.id);
}
public final String getId() {
return this.id;
}
public final String getName() {
return this.name;
}
public int hashCode() {
return (this.name.hashCode() * 31) + this.id.hashCode();
}
public String toString() {
return "PublicKeyCredentialRpEntity(name=" + this.name + ", id=" + this.id + ')';
}
public PublicKeyCredentialRpEntity(String name, String id) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(id, "id");
this.name = name;
this.id = id;
}
}

View File

@@ -0,0 +1,85 @@
package androidx.credentials.webauthn;
import androidx.annotation.RestrictTo;
import java.util.Arrays;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class PublicKeyCredentialUserEntity {
private final String displayName;
private final byte[] id;
private final String name;
public static /* synthetic */ PublicKeyCredentialUserEntity copy$default(PublicKeyCredentialUserEntity publicKeyCredentialUserEntity, String str, byte[] bArr, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str = publicKeyCredentialUserEntity.name;
}
if ((i & 2) != 0) {
bArr = publicKeyCredentialUserEntity.id;
}
if ((i & 4) != 0) {
str2 = publicKeyCredentialUserEntity.displayName;
}
return publicKeyCredentialUserEntity.copy(str, bArr, str2);
}
public final String component1() {
return this.name;
}
public final byte[] component2() {
return this.id;
}
public final String component3() {
return this.displayName;
}
public final PublicKeyCredentialUserEntity copy(String name, byte[] id, String displayName) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(id, "id");
Intrinsics.checkNotNullParameter(displayName, "displayName");
return new PublicKeyCredentialUserEntity(name, id, displayName);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PublicKeyCredentialUserEntity)) {
return false;
}
PublicKeyCredentialUserEntity publicKeyCredentialUserEntity = (PublicKeyCredentialUserEntity) obj;
return Intrinsics.areEqual(this.name, publicKeyCredentialUserEntity.name) && Intrinsics.areEqual(this.id, publicKeyCredentialUserEntity.id) && Intrinsics.areEqual(this.displayName, publicKeyCredentialUserEntity.displayName);
}
public final String getDisplayName() {
return this.displayName;
}
public final byte[] getId() {
return this.id;
}
public final String getName() {
return this.name;
}
public int hashCode() {
return (((this.name.hashCode() * 31) + Arrays.hashCode(this.id)) * 31) + this.displayName.hashCode();
}
public String toString() {
return "PublicKeyCredentialUserEntity(name=" + this.name + ", id=" + Arrays.toString(this.id) + ", displayName=" + this.displayName + ')';
}
public PublicKeyCredentialUserEntity(String name, byte[] id, String displayName) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(id, "id");
Intrinsics.checkNotNullParameter(displayName, "displayName");
this.name = name;
this.id = id;
this.displayName = displayName;
}
}

View File

@@ -0,0 +1,42 @@
package androidx.credentials.webauthn;
import android.os.Build;
import android.util.Base64;
import androidx.annotation.RestrictTo;
import androidx.credentials.provider.CallingAppInfo;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class WebAuthnUtils {
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final byte[] b64Decode(String str) {
Intrinsics.checkNotNullParameter(str, "str");
byte[] decode = Base64.decode(str, 11);
Intrinsics.checkNotNullExpressionValue(decode, "decode(str, Base64.NO_PA…_WRAP or Base64.URL_SAFE)");
return decode;
}
public final String b64Encode(byte[] data) {
Intrinsics.checkNotNullParameter(data, "data");
String encodeToString = Base64.encodeToString(data, 11);
Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(\n …64.URL_SAFE\n )");
return encodeToString;
}
public final String appInfoToOrigin(CallingAppInfo info) {
Intrinsics.checkNotNullParameter(info, "info");
return Build.VERSION.SDK_INT >= 28 ? WebAuthnUtilsApi28.Companion.appInfoToOrigin(info) : "";
}
}
}

View File

@@ -0,0 +1,39 @@
package androidx.credentials.webauthn;
import android.content.pm.Signature;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.credentials.provider.CallingAppInfo;
import androidx.credentials.webauthn.WebAuthnUtils;
import java.security.MessageDigest;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RequiresApi(28)
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class WebAuthnUtilsApi28 {
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final String appInfoToOrigin(CallingAppInfo info) {
Signature[] apkContentsSigners;
Intrinsics.checkNotNullParameter(info, "info");
apkContentsSigners = info.getSigningInfo().getApkContentsSigners();
byte[] certHash = MessageDigest.getInstance("SHA-256").digest(apkContentsSigners[0].toByteArray());
StringBuilder sb = new StringBuilder();
sb.append("android:apk-key-hash:");
WebAuthnUtils.Companion companion = WebAuthnUtils.Companion;
Intrinsics.checkNotNullExpressionValue(certHash, "certHash");
sb.append(companion.b64Encode(certHash));
return sb.toString();
}
}
}