Skip to content

Commit

Permalink
Update ctap-types
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Jun 18, 2024
1 parent bdccb89 commit c319239
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ serde-indexed = { git = "https://github.com/sosthene-nitrokey/serde-indexed.git"

# unreleased upstream changes
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" }
ctap-types = { git = "https://github.com/trussed-dev/ctap-types.git", rev = "3e42568a39d54f1fe905dbd26b6c0559ba5abf31" }
ctap-types = { git = "https://github.com/trussed-dev/ctap-types.git", rev = "e188ab2552524d705941d9bf904c95c949bda44e" }
iso7816 = { git = "https://github.com/Nitrokey/iso7816.git", tag = "v0.1.1-nitrokey.1" }
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "ebd27e49ca321089d01d8c9b169c4aeb58ceeeca" }
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "cff2e663841b6a68d3a8ce12647d57b2b6fbc36c" }
Expand Down
27 changes: 12 additions & 15 deletions src/lib/ctap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ where
C: WebcryptTrussedClient,
{
let ctap_response = {
let ctap_request = {
let command = apdu_dispatch::Command::try_from(data)
.map_err(|_| Status::IncorrectDataParameter)?;
ctap1::Request::try_from(&command)?
};
let command =
apdu_dispatch::Command::try_from(data).map_err(|_| Status::IncorrectDataParameter)?;
let ctap_request = ctap1::Request::try_from(&command)?;

match ctap_request {
// Request1::Register(reg) => {
Expand All @@ -52,7 +50,8 @@ where
output,
&data,

Check warning on line 51 in src/lib/ctap_app.rs

View workflow job for this annotation

GitHub Actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lib/ctap_app.rs:51:21 | 51 | &data, | ^^^^^ help: change this to: `data` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
RequestDetails {
rpid: auth.app_id,
rpid: Bytes::from_slice(auth.app_id)
.map_err(|_| Status::IncorrectDataParameter)?,
source: RequestSource::RS_U2F,
pin_auth: None,
},
Expand Down Expand Up @@ -159,7 +158,7 @@ where

use ctap2::AuthenticatorDataFlags as Flags;
let authenticator_data = ctap2::make_credential::AuthenticatorData {
rp_id_hash: rpid_hash,
rp_id_hash: &rpid_hash,

flags: {
let mut flags = Flags::USER_PRESENCE;
Expand All @@ -175,29 +174,27 @@ where
attested_credential_data: {
let _attested_credential_data =
ctap2::make_credential::AttestedCredentialData {
aaguid: Bytes::from_slice(&[1u8; 16]).unwrap(),
aaguid: &[1u8; 16],
// credential_id: Bytes::from_slice(&[2u8; 255]).unwrap(),
credential_id: Bytes::from_slice(&data[..]).unwrap(),
credential_public_key: {
credential_id: &data,

Check warning on line 179 in src/lib/ctap_app.rs

View workflow job for this annotation

GitHub Actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lib/ctap_app.rs:179:44 | 179 | ... credential_id: &data, | ^^^^^ help: change this to: `data` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
credential_public_key:
// FIXME replace with a properly serialized empty cose public key
let a = [
&[
165, 1, 2, 3, 38, 32, 1, 33, 88, 32, 101, 237, 165, 161, 37,
119, 194, 186, 232, 41, 67, 127, 227, 56, 112, 26, 16, 170,
163, 117, 225, 187, 91, 93, 225, 8, 222, 67, 156, 8, 85, 29,
34, 88, 32, 30, 82, 237, 117, 112, 17, 99, 247, 249, 228, 13,
223, 159, 52, 27, 61, 201, 186, 134, 10, 247, 224, 202, 124,
167, 233, 238, 205, 0, 132, 209, 156,
];
Bytes::from_slice(&a).unwrap()
},
],
};
// Some(attested_credential_data)
None
},

extensions: { None },
};
let serialized_auth_data = authenticator_data.serialize();
let serialized_auth_data = authenticator_data.serialize().map_err(|err| err as u8)?;

let credential = PublicKeyCredentialDescriptor {
id: Bytes::from_slice(data).unwrap(),
Expand Down

0 comments on commit c319239

Please sign in to comment.