@@ -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,9 @@ object Generators {
412415
413416 object Extensions {
414417 private val RegistrationExtensionIds : Set [String ] =
415- Set (" appidExclude" , " credProps" , " credProtect" , " largeBlob" , " prf" , " uvm" )
418+ Set (" appidExclude" , " credProps" , " credProtect" , " largeBlob" , " prf" , " spc " , " uvm" )
416419 private val AuthenticationExtensionIds : Set [String ] =
417- Set (" appid" , " largeBlob" , " prf" , " uvm" )
420+ Set (" appid" , " largeBlob" , " prf" , " spc " , " uvm" )
418421
419422 private val ClientRegistrationExtensionOutputIds : Set [String ] =
420423 RegistrationExtensionIds - " uvm"
@@ -425,6 +428,7 @@ object Generators {
425428 " credProtect" ,
426429 " largeBlob" ,
427430 " prf" ,
431+ " spc" ,
428432 )
429433
430434 private val ClientAuthenticationExtensionOutputIds : Set [String ] =
@@ -435,6 +439,7 @@ object Generators {
435439 " credProps" ,
436440 " largeBlob" ,
437441 " prf" ,
442+ " spc" ,
438443 )
439444
440445 def registrationExtensionInputs (
@@ -634,6 +639,8 @@ object Generators {
634639 resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
635640 case " prf" =>
636641 resultBuilder.prf(inputs.getPrf orElse null )
642+ case " spc" =>
643+ resultBuilder.spc(inputs.getSpc orElse null )
637644 case " uvm" =>
638645 if (inputs.getUvm) {
639646 resultBuilder.uvm()
@@ -655,6 +662,8 @@ object Generators {
655662 resultBuilder.largeBlob(inputs.getLargeBlob orElse null )
656663 case " prf" =>
657664 resultBuilder.prf(inputs.getPrf orElse null )
665+ case " spc" =>
666+ resultBuilder.spc(inputs.getSpc orElse null )
658667 case " uvm" =>
659668 if (inputs.getUvm) {
660669 resultBuilder.uvm()
@@ -680,6 +689,8 @@ object Generators {
680689 resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
681690 case " prf" =>
682691 resultBuilder.prf(clientOutputs.getPrf orElse null )
692+ case " spc" =>
693+ resultBuilder.spc(clientOutputs.getSpc orElse null )
683694 case " uvm" => // Skip
684695 }
685696 }
@@ -698,6 +709,8 @@ object Generators {
698709 resultBuilder.largeBlob(clientOutputs.getLargeBlob orElse null )
699710 case " prf" =>
700711 resultBuilder.prf(clientOutputs.getPrf orElse null )
712+ case " spc" =>
713+ resultBuilder.spc(clientOutputs.getSpc orElse null )
701714 case " uvm" => // Skip
702715 }
703716 }
@@ -1051,6 +1064,38 @@ object Generators {
10511064 : Arbitrary [PrfAuthenticationOutput ] = Arbitrary (authenticationOutput)
10521065 }
10531066
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+
10541099 object Uvm {
10551100 def uvmEntry : Gen [UvmEntry ] =
10561101 for {
0 commit comments