mirror of
https://github.com/trussed-dev/ctap-types.git
synced 2026-06-20 04:16:17 -07:00
Send empty response to clientPin instead of empty map
For the SetPin and ChangePin subcommands, the clientPin command does not return any parameters. Previously, we sent an empty map for these cases. With this patch, we sent an empty response instead. Fixes: https://github.com/solokeys/ctap-types/issues/13
This commit is contained in:
committed by
Nicolas Stalder
parent
cda15f89a6
commit
92fef529c0
@@ -8,9 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Rename `url` to `icon` in `PublicKeyCredentialRpEntity` and ignore its
|
||||
content ([#9][])
|
||||
- Truncate overlong `name` and `displayName` values for `PublicKeyCredentialEntity` instances ([#30][])
|
||||
- Send empty response to clientPin instead of empty map ([#13][])
|
||||
|
||||
[#9]: https://github.com/solokeys/ctap-types/issues/9
|
||||
[#30]: https://github.com/solokeys/fido-authenticator/issues/30
|
||||
[#13]: https://github.com/solokeys/ctap-types/issues/13
|
||||
|
||||
## [0.1.2] - 2022-03-07
|
||||
|
||||
|
||||
+7
-1
@@ -148,7 +148,13 @@ impl Response {
|
||||
let outcome = match self {
|
||||
GetInfo(response) => cbor_serialize(response, data),
|
||||
MakeCredential(response) => cbor_serialize(response, data),
|
||||
ClientPin(response) => cbor_serialize(response, data),
|
||||
ClientPin(response) => {
|
||||
if response.is_empty() {
|
||||
Ok([].as_slice())
|
||||
} else {
|
||||
cbor_serialize(response, data)
|
||||
}
|
||||
},
|
||||
GetAssertion(response) | GetNextAssertion(response) => cbor_serialize(response, data),
|
||||
CredentialManagement(response) => cbor_serialize(response, data),
|
||||
Reset | Selection | Vendor => Ok([].as_slice()),
|
||||
|
||||
@@ -73,6 +73,12 @@ pub struct Response {
|
||||
pub retries: Option<u8>,
|
||||
}
|
||||
|
||||
impl Response {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.key_agreement.is_none() && self.pin_token.is_none() && self.retries.is_none()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user