@@ -9,29 +9,35 @@ use std::time::Duration;
99pub struct Ctap2BioEnrollmentRequest {
1010 // modality (0x01) Unsigned Integer Optional The user verification modality being requested
1111 #[ serde( skip_serializing_if = "Option::is_none" ) ]
12+ #[ serde( index = 0x01 ) ]
1213 pub modality : Option < Ctap2BioEnrollmentModality > ,
1314
1415 // subCommand (0x02) Unsigned Integer Optional The authenticator user verification sub command currently being requested
1516 #[ serde( skip_serializing_if = "Option::is_none" ) ]
17+ #[ serde( index = 0x02 ) ]
1618 pub subcommand : Option < Ctap2BioEnrollmentSubcommand > ,
1719
1820 // subCommandParams (0x03) CBOR Map Optional Map of subCommands parameters. This parameter MAY be omitted when the subCommand does not take any arguments.
1921 #[ serde( skip_serializing_if = "Option::is_none" ) ]
22+ #[ serde( index = 0x03 ) ]
2023 pub subcommand_params : Option < Ctap2BioEnrollmentParams > ,
2124
2225 // pinUvAuthProtocol (0x04) Unsigned Integer Optional PIN/UV protocol version chosen by the platform.
2326 #[ serde( skip_serializing_if = "Option::is_none" ) ]
27+ #[ serde( index = 0x04 ) ]
2428 pub protocol : Option < Ctap2PinUvAuthProtocol > ,
2529
2630 // pinUvAuthParam (0x05) Byte String Optional First 16 bytes of HMAC-SHA-256 of contents using pinUvAuthToken.
2731 #[ serde( skip_serializing_if = "Option::is_none" ) ]
32+ #[ serde( index = 0x05 ) ]
2833 pub uv_auth_param : Option < ByteBuf > ,
2934
3035 // getModality (0x06) Boolean Optional Get the user verification type modality. This MUST be set to true.
3136 #[ serde( skip_serializing_if = "Option::is_none" ) ]
37+ #[ serde( index = 0x06 ) ]
3238 pub get_modality : Option < bool > ,
3339
34- #[ serde( skip_serializing_if = "always_skip_bool" ) ]
40+ #[ serde( skip ) ]
3541 pub use_legacy_preview : bool ,
3642}
3743
@@ -48,63 +54,73 @@ pub enum Ctap2BioEnrollmentSubcommand {
4854}
4955
5056#[ derive( Debug , Clone , SerializeIndexed ) ]
51- #[ serde_indexed( offset = 1 ) ]
5257pub struct Ctap2BioEnrollmentParams {
5358 #[ serde( skip_serializing_if = "Option::is_none" ) ]
59+ #[ serde( index = 0x01 ) ]
5460 template_id : Option < ByteBuf > ,
5561
5662 #[ serde( skip_serializing_if = "Option::is_none" ) ]
63+ #[ serde( index = 0x02 ) ]
5764 template_friendly_name : Option < String > ,
5865
5966 #[ serde( skip_serializing_if = "Option::is_none" ) ]
67+ #[ serde( index = 0x03 ) ]
6068 timeout_milliseconds : Option < u64 > ,
6169}
6270
6371#[ derive( Debug , Default , Clone , DeserializeIndexed ) ]
64- #[ serde_indexed( offset = 1 ) ]
6572pub struct Ctap2BioEnrollmentResponse {
6673 // modality (0x01) Unsigned Integer Optional The user verification modality.
6774 #[ serde( skip_serializing_if = "Option::is_none" ) ]
75+ #[ serde( index = 0x01 ) ]
6876 pub modality : Option < Ctap2BioEnrollmentModality > ,
6977
7078 // fingerprintKind (0x02) Unsigned Integer Optional Indicates the type of fingerprint sensor. For touch type sensor, its value is 1. For swipe type sensor its value is 2.
7179 #[ serde( skip_serializing_if = "Option::is_none" ) ]
80+ #[ serde( index = 0x02 ) ]
7281 pub fingerprint_kind : Option < Ctap2BioEnrollmentFingerprintKind > ,
7382
7483 // maxCaptureSamplesRequiredForEnroll (0x03) Unsigned Integer Optional Indicates the maximum good samples required for enrollment.
7584 #[ serde( skip_serializing_if = "Option::is_none" ) ]
85+ #[ serde( index = 0x03 ) ]
7686 pub max_capture_samples_required_for_enroll : Option < u64 > ,
7787
7888 // templateId (0x04) Byte String Optional Template Identifier.
7989 #[ serde( skip_serializing_if = "Option::is_none" ) ]
90+ #[ serde( index = 0x04 ) ]
8091 pub template_id : Option < ByteBuf > ,
8192
8293 // lastEnrollSampleStatus (0x05) Unsigned Integer Optional Last enrollment sample status.
8394 #[ serde( skip_serializing_if = "Option::is_none" ) ]
95+ #[ serde( index = 0x05 ) ]
8496 pub last_enroll_sample_status : Option < Ctap2LastEnrollmentSampleStatus > ,
8597
8698 // remainingSamples (0x06) Unsigned Integer Optional Number of more sample required for enrollment to complete
8799 #[ serde( skip_serializing_if = "Option::is_none" ) ]
100+ #[ serde( index = 0x06 ) ]
88101 pub remaining_samples : Option < u64 > ,
89102
90103 // templateInfos (0x07) CBOR ARRAY Optional Array of templateInfo’s
91104 #[ serde( skip_serializing_if = "Option::is_none" ) ]
105+ #[ serde( index = 0x07 ) ]
92106 pub template_infos : Option < Vec < Ctap2BioEnrollmentTemplateId > > ,
93107
94108 // maxTemplateFriendlyName (0x08) Unsigned Integer Optional Indicates the maximum number of bytes the authenticator will accept as a templateFriendlyName.
95109 #[ serde( skip_serializing_if = "Option::is_none" ) ]
110+ #[ serde( index = 0x08 ) ]
96111 pub max_template_friendly_name : Option < u64 > ,
97112}
98113
99114#[ derive( Debug , Clone , DeserializeIndexed ) ]
100- #[ serde_indexed( offset = 1 ) ]
101115pub struct Ctap2BioEnrollmentTemplateId {
102116 // templateId (0x01) Byte String Required Template Identifier.
103117 #[ serde( skip_serializing_if = "Option::is_none" ) ]
118+ #[ serde( index = 0x01 ) ]
104119 pub template_id : Option < ByteBuf > ,
105120
106121 // templateFriendlyName (0x02) String Optional Template Friendly Name.
107122 #[ serde( skip_serializing_if = "Option::is_none" ) ]
123+ #[ serde( index = 0x02 ) ]
108124 pub template_friendly_name : Option < String > ,
109125}
110126
@@ -262,9 +278,3 @@ impl Ctap2BioEnrollmentRequest {
262278 }
263279 }
264280}
265-
266- // Required by serde_indexed, as serde(skip) isn't supported yet:
267- // https://github.com/trussed-dev/serde-indexed/pull/14
268- fn always_skip_bool ( _v : & bool ) -> bool {
269- true
270- }
0 commit comments