@@ -8,6 +8,9 @@ import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobAuthenticationOutp
8
8
import com .yubico .webauthn .data .Extensions .LargeBlob .LargeBlobRegistrationInput
9
9
import com .yubico .webauthn .data .Extensions .LargeBlob .LargeBlobRegistrationInput .LargeBlobSupport
10
10
import 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
11
14
import com .yubico .webauthn .data .Generators .arbitraryAssertionExtensionInputs
12
15
import com .yubico .webauthn .data .Generators .arbitraryClientRegistrationExtensionOutputs
13
16
import com .yubico .webauthn .data .Generators .arbitraryRegistrationExtensionInputs
@@ -23,6 +26,7 @@ import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
23
26
24
27
import java .nio .charset .StandardCharsets
25
28
import scala .jdk .CollectionConverters .IteratorHasAsScala
29
+ import scala .jdk .CollectionConverters .MapHasAsJava
26
30
import scala .jdk .CollectionConverters .SetHasAsScala
27
31
import scala .jdk .OptionConverters .RichOptional
28
32
@@ -73,6 +77,12 @@ class ExtensionsSpec
73
77
|"largeBlob": {
74
78
| "support": "required"
75
79
|},
80
+ |"prf": {
81
+ | "eval": {
82
+ | "first": "AAAA",
83
+ | "second": "BBBB"
84
+ | }
85
+ |},
76
86
|"uvm": true
77
87
|}""" .stripMargin
78
88
@@ -85,7 +95,13 @@ class ExtensionsSpec
85
95
86
96
decoded should not be null
87
97
decoded.getExtensionIds.asScala should equal(
88
- Set (" appidExclude" , " credProps" , " largeBlob" , " uvm" )
98
+ Set (
99
+ " appidExclude" ,
100
+ " credProps" ,
101
+ " largeBlob" ,
102
+ " prf" ,
103
+ " uvm" ,
104
+ )
89
105
)
90
106
decoded.getAppidExclude.toScala should equal(
91
107
Some (new AppId (" https://example.org" ))
@@ -94,6 +110,16 @@ class ExtensionsSpec
94
110
decoded.getLargeBlob.toScala should equal(
95
111
Some (new LargeBlobRegistrationInput (LargeBlobSupport .REQUIRED ))
96
112
)
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
+ )
97
123
decoded.getUvm should be(true )
98
124
99
125
redecoded should equal(decoded)
@@ -161,6 +187,21 @@ class ExtensionsSpec
161
187
|"largeBlob": {
162
188
| "read": true
163
189
|},
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
+ |},
164
205
|"uvm": true
165
206
|}""" .stripMargin
166
207
@@ -173,14 +214,37 @@ class ExtensionsSpec
173
214
174
215
decoded should not be null
175
216
decoded.getExtensionIds.asScala should equal(
176
- Set (" appid" , " largeBlob" , " uvm" )
217
+ Set (" appid" , " largeBlob" , " prf " , " uvm" )
177
218
)
178
219
decoded.getAppid.toScala should equal(
179
220
Some (new AppId (" https://example.org" ))
180
221
)
181
222
decoded.getLargeBlob.toScala should equal(
182
223
Some (LargeBlobAuthenticationInput .read())
183
224
)
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
+ )
184
248
decoded.getUvm should be(true )
185
249
186
250
redecoded should equal(decoded)
0 commit comments