Skip to content

Commit

Permalink
Add support for iso7816::command::CommandView
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Oct 18, 2024
1 parent 4b3953a commit 5dc6a32
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ctap-types"
version = "0.3.0"
version = "0.3.1"
authors = ["Nicolas Stalder <[email protected]>", "The Trussed developers"]
edition = "2021"
license = "Apache-2.0 OR MIT"
Expand All @@ -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 }
Expand Down
9 changes: 8 additions & 1 deletion src/ctap1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5dc6a32

Please sign in to comment.