From cb30a2cc6499464058ce5a9092d8346b7dc4ea62 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 15 May 2025 09:33:09 +0200 Subject: [PATCH] Remove usbip example Instead, the nitrokey-3-firmware usbip runner should be used. --- Cargo.toml | 6 ---- examples/usbip.rs | 88 ----------------------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 examples/usbip.rs diff --git a/Cargo.toml b/Cargo.toml index 98177ed..73c9e8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,12 +8,6 @@ repository = "https://github.com/solokeys/fido-authenticator" documentation = "https://docs.rs/fido-authenticator" description = "FIDO authenticator Trussed app" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[[example]] -name = "usbip" -required-features = ["dispatch"] - [dependencies] cbor-smol = { version = "0.5" } ctap-types = { version = "0.4", features = ["get-info-full", "large-blobs", "third-party-payment"] } diff --git a/examples/usbip.rs b/examples/usbip.rs deleted file mode 100644 index 2379a0c..0000000 --- a/examples/usbip.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2022 Nitrokey GmbH -// SPDX-License-Identifier: CC0-1.0 - -//! USB/IP runner for opcard. -//! Run with cargo run --example usbip --features dispatch - -use littlefs2_core::path; -use trussed::{ - backend::BackendId, - client::ClientBuilder, - service::Service, - types::Location, - virt::{Platform, Ram, StoreProvider}, -}; -use trussed_staging::virt::{BackendIds, Dispatcher}; -use trussed_usbip::{Client, Syscall}; - -const MANUFACTURER: &str = "Nitrokey"; -const PRODUCT: &str = "Nitrokey 3"; -const VID: u16 = 0x20a0; -const PID: u16 = 0x42b2; - -type VirtClient = Client; - -struct FidoApp { - fido: fido_authenticator::Authenticator, -} - -impl trussed_usbip::Apps<'static, S, Dispatcher> for FidoApp { - type Data = (); - fn new(service: &mut Service, Dispatcher>, syscall: Syscall, _data: ()) -> Self { - let large_blogs = Some(fido_authenticator::LargeBlobsConfig { - location: Location::External, - #[cfg(feature = "chunked")] - max_size: 4096, - }); - - let client = ClientBuilder::new(path!("fido")) - .backends(&[ - BackendId::Core, - BackendId::Custom(BackendIds::StagingBackend), - ]) - .prepare(service) - .expect("failed to create client") - .build(syscall); - FidoApp { - fido: fido_authenticator::Authenticator::new( - client, - fido_authenticator::Conforming {}, - fido_authenticator::Config { - max_msg_size: usbd_ctaphid::constants::MESSAGE_SIZE, - skip_up_timeout: None, - max_resident_credential_count: Some(10), - large_blobs: large_blogs, - nfc_transport: false, - }, - ), - } - } - - fn with_ctaphid_apps( - &mut self, - f: impl FnOnce( - &mut [&mut dyn ctaphid_dispatch::app::App< - 'static, - { ctaphid_dispatch::MESSAGE_SIZE }, - >], - ) -> T, - ) -> T { - f(&mut [&mut self.fido]) - } -} - -fn main() { - env_logger::init(); - - let options = trussed_usbip::Options { - manufacturer: Some(MANUFACTURER.to_owned()), - product: Some(PRODUCT.to_owned()), - serial_number: Some("TEST".into()), - vid: VID, - pid: PID, - }; - trussed_usbip::Builder::new(Ram::default(), options) - .dispatch(Dispatcher::default()) - .build::() - .exec(|_platform| {}); -}