Skip to content

Commit cb77696

Browse files
Add support for iso7816::command::CommandView
1 parent 699539a commit cb77696

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9-
[Unreleased]: https://github.com/trussed-dev/ctap-types/compare/0.3.0...HEAD
9+
[Unreleased]: https://github.com/trussed-dev/ctap-types/compare/0.3.1...HEAD
10+
11+
## [0.3.1] 2024-10-18
12+
13+
[0.3.1]: https://github.com/trussed-dev/ctap-types/compare/0.3.0...0.3.1
14+
15+
### Added
16+
17+
- Implement `TryFrom<iso7816::command::CommandView<'a>>` for `Request<'a>`
1018

1119
## [0.3.0] 2024-08-01
1220

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ctap-types"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
authors = ["Nicolas Stalder <n@stalder.io>", "The Trussed developers"]
55
edition = "2021"
66
license = "Apache-2.0 OR MIT"
@@ -42,3 +42,6 @@ log-info = []
4242
log-debug = []
4343
log-warn = []
4444
log-error = []
45+
46+
[patch.crates-io]
47+
iso7816 = { git = "https://github.com/trussed-dev/iso7816.git", rev = "348238e381108d287204cf2451640882469c9932" }

src/ctap1.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ impl Response {
156156

157157
impl<'a, const S: usize> TryFrom<&'a iso7816::Command<S>> for Request<'a> {
158158
type Error = Error;
159-
#[inline(never)]
160159
fn try_from(apdu: &'a iso7816::Command<S>) -> Result<Request> {
160+
apdu.as_view().try_into()
161+
}
162+
}
163+
164+
impl<'a> TryFrom<iso7816::command::CommandView<'a>> for Request<'a> {
165+
type Error = Error;
166+
#[inline(never)]
167+
fn try_from(apdu: iso7816::command::CommandView<'a>) -> Result<Request> {
161168
let cla = apdu.class().into_inner();
162169
let ins = match apdu.instruction() {
163170
iso7816::Instruction::Unknown(ins) => ins,

0 commit comments

Comments
 (0)