@@ -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,17 @@ 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 (
419
+ " appidExclude" ,
420
+ " credProps" ,
421
+ " credProtect" ,
422
+ " largeBlob" ,
423
+ " prf" ,
424
+ " spc" ,
425
+ " uvm" ,
426
+ )
416
427
private val AuthenticationExtensionIds : Set [String ] =
417
- Set (" appid" , " largeBlob" , " prf" , " uvm" )
428
+ Set (" appid" , " largeBlob" , " prf" , " spc " , " uvm" )
418
429
419
430
private val ClientRegistrationExtensionOutputIds : Set [String ] =
420
431
RegistrationExtensionIds - " uvm"
@@ -425,6 +436,7 @@ object Generators {
425
436
" credProtect" ,
426
437
" largeBlob" ,
427
438
" prf" ,
439
+ " spc" ,
428
440
)
429
441
430
442
private val ClientAuthenticationExtensionOutputIds : Set [String ] =
@@ -435,6 +447,7 @@ object Generators {
435
447
" credProps" ,
436
448
" largeBlob" ,
437
449
" prf" ,
450
+ " spc" ,
438
451
)
439
452
440
453
def registrationExtensionInputs (
@@ -634,6 +647,8 @@ object Generators {
634
647
resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
635
648
case " prf" =>
636
649
resultBuilder.prf(inputs.getPrf orElse null )
650
+ case " spc" =>
651
+ resultBuilder.spc(inputs.getSpc orElse null )
637
652
case " uvm" =>
638
653
if (inputs.getUvm) {
639
654
resultBuilder.uvm()
@@ -655,6 +670,8 @@ object Generators {
655
670
resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
656
671
case " prf" =>
657
672
resultBuilder.prf(inputs.getPrf orElse null )
673
+ case " spc" =>
674
+ resultBuilder.spc(inputs.getSpc orElse null )
658
675
case " uvm" =>
659
676
if (inputs.getUvm) {
660
677
resultBuilder.uvm()
@@ -680,6 +697,8 @@ object Generators {
680
697
resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
681
698
case " prf" =>
682
699
resultBuilder.prf(clientOutputs.getPrf orElse null )
700
+ case " spc" =>
701
+ resultBuilder.spc(clientOutputs.getSpc orElse null )
683
702
case " uvm" => // Skip
684
703
}
685
704
}
@@ -698,6 +717,8 @@ object Generators {
698
717
resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
699
718
case " prf" =>
700
719
resultBuilder.prf(clientOutputs.getPrf orElse null )
720
+ case " spc" =>
721
+ resultBuilder.spc(clientOutputs.getSpc orElse null )
701
722
case " uvm" => // Skip
702
723
}
703
724
}
@@ -1051,6 +1072,39 @@ object Generators {
1051
1072
: Arbitrary [PrfAuthenticationOutput ] = Arbitrary (authenticationOutput)
1052
1073
}
1053
1074
1075
+ object Spc {
1076
+ def browserBoundPubKeyCredParams
1077
+ : Gen [java.util.List [PublicKeyCredentialParameters ]] =
1078
+ Gen .listOf(arbitrary[PublicKeyCredentialParameters ]).map(_.asJava)
1079
+
1080
+ def registrationInput : Gen [SpcRegistrationInput ] =
1081
+ for {
1082
+ isPayment <- arbitrary[Option [java.lang.Boolean ]]
1083
+ browserBoundParams <- browserBoundPubKeyCredParams
1084
+ } yield SpcRegistrationInput
1085
+ .builder()
1086
+ .isPayment(isPayment.orNull)
1087
+ .browserBoundPubKeyCredParams(browserBoundParams)
1088
+ .build()
1089
+
1090
+ implicit val arbitrarySpcRegistrationInput
1091
+ : Arbitrary [SpcRegistrationInput ] = Arbitrary (registrationInput)
1092
+
1093
+ def browserBoundSignature : Gen [BrowserBoundSignature ] =
1094
+ for {
1095
+ signature <- arbitrary[ByteArray ]
1096
+ } yield new BrowserBoundSignature (signature)
1097
+
1098
+ def registrationOutput : Gen [SpcRegistrationOutput ] =
1099
+ for {
1100
+ browserBoundSignature <- browserBoundSignature
1101
+ } yield new SpcRegistrationOutput (browserBoundSignature)
1102
+
1103
+ implicit val arbitrarySpcRegistrationOutput
1104
+ : Arbitrary [SpcRegistrationOutput ] = Arbitrary (registrationOutput)
1105
+
1106
+ }
1107
+
1054
1108
object Uvm {
1055
1109
def uvmEntry : Gen [UvmEntry ] =
1056
1110
for {
0 commit comments