@@ -50,6 +50,9 @@ import com.yubico.webauthn.data.Extensions.Prf.PrfAuthenticationOutput
50
50
import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationInput
51
51
import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationOutput
52
52
import com .yubico .webauthn .data .Extensions .Prf .PrfValues
53
+ import com .yubico .webauthn .data .Extensions .Spc .BrowserBoundSignature
54
+ import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationInput
55
+ import com .yubico .webauthn .data .Extensions .Spc .SpcRegistrationOutput
53
56
import com .yubico .webauthn .data .Extensions .Uvm .UvmEntry
54
57
import com .yubico .webauthn .extension .appid .AppId
55
58
import com .yubico .webauthn .extension .appid .Generators ._
@@ -412,9 +415,9 @@ object Generators {
412
415
413
416
object Extensions {
414
417
private val RegistrationExtensionIds : Set [String ] =
415
- Set (" appidExclude" , " credProps" , " credProtect" , " largeBlob" , " prf" , " uvm" )
418
+ Set (" appidExclude" , " credProps" , " credProtect" , " largeBlob" , " prf" , " spc " , " uvm" )
416
419
private val AuthenticationExtensionIds : Set [String ] =
417
- Set (" appid" , " largeBlob" , " prf" , " uvm" )
420
+ Set (" appid" , " largeBlob" , " prf" , " spc " , " uvm" )
418
421
419
422
private val ClientRegistrationExtensionOutputIds : Set [String ] =
420
423
RegistrationExtensionIds - " uvm"
@@ -425,6 +428,7 @@ object Generators {
425
428
" credProtect" ,
426
429
" largeBlob" ,
427
430
" prf" ,
431
+ " spc" ,
428
432
)
429
433
430
434
private val ClientAuthenticationExtensionOutputIds : Set [String ] =
@@ -435,6 +439,7 @@ object Generators {
435
439
" credProps" ,
436
440
" largeBlob" ,
437
441
" prf" ,
442
+ " spc" ,
438
443
)
439
444
440
445
def registrationExtensionInputs (
@@ -634,6 +639,8 @@ object Generators {
634
639
resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
635
640
case " prf" =>
636
641
resultBuilder.prf(inputs.getPrf orElse null )
642
+ case " spc" =>
643
+ resultBuilder.spc(inputs.getSpc orElse null )
637
644
case " uvm" =>
638
645
if (inputs.getUvm) {
639
646
resultBuilder.uvm()
@@ -655,6 +662,8 @@ object Generators {
655
662
resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
656
663
case " prf" =>
657
664
resultBuilder.prf(inputs.getPrf orElse null )
665
+ case " spc" =>
666
+ resultBuilder.spc(inputs.getSpc orElse null )
658
667
case " uvm" =>
659
668
if (inputs.getUvm) {
660
669
resultBuilder.uvm()
@@ -680,6 +689,8 @@ object Generators {
680
689
resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
681
690
case " prf" =>
682
691
resultBuilder.prf(clientOutputs.getPrf orElse null )
692
+ case " spc" =>
693
+ resultBuilder.spc(clientOutputs.getSpc orElse null )
683
694
case " uvm" => // Skip
684
695
}
685
696
}
@@ -698,6 +709,8 @@ object Generators {
698
709
resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
699
710
case " prf" =>
700
711
resultBuilder.prf(clientOutputs.getPrf orElse null )
712
+ case " spc" =>
713
+ resultBuilder.spc(clientOutputs.getSpc orElse null )
701
714
case " uvm" => // Skip
702
715
}
703
716
}
@@ -1051,6 +1064,38 @@ object Generators {
1051
1064
: Arbitrary [PrfAuthenticationOutput ] = Arbitrary (authenticationOutput)
1052
1065
}
1053
1066
1067
+ object Spc {
1068
+ def browserBoundPubKeyCredParams : Gen [java.util.List [PublicKeyCredentialParameters ]] =
1069
+ Gen .listOf(arbitrary[PublicKeyCredentialParameters ]).map(_.asJava)
1070
+
1071
+ def registrationInput : Gen [SpcRegistrationInput ] =
1072
+ for {
1073
+ isPayment <- arbitrary[Option [java.lang.Boolean ]]
1074
+ browserBoundParams <- browserBoundPubKeyCredParams
1075
+ } yield SpcRegistrationInput .builder()
1076
+ .isPayment(isPayment.orNull)
1077
+ .browserBoundPubKeyCredParams(browserBoundParams)
1078
+ .build()
1079
+
1080
+ implicit val arbitrarySpcRegistrationInput
1081
+ : Arbitrary [SpcRegistrationInput ] = Arbitrary (registrationInput)
1082
+
1083
+ def browserBoundSignature : Gen [BrowserBoundSignature ] =
1084
+ for {
1085
+ signature <- arbitrary[ByteArray ]
1086
+ } yield new BrowserBoundSignature (signature)
1087
+
1088
+ def registrationOutput : Gen [SpcRegistrationOutput ] =
1089
+ for {
1090
+ browserBoundSignature <- browserBoundSignature
1091
+ } yield new SpcRegistrationOutput (browserBoundSignature)
1092
+
1093
+ implicit val arbitrarySpcRegistrationOutput
1094
+ : Arbitrary [SpcRegistrationOutput ] = Arbitrary (registrationOutput)
1095
+
1096
+
1097
+ }
1098
+
1054
1099
object Uvm {
1055
1100
def uvmEntry : Gen [UvmEntry ] =
1056
1101
for {
0 commit comments