@@ -10,11 +10,11 @@ pub type AuthenticatorInfo = Response;
1010#[ serde_indexed( offset = 1 ) ]
1111pub struct Response {
1212 // 0x01
13- pub versions : Vec < Version , 5 > ,
13+ pub versions : Vec < Version , VERSION_COUNT > ,
1414
1515 // 0x02
1616 #[ serde( skip_serializing_if = "Option::is_none" ) ]
17- pub extensions : Option < Vec < Extension , 7 > > ,
17+ pub extensions : Option < Vec < Extension , EXTENSION_COUNT > > ,
1818
1919 // 0x03
2020 pub aaguid : Bytes < 16 > ,
@@ -44,7 +44,7 @@ pub struct Response {
4444 // 0x09
4545 // FIDO_2_1
4646 #[ serde( skip_serializing_if = "Option::is_none" ) ]
47- pub transports : Option < Vec < Transport , 3 > > ,
47+ pub transports : Option < Vec < Transport , TRANSPORT_COUNT > > ,
4848
4949 // 0x0A
5050 // FIDO_2_1
@@ -154,7 +154,7 @@ impl Default for Response {
154154
155155#[ derive( Debug ) ]
156156pub struct ResponseBuilder {
157- pub versions : Vec < Version , 5 > ,
157+ pub versions : Vec < Version , VERSION_COUNT > ,
158158 pub aaguid : Bytes < 16 > ,
159159}
160160
@@ -214,6 +214,8 @@ pub enum Version {
214214 U2fV2 ,
215215}
216216
217+ pub const VERSION_COUNT : usize = 5 ;
218+
217219impl Version {
218220 const FIDO_2_0 : & ' static str = "FIDO_2_0" ;
219221 const FIDO_2_1 : & ' static str = "FIDO_2_1" ;
@@ -249,6 +251,8 @@ impl TryFrom<&str> for Version {
249251 }
250252}
251253
254+ pub const EXTENSION_COUNT : usize = 7 ;
255+
252256#[ derive( Copy , Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
253257#[ non_exhaustive]
254258#[ serde( into = "&str" , try_from = "&str" ) ]
@@ -303,6 +307,8 @@ impl TryFrom<&str> for Extension {
303307 }
304308}
305309
310+ pub const TRANSPORT_COUNT : usize = 3 ;
311+
306312#[ derive( Copy , Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
307313#[ non_exhaustive]
308314#[ serde( into = "&str" , try_from = "&str" ) ]
@@ -470,7 +476,7 @@ mod tests {
470476
471477 #[ test]
472478 fn test_serde_version ( ) {
473- let versions = [
479+ let versions: [ _ ; VERSION_COUNT ] = [
474480 ( Version :: Fido2_0 , "FIDO_2_0" ) ,
475481 ( Version :: Fido2_1 , "FIDO_2_1" ) ,
476482 ( Version :: Fido2_1Pre , "FIDO_2_1_PRE" ) ,
@@ -484,7 +490,7 @@ mod tests {
484490
485491 #[ test]
486492 fn test_serde_extension ( ) {
487- let extensions = [
493+ let extensions: [ _ ; EXTENSION_COUNT ] = [
488494 ( Extension :: CredProtect , "credProtect" ) ,
489495 ( Extension :: CredBlob , "credBlob" ) ,
490496 ( Extension :: HmacSecret , "hmac-secret" ) ,
@@ -500,7 +506,7 @@ mod tests {
500506
501507 #[ test]
502508 fn test_serde_transport ( ) {
503- let transports = [
509+ let transports: [ _ ; TRANSPORT_COUNT ] = [
504510 ( Transport :: Nfc , "nfc" ) ,
505511 ( Transport :: SmartCard , "smart-card" ) ,
506512 ( Transport :: Usb , "usb" ) ,
0 commit comments