@@ -84,17 +84,34 @@ public class PublicKeyCredential<A extends AuthenticatorResponse, B extends Clie
84
84
85
85
@ JsonCreator
86
86
private PublicKeyCredential (
87
- @ NonNull @ JsonProperty ("id" ) ByteArray id ,
87
+ @ JsonProperty ("id" ) ByteArray id ,
88
+ @ JsonProperty ("rawId" ) ByteArray rawId ,
88
89
@ NonNull @ JsonProperty ("response" ) A response ,
89
90
@ NonNull @ JsonProperty ("clientExtensionResults" ) B clientExtensionResults ,
90
91
@ NonNull @ JsonProperty ("type" ) PublicKeyCredentialType type
91
92
) {
92
- this .id = id ;
93
+ if (id == null && rawId == null ) {
94
+ throw new NullPointerException ("At least one of \" id\" and \" rawId\" must be non-null." );
95
+ }
96
+ if (id != null && rawId != null && !id .equals (rawId )) {
97
+ throw new IllegalArgumentException (String .format ("\" id\" and \" rawId\" are not equal: %s != %s" , id , rawId ));
98
+ }
99
+
100
+ this .id = id == null ? rawId : id ;
93
101
this .response = response ;
94
102
this .clientExtensionResults = clientExtensionResults ;
95
103
this .type = type ;
96
104
}
97
105
106
+ private PublicKeyCredential (
107
+ ByteArray id ,
108
+ @ NonNull A response ,
109
+ @ NonNull B clientExtensionResults ,
110
+ @ NonNull PublicKeyCredentialType type
111
+ ) {
112
+ this (id , null , response , clientExtensionResults , type );
113
+ }
114
+
98
115
public static <A extends AuthenticatorResponse , B extends ClientExtensionOutputs > PublicKeyCredentialBuilder <A , B >.MandatoryStages builder () {
99
116
return new PublicKeyCredentialBuilder <A , B >().start ();
100
117
}
0 commit comments