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 699539a commit cb77696
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 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
5 changes: 4 additions & 1 deletion 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 Down Expand Up @@ -42,3 +42,6 @@ log-info = []
log-debug = []
log-warn = []
log-error = []

[patch.crates-io]
iso7816 = { git = "https://github.com/trussed-dev/iso7816.git", rev = "348238e381108d287204cf2451640882469c9932" }
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 cb77696

Please sign in to comment.