@@ -50,6 +50,9 @@ import com.yubico.webauthn.data.Extensions.Prf.PrfAuthenticationOutput
5050import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationInput
5151import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationOutput
5252import 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
5356import com .yubico .webauthn .data .Extensions .Uvm .UvmEntry
5457import com .yubico .webauthn .extension .appid .AppId
5558import com .yubico .webauthn .extension .appid .Generators ._
@@ -412,9 +415,17 @@ object Generators {
412415
413416 object Extensions {
414417 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+ )
416427 private val AuthenticationExtensionIds : Set [String ] =
417- Set (" appid" , " largeBlob" , " prf" , " uvm" )
428+ Set (" appid" , " largeBlob" , " prf" , " spc " , " uvm" )
418429
419430 private val ClientRegistrationExtensionOutputIds : Set [String ] =
420431 RegistrationExtensionIds - " uvm"
@@ -425,6 +436,7 @@ object Generators {
425436 " credProtect" ,
426437 " largeBlob" ,
427438 " prf" ,
439+ " spc" ,
428440 )
429441
430442 private val ClientAuthenticationExtensionOutputIds : Set [String ] =
@@ -435,6 +447,7 @@ object Generators {
435447 " credProps" ,
436448 " largeBlob" ,
437449 " prf" ,
450+ " spc" ,
438451 )
439452
440453 def registrationExtensionInputs (
@@ -634,6 +647,8 @@ object Generators {
634647 resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
635648 case " prf" =>
636649 resultBuilder.prf(inputs.getPrf orElse null )
650+ case " spc" =>
651+ resultBuilder.spc(inputs.getSpc orElse null )
637652 case " uvm" =>
638653 if (inputs.getUvm) {
639654 resultBuilder.uvm()
@@ -655,6 +670,8 @@ object Generators {
655670 resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
656671 case " prf" =>
657672 resultBuilder.prf(inputs.getPrf orElse null )
673+ case " spc" =>
674+ resultBuilder.spc(inputs.getSpc orElse null )
658675 case " uvm" =>
659676 if (inputs.getUvm) {
660677 resultBuilder.uvm()
@@ -680,6 +697,8 @@ object Generators {
680697 resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
681698 case " prf" =>
682699 resultBuilder.prf(clientOutputs.getPrf orElse null )
700+ case " spc" =>
701+ resultBuilder.spc(clientOutputs.getSpc orElse null )
683702 case " uvm" => // Skip
684703 }
685704 }
@@ -698,6 +717,8 @@ object Generators {
698717 resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
699718 case " prf" =>
700719 resultBuilder.prf(clientOutputs.getPrf orElse null )
720+ case " spc" =>
721+ resultBuilder.spc(clientOutputs.getSpc orElse null )
701722 case " uvm" => // Skip
702723 }
703724 }
@@ -1051,6 +1072,39 @@ object Generators {
10511072 : Arbitrary [PrfAuthenticationOutput ] = Arbitrary (authenticationOutput)
10521073 }
10531074
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+
10541108 object Uvm {
10551109 def uvmEntry : Gen [UvmEntry ] =
10561110 for {
0 commit comments