Add support for iso7816::command::CommandView

This commit is contained in:
Robin Krahl
2024-10-18 11:04:21 +02:00
parent 4b3953aa4a
commit 5dc6a32ebd
3 changed files with 19 additions and 4 deletions
+9 -1
View File
@@ -6,7 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
[Unreleased]: https://github.com/trussed-dev/ctap-types/compare/0.3.0...HEAD
[Unreleased]: https://github.com/trussed-dev/ctap-types/compare/0.3.1...HEAD
## [0.3.1] 2024-10-18
[0.3.1]: https://github.com/trussed-dev/ctap-types/compare/0.3.0...0.3.1
### Added
- Implement `TryFrom<iso7816::command::CommandView<'a>>` for `Request<'a>`
## [0.3.0] 2024-08-01
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "ctap-types"
version = "0.3.0"
version = "0.3.1"
authors = ["Nicolas Stalder <n@stalder.io>", "The Trussed developers"]
edition = "2021"
license = "Apache-2.0 OR MIT"
@@ -15,7 +15,7 @@ cosey = "0.3.1"
delog = "0.1"
heapless = { version = "0.7", default-features = false, features = ["serde"] }
heapless-bytes = "0.3"
iso7816 = "0.1.2"
iso7816 = "0.1.3"
serde = { version = "1", default-features = false, features = ["derive"] }
serde-indexed = "0.1.1"
serde_bytes = { version = "0.11.14", default-features = false }
+8 -1
View File
@@ -156,8 +156,15 @@ impl Response {
impl<'a, const S: usize> TryFrom<&'a iso7816::Command<S>> for Request<'a> {
type Error = Error;
#[inline(never)]
fn try_from(apdu: &'a iso7816::Command<S>) -> Result<Request> {
apdu.as_view().try_into()
}
}
impl<'a> TryFrom<iso7816::command::CommandView<'a>> for Request<'a> {
type Error = Error;
#[inline(never)]
fn try_from(apdu: iso7816::command::CommandView<'a>) -> Result<Request> {
let cla = apdu.class().into_inner();
let ins = match apdu.instruction() {
iso7816::Instruction::Unknown(ins) => ins,