@@ -8,6 +8,9 @@ import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobAuthenticationOutp
88import com .yubico .webauthn .data .Extensions .LargeBlob .LargeBlobRegistrationInput
99import com .yubico .webauthn .data .Extensions .LargeBlob .LargeBlobRegistrationInput .LargeBlobSupport
1010import com .yubico .webauthn .data .Extensions .LargeBlob .LargeBlobRegistrationOutput
11+ import com .yubico .webauthn .data .Extensions .Prf .PrfAuthenticationInput
12+ import com .yubico .webauthn .data .Extensions .Prf .PrfRegistrationInput
13+ import com .yubico .webauthn .data .Extensions .Prf .PrfValues
1114import com .yubico .webauthn .data .Generators .arbitraryAssertionExtensionInputs
1215import com .yubico .webauthn .data .Generators .arbitraryClientRegistrationExtensionOutputs
1316import com .yubico .webauthn .data .Generators .arbitraryRegistrationExtensionInputs
@@ -23,6 +26,7 @@ import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
2326
2427import java .nio .charset .StandardCharsets
2528import scala .jdk .CollectionConverters .IteratorHasAsScala
29+ import scala .jdk .CollectionConverters .MapHasAsJava
2630import scala .jdk .CollectionConverters .SetHasAsScala
2731import scala .jdk .OptionConverters .RichOptional
2832
@@ -73,6 +77,12 @@ class ExtensionsSpec
7377 |"largeBlob": {
7478 | "support": "required"
7579 |},
80+ |"prf": {
81+ | "eval": {
82+ | "first": "AAAA",
83+ | "second": "BBBB"
84+ | }
85+ |},
7686 |"uvm": true
7787 |}""" .stripMargin
7888
@@ -85,7 +95,13 @@ class ExtensionsSpec
8595
8696 decoded should not be null
8797 decoded.getExtensionIds.asScala should equal(
88- Set (" appidExclude" , " credProps" , " largeBlob" , " uvm" )
98+ Set (
99+ " appidExclude" ,
100+ " credProps" ,
101+ " largeBlob" ,
102+ " prf" ,
103+ " uvm" ,
104+ )
89105 )
90106 decoded.getAppidExclude.toScala should equal(
91107 Some (new AppId (" https://example.org" ))
@@ -94,6 +110,16 @@ class ExtensionsSpec
94110 decoded.getLargeBlob.toScala should equal(
95111 Some (new LargeBlobRegistrationInput (LargeBlobSupport .REQUIRED ))
96112 )
113+ decoded.getPrf.toScala should equal(
114+ Some (
115+ PrfRegistrationInput .eval(
116+ PrfValues .two(
117+ ByteArray .fromBase64Url(" AAAA" ),
118+ ByteArray .fromBase64Url(" BBBB" ),
119+ )
120+ )
121+ )
122+ )
97123 decoded.getUvm should be(true )
98124
99125 redecoded should equal(decoded)
@@ -161,6 +187,21 @@ class ExtensionsSpec
161187 |"largeBlob": {
162188 | "read": true
163189 |},
190+ |"prf": {
191+ | "eval": {
192+ | "first": "AAAA",
193+ | "second": "BBBB"
194+ | },
195+ | "evalByCredential": {
196+ | "CCCC": {
197+ | "first": "DDDD"
198+ | },
199+ | "EEEE": {
200+ | "first": "FFFF",
201+ | "second": "GGGG"
202+ | }
203+ | }
204+ |},
164205 |"uvm": true
165206 |}""" .stripMargin
166207
@@ -173,14 +214,37 @@ class ExtensionsSpec
173214
174215 decoded should not be null
175216 decoded.getExtensionIds.asScala should equal(
176- Set (" appid" , " largeBlob" , " uvm" )
217+ Set (" appid" , " largeBlob" , " prf " , " uvm" )
177218 )
178219 decoded.getAppid.toScala should equal(
179220 Some (new AppId (" https://example.org" ))
180221 )
181222 decoded.getLargeBlob.toScala should equal(
182223 Some (LargeBlobAuthenticationInput .read())
183224 )
225+ decoded.getPrf.toScala should equal(
226+ Some (
227+ PrfAuthenticationInput .evalByCredentialWithFallback(
228+ Map (
229+ PublicKeyCredentialDescriptor
230+ .builder()
231+ .id(ByteArray .fromBase64Url(" CCCC" ))
232+ .build() -> PrfValues .one(ByteArray .fromBase64Url(" DDDD" )),
233+ PublicKeyCredentialDescriptor
234+ .builder()
235+ .id(ByteArray .fromBase64Url(" EEEE" ))
236+ .build() -> PrfValues .two(
237+ ByteArray .fromBase64Url(" FFFF" ),
238+ ByteArray .fromBase64Url(" GGGG" ),
239+ ),
240+ ).asJava,
241+ PrfValues .two(
242+ ByteArray .fromBase64Url(" AAAA" ),
243+ ByteArray .fromBase64Url(" BBBB" ),
244+ ),
245+ )
246+ )
247+ )
184248 decoded.getUvm should be(true )
185249
186250 redecoded should equal(decoded)
0 commit comments