@@ -774,7 +774,7 @@ public static class PrfValues {
774
774
@ JsonProperty public final ByteArray second ;
775
775
776
776
@ JsonCreator
777
- public PrfValues (
777
+ private PrfValues (
778
778
@ JsonProperty ("first" ) @ NonNull final ByteArray first ,
779
779
@ JsonProperty ("second" ) final ByteArray second ) {
780
780
this .first = first ;
@@ -784,6 +784,19 @@ public PrfValues(
784
784
public Optional <ByteArray > getSecond () {
785
785
return Optional .ofNullable (second );
786
786
}
787
+
788
+ public static PrfValues one (@ NonNull ByteArray first ) {
789
+ return new PrfValues (first , null );
790
+ }
791
+
792
+ public static PrfValues two (@ NonNull ByteArray first , @ NonNull ByteArray second ) {
793
+ return new PrfValues (first , second );
794
+ }
795
+
796
+ public static PrfValues oneOrTwo (
797
+ @ NonNull ByteArray first , @ NonNull Optional <ByteArray > second ) {
798
+ return new PrfValues (first , second .orElse (null ));
799
+ }
787
800
}
788
801
789
802
/**
@@ -801,7 +814,7 @@ public static class PrfAuthenticationInput {
801
814
@ JsonProperty private final Map <ByteArray , PrfValues > evalByCredential ;
802
815
803
816
@ JsonCreator
804
- public PrfAuthenticationInput (
817
+ private PrfAuthenticationInput (
805
818
@ JsonProperty ("eval" ) PrfValues eval ,
806
819
@ JsonProperty ("evalByCredential" ) Map <ByteArray , PrfValues > evalByCredential ) {
807
820
this .eval = eval ;
@@ -817,7 +830,7 @@ public Optional<Map<ByteArray, PrfValues>> getEvalByCredential() {
817
830
return Optional .ofNullable (evalByCredential );
818
831
}
819
832
820
- static HashMap <ByteArray , PrfValues > descriptorsToIds (
833
+ private static HashMap <ByteArray , PrfValues > descriptorsToIds (
821
834
Map <PublicKeyCredentialDescriptor , PrfValues > evalByCredential ) {
822
835
return evalByCredential .entrySet ().stream ()
823
836
.reduce (
@@ -831,6 +844,21 @@ static HashMap<ByteArray, PrfValues> descriptorsToIds(
831
844
return a ;
832
845
});
833
846
}
847
+
848
+ public static PrfAuthenticationInput eval (@ NonNull PrfValues eval ) {
849
+ return new PrfAuthenticationInput (eval , null );
850
+ }
851
+
852
+ public static PrfAuthenticationInput evalByCredential (
853
+ @ NonNull Map <PublicKeyCredentialDescriptor , PrfValues > evalByCredential ) {
854
+ return new PrfAuthenticationInput (null , descriptorsToIds (evalByCredential ));
855
+ }
856
+
857
+ public static PrfAuthenticationInput evalByCredentialWithFallback (
858
+ @ NonNull Map <PublicKeyCredentialDescriptor , PrfValues > evalByCredential ,
859
+ @ NonNull PrfValues eval ) {
860
+ return new PrfAuthenticationInput (eval , descriptorsToIds (evalByCredential ));
861
+ }
834
862
}
835
863
836
864
/**
@@ -846,13 +874,21 @@ public static class PrfRegistrationInput {
846
874
@ JsonProperty private final PrfValues eval ;
847
875
848
876
@ JsonCreator
849
- public PrfRegistrationInput (@ JsonProperty ("eval" ) PrfValues eval ) {
877
+ private PrfRegistrationInput (@ JsonProperty ("eval" ) PrfValues eval ) {
850
878
this .eval = eval ;
851
879
}
852
880
853
881
public Optional <PrfValues > getEval () {
854
882
return Optional .ofNullable (eval );
855
883
}
884
+
885
+ public static PrfRegistrationInput enable () {
886
+ return new PrfRegistrationInput (null );
887
+ }
888
+
889
+ public static PrfRegistrationInput eval (@ NonNull PrfValues eval ) {
890
+ return new PrfRegistrationInput (eval );
891
+ }
856
892
}
857
893
858
894
/**
0 commit comments