Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for iso7816::command::CommandView #66

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading