1
- use crate :: Bytes ;
1
+ use crate :: { Bytes , String } ;
2
+ use bitflags:: bitflags;
2
3
use serde_indexed:: { DeserializeIndexed , SerializeIndexed } ;
3
4
use serde_repr:: { Deserialize_repr , Serialize_repr } ;
4
5
@@ -17,6 +18,18 @@ pub enum PinV1Subcommand {
17
18
GetPinUvAuthTokenUsingPinWithPermissions = 0x09 ,
18
19
}
19
20
21
+ bitflags ! {
22
+ #[ derive( Default ) ]
23
+ pub struct Permissions : u8 {
24
+ const MAKE_CREDENTIAL = 0x01 ;
25
+ const GET_ASSERTION = 0x02 ;
26
+ const CREDENTIAL_MANAGEMENT = 0x04 ;
27
+ const BIO_ENROLLMENT = 0x08 ;
28
+ const LARGE_BLOB_WRITE = 0x10 ;
29
+ const AUTHENTICATOR_CONFIGURATION = 0x20 ;
30
+ }
31
+ }
32
+
20
33
// minimum PIN length: 4 unicode
21
34
// maximum PIN length: UTF-8 represented by <= 63 bytes
22
35
// maximum consecutive incorrect PIN attempts: 8
@@ -55,9 +68,27 @@ pub struct Request {
55
68
// Encrypted first 16 bytes of SHA-256 of PIN using `sharedSecret`.
56
69
#[ serde( skip_serializing_if = "Option::is_none" ) ]
57
70
pub pin_hash_enc : Option < Bytes < 64 > > ,
71
+
72
+ // 0x07
73
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
74
+ _placeholder07 : Option < ( ) > ,
75
+
76
+ // 0x08
77
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
78
+ _placeholder08 : Option < ( ) > ,
79
+
80
+ // 0x09
81
+ // Bitfield of permissions
82
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
83
+ pub permissions : Option < u8 > ,
84
+
85
+ // 0x0A
86
+ // The RP ID to assign as the permissions RP ID
87
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
88
+ pub rp_id : Option < String < 256 > > ,
58
89
}
59
90
60
- #[ derive( Clone , Debug , Eq , PartialEq , SerializeIndexed , DeserializeIndexed ) ]
91
+ #[ derive( Clone , Debug , Default , Eq , PartialEq , SerializeIndexed , DeserializeIndexed ) ]
61
92
#[ serde_indexed( offset = 1 ) ]
62
93
pub struct Response {
63
94
// 0x01, like ClientPinParameters::key_agreement
@@ -71,6 +102,14 @@ pub struct Response {
71
102
// 0x03, number of PIN attempts remaining before lockout
72
103
#[ serde( skip_serializing_if = "Option::is_none" ) ]
73
104
pub retries : Option < u8 > ,
105
+
106
+ // 0x04, whether a power cycle is required before any future PIN operation
107
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
108
+ pub power_cycle_state : Option < bool > ,
109
+
110
+ // 0x05, number of uv attempts remaining before lockout
111
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
112
+ pub uv_retries : Option < u8 > ,
74
113
}
75
114
76
115
#[ cfg( test) ]
0 commit comments