CREATOR = findCreator(AuthenticationExtensionsClientOutputs.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticationExtensionsCredPropsOutputs.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticationExtensionsCredPropsOutputs.java
new file mode 100644
index 0000000000000000000000000000000000000000..0dd5f6f648202ffde437e4f1ab5e53d5b8a32825
--- /dev/null
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticationExtensionsCredPropsOutputs.java
@@ -0,0 +1,55 @@
+/*
+ * SPDX-FileCopyrightText: 2023 microG Project Team
+ * SPDX-License-Identifier: Apache-2.0
+ * Notice: Portions of this file are reproduced from work created and shared by Google and used
+ * according to terms described in the Creative Commons 4.0 Attribution License.
+ * See https://developers.google.com/readme/policies for details.
+ */
+
+package com.google.android.gms.fido.fido2.api.common;
+
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
+
+import java.util.Objects;
+
+/**
+ * Class that holds the result of the credProps extension.
+ *
+ * Since this extension only reports information, it is always included in registration responses and does not need to be requested.
+ */
+@SafeParcelable.Class
+public class AuthenticationExtensionsCredPropsOutputs extends AbstractSafeParcelable {
+ @Field(value = 1, getterName = "getIsDiscoverableCredential")
+ private boolean rk;
+
+ @Constructor
+ public AuthenticationExtensionsCredPropsOutputs(@Param(1) boolean rk) {
+ this.rk = rk;
+ }
+
+ public boolean equals(Object other) {
+ return (other instanceof AuthenticationExtensionsCredPropsOutputs) && this.rk == ((AuthenticationExtensionsCredPropsOutputs) other).rk;
+ }
+
+ /**
+ * This value reflects the "rk" flag of the WebAuthn extension.
+ */
+ public boolean getIsDiscoverableCredential() {
+ return rk;
+ }
+
+ public int hashCode() {
+ return Objects.hashCode(new Object[]{this.rk});
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AuthenticationExtensionsCredPropsOutputs.class);
+}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAssertionResponse.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAssertionResponse.java
index 2bbe0c0ee66d41d8b59958fc6a25771a71e8e946..e4da7b2288099e964fbea8d79e90ddd6e6835ae3 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAssertionResponse.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAssertionResponse.java
@@ -8,6 +8,11 @@
package com.google.android.gms.fido.fido2.api.common;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -19,21 +24,29 @@ import java.util.Arrays;
* of a private key as well as evidence of user consent to a specific transaction.
*/
@PublicApi
+@SafeParcelable.Class
public class AuthenticatorAssertionResponse extends AuthenticatorResponse {
- @Field(2)
+ @Field(value = 2, getterName = "getKeyHandle")
+ @NonNull
private byte[] keyHandle;
- @Field(3)
+ @Field(value = 3, getterName = "getClientDataJSON")
+ @NonNull
private byte[] clientDataJSON;
- @Field(4)
+ @Field(value = 4, getterName = "getAuthenticatorData")
+ @NonNull
private byte[] authenticatorData;
- @Field(5)
+ @Field(value = 5, getterName = "getSignature")
+ @NonNull
private byte[] signature;
- @Field(6)
+ @Field(value = 6, getterName = "getUserHandle")
+ @Nullable
private byte[] userHandle;
- private AuthenticatorAssertionResponse() {}
+ private AuthenticatorAssertionResponse() {
+ }
- public AuthenticatorAssertionResponse(byte[] keyHandle, byte[] clientDataJSON, byte[] authenticatorData, byte[] signature, byte[] userHandle) {
+ @Constructor
+ public AuthenticatorAssertionResponse(@Param(2) @NonNull byte[] keyHandle, @Param(3) @NonNull byte[] clientDataJSON, @Param(4) @NonNull byte[] authenticatorData, @Param(5) @NonNull byte[] signature, @Param(6) @Nullable byte[] userHandle) {
this.keyHandle = keyHandle;
this.clientDataJSON = clientDataJSON;
this.authenticatorData = authenticatorData;
@@ -41,11 +54,13 @@ public class AuthenticatorAssertionResponse extends AuthenticatorResponse {
this.userHandle = userHandle;
}
+ @NonNull
public byte[] getAuthenticatorData() {
return authenticatorData;
}
@Override
+ @NonNull
public byte[] getClientDataJSON() {
return clientDataJSON;
}
@@ -54,19 +69,23 @@ public class AuthenticatorAssertionResponse extends AuthenticatorResponse {
* @deprecated use {@link PublicKeyCredential#getRawId()} instead
*/
@Deprecated
+ @NonNull
public byte[] getKeyHandle() {
return keyHandle;
}
+ @NonNull
public byte[] getSignature() {
return signature;
}
+ @Nullable
public byte[] getUserHandle() {
return userHandle;
}
@Override
+ @NonNull
public byte[] serializeToBytes() {
return SafeParcelableSerializer.serializeToBytes(this);
}
@@ -91,6 +110,7 @@ public class AuthenticatorAssertionResponse extends AuthenticatorResponse {
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("AuthenticatorAssertionResponse")
.field("keyHandle", keyHandle)
@@ -101,9 +121,15 @@ public class AuthenticatorAssertionResponse extends AuthenticatorResponse {
.end();
}
+ @NonNull
public static AuthenticatorAssertionResponse deserializeFromBytes(byte[] serializedBytes) {
return SafeParcelableSerializer.deserializeFromBytes(serializedBytes, CREATOR);
}
- public static final Creator CREATOR = new AutoCreator<>(AuthenticatorAssertionResponse.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AuthenticatorAssertionResponse.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAttestationResponse.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAttestationResponse.java
index 33537104bb0f79b5c940602cbb705aba121f9e3b..4aeb1798f018bbd900361ed360050eb8484fa6c7 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAttestationResponse.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorAttestationResponse.java
@@ -8,7 +8,12 @@
package com.google.android.gms.fido.fido2.api.common;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
+import org.microg.gms.common.Hide;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -18,28 +23,40 @@ import java.util.Arrays;
* Represents a newly-created scoped credential, aka the response from a registration request.
*/
@PublicApi
+@SafeParcelable.Class
public class AuthenticatorAttestationResponse extends AuthenticatorResponse {
- @Field(2)
+ @Field(value = 2, getterName = "getKeyHandle")
+ @NonNull
private byte[] keyHandle;
- @Field(3)
+ @Field(value = 3, getterName = "getClientDataJSON")
+ @NonNull
private byte[] clientDataJSON;
- @Field(4)
+ @Field(value = 4, getterName = "getAttestationObject")
+ @NonNull
private byte[] attestationObject;
+ @Field(value = 5, getterName = "getTransports")
+ @NonNull
+ private String[] transports;
- private AuthenticatorAttestationResponse() {}
+ private AuthenticatorAttestationResponse() {
+ }
- @PublicApi(exclude = true)
- public AuthenticatorAttestationResponse(byte[] keyHandle, byte[] clientDataJSON, byte[] attestationObject) {
+ @Hide
+ @Constructor
+ public AuthenticatorAttestationResponse(@Param(2) @NonNull byte[] keyHandle, @Param(3) @NonNull byte[] clientDataJSON, @Param(4) @NonNull byte[] attestationObject, @Param(5) @NonNull String[] transports) {
this.keyHandle = keyHandle;
this.clientDataJSON = clientDataJSON;
this.attestationObject = attestationObject;
+ this.transports = transports;
}
+ @NonNull
public byte[] getAttestationObject() {
return attestationObject;
}
@Override
+ @NonNull
public byte[] getClientDataJSON() {
return clientDataJSON;
}
@@ -48,11 +65,18 @@ public class AuthenticatorAttestationResponse extends AuthenticatorResponse {
* @deprecated use {@link PublicKeyCredential#getRawId()} instead
*/
@Deprecated
+ @NonNull
public byte[] getKeyHandle() {
return keyHandle;
}
+ @NonNull
+ public String[] getTransports() {
+ return transports;
+ }
+
@Override
+ @NonNull
public byte[] serializeToBytes() {
return SafeParcelableSerializer.serializeToBytes(this);
}
@@ -66,26 +90,36 @@ public class AuthenticatorAttestationResponse extends AuthenticatorResponse {
if (!Arrays.equals(keyHandle, that.keyHandle)) return false;
if (!Arrays.equals(clientDataJSON, that.clientDataJSON)) return false;
- return Arrays.equals(attestationObject, that.attestationObject);
+ if (!Arrays.equals(attestationObject, that.attestationObject)) return false;
+ if (!Arrays.equals(transports, that.transports)) return false;
+ return true;
}
@Override
public int hashCode() {
- return Arrays.hashCode(new Object[]{Arrays.hashCode(keyHandle), Arrays.hashCode(clientDataJSON), Arrays.hashCode(attestationObject)});
+ return Arrays.hashCode(new Object[]{Arrays.hashCode(keyHandle), Arrays.hashCode(clientDataJSON), Arrays.hashCode(attestationObject), Arrays.hashCode(transports)});
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("AuthenticatorAttestationResponse")
.field("keyHandle", keyHandle)
.field("clientDataJSON", clientDataJSON)
.field("attestationObject", attestationObject)
+ .field("transports", transports)
.end();
}
+ @NonNull
public static AuthenticatorAttestationResponse deserializeFromBytes(byte[] serializedBytes) {
return SafeParcelableSerializer.deserializeFromBytes(serializedBytes, CREATOR);
}
- public static final Creator CREATOR = new AutoCreator<>(AuthenticatorAttestationResponse.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AuthenticatorAttestationResponse.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorErrorResponse.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorErrorResponse.java
index 1c20bfc5c30a06737998b45b7f2504f2026f0cd8..981e939f6d6f6c0fc15e5ebe23c6c1051cb79e2f 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorErrorResponse.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorErrorResponse.java
@@ -8,7 +8,13 @@
package com.google.android.gms.fido.fido2.api.common;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
+import org.microg.gms.common.Hide;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -18,26 +24,40 @@ import java.util.Arrays;
* The response after an error occurred.
*/
@PublicApi
+@SafeParcelable.Class
public class AuthenticatorErrorResponse extends AuthenticatorResponse {
- @Field(2)
+ @Field(value = 2, getterName = "getErrorCode")
+ @NonNull
private ErrorCode errorCode;
- @Field(3)
+ @Field(value = 3, getterName = "getErrorMessage")
+ @Nullable
private String errorMessage;
+ @Field(value = 4, getterName = "getInternalErrorCode")
+ private int internalErrorCode;
private AuthenticatorErrorResponse() {
}
- @PublicApi(exclude = true)
- public AuthenticatorErrorResponse(ErrorCode errorCode, String errorMessage) {
+ @Hide
+ public AuthenticatorErrorResponse(@NonNull ErrorCode errorCode, @Nullable String errorMessage) {
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
+ @Constructor
+ AuthenticatorErrorResponse(@Param(2) @NonNull ErrorCode errorCode, @Param(3) @Nullable String errorMessage, @Param(4) int internalErrorCode) {
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ this.internalErrorCode = internalErrorCode;
+ }
+
@Override
+ @NonNull
public byte[] getClientDataJSON() {
throw new UnsupportedOperationException();
}
+ @NonNull
public ErrorCode getErrorCode() {
return errorCode;
}
@@ -46,11 +66,18 @@ public class AuthenticatorErrorResponse extends AuthenticatorResponse {
return errorCode.getCode();
}
+ @Nullable
public String getErrorMessage() {
return errorMessage;
}
+ @Hide
+ public int getInternalErrorCode() {
+ return internalErrorCode;
+ }
+
@Override
+ @NonNull
public byte[] serializeToBytes() {
return SafeParcelableSerializer.serializeToBytes(this);
}
@@ -63,15 +90,18 @@ public class AuthenticatorErrorResponse extends AuthenticatorResponse {
AuthenticatorErrorResponse that = (AuthenticatorErrorResponse) o;
if (errorCode != null ? !errorCode.equals(that.errorCode) : that.errorCode != null) return false;
- return errorMessage != null ? errorMessage.equals(that.errorMessage) : that.errorMessage == null;
+ if (errorMessage != null ? !errorMessage.equals(that.errorMessage) : that.errorMessage != null) return false;
+ if (internalErrorCode != that.internalErrorCode) return false;
+ return true;
}
@Override
public int hashCode() {
- return Arrays.hashCode(new Object[]{errorCode, errorMessage});
+ return Arrays.hashCode(new Object[]{errorCode, errorMessage, internalErrorCode});
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("AuthenticatorErrorResponse")
.value(errorCode.name())
@@ -79,9 +109,15 @@ public class AuthenticatorErrorResponse extends AuthenticatorResponse {
.end();
}
+ @NonNull
public static AuthenticatorErrorResponse deserializeFromBytes(byte[] serializedBytes) {
return SafeParcelableSerializer.deserializeFromBytes(serializedBytes, CREATOR);
}
- public static final Creator CREATOR = new AutoCreator<>(AuthenticatorErrorResponse.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AuthenticatorErrorResponse.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorResponse.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorResponse.java
index 0a904f92ee1a6630a57d44051f023e8e507d63d0..24e2f3a48aea97a700907d45dc35608c549f1b5c 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorResponse.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorResponse.java
@@ -8,13 +8,16 @@
package com.google.android.gms.fido.fido2.api.common;
-import org.microg.safeparcel.AutoSafeParcelable;
+import androidx.annotation.NonNull;
+import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
/**
* Authenticators respond to relying party requests by returning an object derived from this interface.
*/
-public abstract class AuthenticatorResponse extends AutoSafeParcelable {
+public abstract class AuthenticatorResponse extends AbstractSafeParcelable {
+ @NonNull
public abstract byte[] getClientDataJSON();
+ @NonNull
public abstract byte[] serializeToBytes();
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorSelectionCriteria.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorSelectionCriteria.java
index 8513762ed561a29915204a7c0f2f719389171009..9ad09bfaa247888f6c462619370735c954dc3a48 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorSelectionCriteria.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AuthenticatorSelectionCriteria.java
@@ -8,9 +8,14 @@
package com.google.android.gms.fido.fido2.api.common;
-import org.microg.gms.common.PublicApi;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
+import org.microg.gms.common.Hide;
import org.microg.gms.utils.ToStringHelper;
-import org.microg.safeparcel.AutoSafeParcelable;
import java.util.Arrays;
@@ -18,30 +23,58 @@ import java.util.Arrays;
* Relying Parties may use {@link AuthenticatorSelectionCriteria} to specify their requirements regarding authenticator
* attributes.
*/
-public class AuthenticatorSelectionCriteria extends AutoSafeParcelable {
- @Field(2)
+@SafeParcelable.Class
+public class AuthenticatorSelectionCriteria extends AbstractSafeParcelable {
+ @Field(value = 2, getterName = "getAttachment")
+ @Nullable
private Attachment attachment;
- @Field(3)
+ @Field(value = 3, getterName = "getRequireResidentKey")
+ @Nullable
private Boolean requireResidentKey;
- @Field(4)
+ @Field(value = 4, getterName = "getRequireUserVerification")
+ @Nullable
private UserVerificationRequirement requireUserVerification;
+ @Field(value = 5, getterName = "getResidentKeyRequirement")
+ @Nullable
+ private ResidentKeyRequirement residentKeyRequirement;
+
+ @Constructor
+ AuthenticatorSelectionCriteria(@Param(2) @Nullable Attachment attachment, @Param(3) @Nullable Boolean requireResidentKey, @Param(4) @Nullable UserVerificationRequirement requireUserVerification, @Param(5) @Nullable ResidentKeyRequirement residentKeyRequirement) {
+ this.attachment = attachment;
+ this.requireResidentKey = requireResidentKey;
+ this.requireUserVerification = requireUserVerification;
+ this.residentKeyRequirement = residentKeyRequirement;
+ }
+ @Nullable
public Attachment getAttachment() {
return attachment;
}
+ @Nullable
public String getAttachmentAsString() {
- if (this.attachment == null) {
- return null;
- }
+ if (attachment == null) return null;
return attachment.toString();
}
+ @Nullable
public Boolean getRequireResidentKey() {
return requireResidentKey;
}
- @PublicApi(exclude = true)
+ @Nullable
+ public ResidentKeyRequirement getResidentKeyRequirement() {
+ return residentKeyRequirement;
+ }
+
+ @Nullable
+ public String getResidentKeyRequirementAsString() {
+ if (residentKeyRequirement == null) return null;
+ return residentKeyRequirement.toString();
+ }
+
+ @Hide
+ @Nullable
public UserVerificationRequirement getRequireUserVerification() {
return requireUserVerification;
}
@@ -54,9 +87,10 @@ public class AuthenticatorSelectionCriteria extends AutoSafeParcelable {
AuthenticatorSelectionCriteria that = (AuthenticatorSelectionCriteria) o;
if (attachment != that.attachment) return false;
- if (requireResidentKey != null ? !requireResidentKey.equals(that.requireResidentKey) : that.requireResidentKey != null)
- return false;
- return requireUserVerification == that.requireUserVerification;
+ if (requireResidentKey != null ? !requireResidentKey.equals(that.requireResidentKey) : that.requireResidentKey != null) return false;
+ if (requireUserVerification != that.requireUserVerification) return false;
+ if (residentKeyRequirement != that.residentKeyRequirement) return false;
+ return true;
}
@Override
@@ -65,11 +99,13 @@ public class AuthenticatorSelectionCriteria extends AutoSafeParcelable {
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("AuthenticatorSelectionCriteria")
.field("attachment", attachment)
.field("requireResidentKey", requireResidentKey)
.field("requireUserVerification", requireUserVerification)
+ .field("residentKeyRequirement", residentKeyRequirement)
.end();
}
@@ -77,13 +113,17 @@ public class AuthenticatorSelectionCriteria extends AutoSafeParcelable {
* Builder for {@link AuthenticatorSelectionCriteria}.
*/
public static class Builder {
+ @Nullable
private Attachment attachment;
+ @Nullable
private Boolean requireResidentKey;
+ @Nullable
+ private ResidentKeyRequirement residentKeyRequirement;
/**
* Sets the attachment to use for this session.
*/
- public Builder setAttachment(Attachment attachment) {
+ public Builder setAttachment(@Nullable Attachment attachment) {
this.attachment = attachment;
return this;
}
@@ -91,18 +131,29 @@ public class AuthenticatorSelectionCriteria extends AutoSafeParcelable {
/**
* Sets whether the key created will be a resident key.
*/
- public Builder setRequireResidentKey(Boolean requireResidentKey) {
+ public Builder setRequireResidentKey(@Nullable Boolean requireResidentKey) {
this.requireResidentKey = requireResidentKey;
return this;
}
+ /**
+ * Sets residentKeyRequirement
+ */
+ public Builder setResidentKeyRequirement(@Nullable ResidentKeyRequirement residentKeyRequirement) {
+ this.residentKeyRequirement = residentKeyRequirement;
+ return this;
+ }
+
+ @NonNull
public AuthenticatorSelectionCriteria build() {
- AuthenticatorSelectionCriteria criteria = new AuthenticatorSelectionCriteria();
- criteria.attachment = attachment;
- criteria.requireResidentKey = requireResidentKey;
- return criteria;
+ return new AuthenticatorSelectionCriteria(attachment, requireResidentKey, null, residentKeyRequirement);
}
}
- public static final Creator CREATOR = new AutoCreator<>(AuthenticatorSelectionCriteria.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AuthenticatorSelectionCriteria.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialCreationOptions.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialCreationOptions.java
index a24b170456e4eca83a1ecfeb289e80e6f3d1ef91..707edcd6ad5dfbc2da3ce165a7d7beef1be9f4d0 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialCreationOptions.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialCreationOptions.java
@@ -7,7 +7,13 @@ package com.google.android.gms.fido.fido2.api.common;
import android.net.Uri;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
+import org.microg.gms.common.Hide;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -17,49 +23,68 @@ import java.util.Arrays;
* Parameters to a make credential request from a Web browser.
*/
@PublicApi
+@SafeParcelable.Class
public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOptions {
- @Field(2)
+ @Field(value = 2, getterName = "getPublicKeyCredentialCreationOptions")
+ @NonNull
private PublicKeyCredentialCreationOptions delegate;
- @Field(3)
+ @Field(value = 3, getterName = "getOrigin")
+ @NonNull
private Uri origin;
- @Field(4)
+ @Field(value = 4, getterName = "getClientDataHash")
+ @Nullable
private byte[] clientDataHash;
+ @Constructor
+ BrowserPublicKeyCredentialCreationOptions(@Param(2) @NonNull PublicKeyCredentialCreationOptions delegate, @Param(3) @NonNull Uri origin, @Param(4) @Nullable byte[] clientDataHash) {
+ this.delegate = delegate;
+ this.origin = origin;
+ this.clientDataHash = clientDataHash;
+ }
+
@Override
+ @Nullable
public AuthenticationExtensions getAuthenticationExtensions() {
return delegate.getAuthenticationExtensions();
}
@Override
+ @NonNull
public byte[] getChallenge() {
return delegate.getChallenge();
}
@Override
+ @Nullable
public byte[] getClientDataHash() {
return clientDataHash;
}
@Override
+ @NonNull
public Uri getOrigin() {
return origin;
}
+ @NonNull
public PublicKeyCredentialCreationOptions getPublicKeyCredentialCreationOptions() {
return delegate;
}
@Override
+ @Nullable
public Integer getRequestId() {
return delegate.getRequestId();
}
@Override
+ @Nullable
public Double getTimeoutSeconds() {
return delegate.getTimeoutSeconds();
}
@Override
+ @Nullable
public TokenBinding getTokenBinding() {
return delegate.getTokenBinding();
}
@@ -94,8 +119,11 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
* Builder for {@link BrowserPublicKeyCredentialCreationOptions}.
*/
public static class Builder {
+ @NonNull
private PublicKeyCredentialCreationOptions delegate;
+ @NonNull
private Uri origin;
+ @Nullable
private byte[] clientDataHash;
/**
@@ -115,7 +143,7 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
*
* @return
*/
- public BrowserPublicKeyCredentialCreationOptions.Builder setClientDataHash(byte[] clientDataHash) {
+ public BrowserPublicKeyCredentialCreationOptions.Builder setClientDataHash(@NonNull byte[] clientDataHash) {
this.clientDataHash = clientDataHash;
return this;
}
@@ -123,7 +151,7 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
/**
* Sets the origin on whose behalf the calling browser is requesting a registration operation.
*/
- public BrowserPublicKeyCredentialCreationOptions.Builder setOrigin(Uri origin) {
+ public BrowserPublicKeyCredentialCreationOptions.Builder setOrigin(@NonNull Uri origin) {
this.origin = origin;
return this;
}
@@ -131,7 +159,7 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
/**
* Sets the parameters to dictate the client behavior during this registration session.
*/
- public BrowserPublicKeyCredentialCreationOptions.Builder setPublicKeyCredentialCreationOptions(PublicKeyCredentialCreationOptions publicKeyCredentialCreationOptions) {
+ public BrowserPublicKeyCredentialCreationOptions.Builder setPublicKeyCredentialCreationOptions(@NonNull PublicKeyCredentialCreationOptions publicKeyCredentialCreationOptions) {
this.delegate = publicKeyCredentialCreationOptions;
return this;
}
@@ -139,12 +167,9 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
/**
* Builds the {@link BrowserPublicKeyCredentialCreationOptions} object.
*/
+ @NonNull
public BrowserPublicKeyCredentialCreationOptions build() {
- BrowserPublicKeyCredentialCreationOptions options = new BrowserPublicKeyCredentialCreationOptions();
- options.delegate = delegate;
- options.origin = origin;
- options.clientDataHash = clientDataHash;
- return options;
+ return new BrowserPublicKeyCredentialCreationOptions(delegate, origin, clientDataHash);
}
}
@@ -152,5 +177,10 @@ public class BrowserPublicKeyCredentialCreationOptions extends BrowserRequestOpt
return SafeParcelableSerializer.deserializeFromBytes(serializedBytes, CREATOR);
}
- public static final Creator CREATOR = new AutoCreator<>(BrowserPublicKeyCredentialCreationOptions.class);
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(BrowserPublicKeyCredentialCreationOptions.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialRequestOptions.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialRequestOptions.java
index be63a72ec639133271763f8c5f5228afa033192f..14d2af40a57ea81a54e8f1fc6f44b6d36c988fbb 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialRequestOptions.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserPublicKeyCredentialRequestOptions.java
@@ -7,6 +7,11 @@ package com.google.android.gms.fido.fido2.api.common;
import android.net.Uri;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -17,49 +22,68 @@ import java.util.Arrays;
* Parameters for a signature request from a Web Browser.
*/
@PublicApi
+@SafeParcelable.Class
public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOptions {
- @Field(2)
+ @Field(value = 2, getterName = "getPublicKeyCredentialRequestOptions")
+ @NonNull
private PublicKeyCredentialRequestOptions delegate;
- @Field(3)
+ @Field(value = 3, getterName = "getOrigin")
+ @NonNull
private Uri origin;
- @Field(4)
+ @Field(value = 4, getterName = "getClientDataHash")
+ @Nullable
private byte[] clientDataHash;
+ @Constructor
+ BrowserPublicKeyCredentialRequestOptions(@Param(2) @NonNull PublicKeyCredentialRequestOptions delegate, @Param(3) @NonNull Uri origin, @Param(4) @Nullable byte[] clientDataHash) {
+ this.delegate = delegate;
+ this.origin = origin;
+ this.clientDataHash = clientDataHash;
+ }
+
@Override
+ @Nullable
public AuthenticationExtensions getAuthenticationExtensions() {
return delegate.getAuthenticationExtensions();
}
@Override
+ @NonNull
public byte[] getChallenge() {
return delegate.getChallenge();
}
@Override
+ @Nullable
public byte[] getClientDataHash() {
return clientDataHash;
}
@Override
+ @NonNull
public Uri getOrigin() {
return origin;
}
+ @NonNull
public PublicKeyCredentialRequestOptions getPublicKeyCredentialRequestOptions() {
return delegate;
}
@Override
+ @Nullable
public Integer getRequestId() {
return delegate.getRequestId();
}
@Override
+ @Nullable
public Double getTimeoutSeconds() {
return delegate.getTimeoutSeconds();
}
@Override
+ @Nullable
public TokenBinding getTokenBinding() {
return delegate.getTokenBinding();
}
@@ -82,6 +106,7 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("BrowserPublicKeyCredentialRequestOptions")
.value(delegate)
@@ -94,8 +119,11 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
* Builder for {@link BrowserPublicKeyCredentialRequestOptions}.
*/
public static class Builder {
+ @NonNull
private PublicKeyCredentialRequestOptions delegate;
+ @NonNull
private Uri origin;
+ @Nullable
private byte[] clientDataHash;
/**
@@ -115,7 +143,7 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
*
* @return
*/
- public Builder setClientDataHash(byte[] clientDataHash) {
+ public Builder setClientDataHash(@NonNull byte[] clientDataHash) {
this.clientDataHash = clientDataHash;
return this;
}
@@ -123,7 +151,7 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
/**
* Sets the origin on whose behalf the calling browser is requesting an authentication operation.
*/
- public Builder setOrigin(Uri origin) {
+ public Builder setOrigin(@NonNull Uri origin) {
this.origin = origin;
return this;
}
@@ -131,7 +159,7 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
/**
* Sets the parameters to dictate client behavior during this authentication session.
*/
- public Builder setPublicKeyCredentialRequestOptions(PublicKeyCredentialRequestOptions publicKeyCredentialRequestOptions) {
+ public Builder setPublicKeyCredentialRequestOptions(@NonNull PublicKeyCredentialRequestOptions publicKeyCredentialRequestOptions) {
this.delegate = publicKeyCredentialRequestOptions;
return this;
}
@@ -139,12 +167,9 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
/**
* Builds the {@link BrowserPublicKeyCredentialRequestOptions} object.
*/
+ @NonNull
public BrowserPublicKeyCredentialRequestOptions build() {
- BrowserPublicKeyCredentialRequestOptions options = new BrowserPublicKeyCredentialRequestOptions();
- options.delegate = delegate;
- options.origin = origin;
- options.clientDataHash = clientDataHash;
- return options;
+ return new BrowserPublicKeyCredentialRequestOptions(delegate, origin, clientDataHash);
}
}
@@ -152,5 +177,10 @@ public class BrowserPublicKeyCredentialRequestOptions extends BrowserRequestOpti
return SafeParcelableSerializer.deserializeFromBytes(serializedBytes, CREATOR);
}
- public static final Creator CREATOR = new AutoCreator<>(BrowserPublicKeyCredentialRequestOptions.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(BrowserPublicKeyCredentialRequestOptions.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserRequestOptions.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserRequestOptions.java
index 407e9a785a94bbc1bda70893f1fd2c60cabb1e6e..232693e2a855a9ec3040ffa4357cb6d7f063f43b 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserRequestOptions.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/BrowserRequestOptions.java
@@ -9,6 +9,7 @@
package com.google.android.gms.fido.fido2.api.common;
import android.net.Uri;
+import androidx.annotation.NonNull;
/**
* An abstract class representing browser-based request parameters.
@@ -17,7 +18,9 @@ public abstract class BrowserRequestOptions extends RequestOptions {
/**
* Gets value of the client data hash.
*/
+ @NonNull
public abstract byte[] getClientDataHash();
+ @NonNull
public abstract Uri getOrigin();
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/COSEAlgorithmIdentifier.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/COSEAlgorithmIdentifier.java
index 326d44bd7c4057b9adbd01f936e1050de2961ec7..5279801a3edc9d464416b5906f913d577b801749 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/COSEAlgorithmIdentifier.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/COSEAlgorithmIdentifier.java
@@ -11,6 +11,7 @@ package com.google.android.gms.fido.fido2.api.common;
import android.os.Parcel;
import android.os.Parcelable;
+import androidx.annotation.NonNull;
import org.microg.gms.common.PublicApi;
import org.microg.gms.utils.ToStringHelper;
@@ -25,6 +26,7 @@ public class COSEAlgorithmIdentifier implements Parcelable {
this.algorithm = algorithm;
}
+ @NonNull
public static COSEAlgorithmIdentifier fromCoseValue(int value) throws UnsupportedAlgorithmIdentifierException {
if (value == RSAAlgorithm.LEGACY_RS1.getAlgoValue()) return new COSEAlgorithmIdentifier(RSAAlgorithm.RS1);
for (RSAAlgorithm algorithm : RSAAlgorithm.values()) {
@@ -41,6 +43,7 @@ public class COSEAlgorithmIdentifier implements Parcelable {
}
@Override
+ @NonNull
public String toString() {
return ToStringHelper.name("COSEAlgorithmIdentifier")
.value(algorithm)
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationData.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationData.java
index 23a06cb88e45f7130f089deaef3bff76ec88f303..fc50849731f340d4d9686929c52f5b9530b05c9a 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationData.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationData.java
@@ -5,17 +5,30 @@
package com.google.android.gms.fido.fido2.api.common;
-import org.microg.safeparcel.AutoSafeParcelable;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
-public class CableAuthenticationData extends AutoSafeParcelable {
+@SafeParcelable.Class
+public class CableAuthenticationData extends AbstractSafeParcelable {
@Field(1)
- private long version;
+ long version;
@Field(2)
- private byte[] clientEid;
+ @NonNull
+ byte[] clientEid;
@Field(3)
- private byte[] authenticatorEid;
+ @NonNull
+ byte[] authenticatorEid;
@Field(4)
- private byte[] sessionPreKey;
+ @NonNull
+ byte[] sessionPreKey;
- public static final Creator CREATOR = new AutoCreator<>(CableAuthenticationData.class);
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(CableAuthenticationData.class);
}
diff --git a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationExtension.java b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationExtension.java
index 58d85b6e5727d9366fa764500bd613bfd5ec299b..74b4434ea3b2e87c76f1f74e9df2a099b6321694 100644
--- a/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationExtension.java
+++ b/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/CableAuthenticationExtension.java
@@ -5,13 +5,24 @@
package com.google.android.gms.fido.fido2.api.common;
-import org.microg.safeparcel.AutoSafeParcelable;
+import android.os.Parcel;
+import androidx.annotation.NonNull;
+import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
+import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import java.util.List;
-public class CableAuthenticationExtension extends AutoSafeParcelable {
+@SafeParcelable.Class
+public class CableAuthenticationExtension extends AbstractSafeParcelable {
@Field(1)
- private List cableAuthentication;
+ @NonNull
+ List cableAuthentication;
- public static final Creator CREATOR = new AutoCreator<>(CableAuthenticationExtension.class);
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ CREATOR.writeToParcel(this, dest, flags);
+ }
+
+ public static final SafeParcelableCreatorAndWriter