1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
// #![no_std]
//! `ctap-types` maps the various types involved in the FIDO CTAP protocol
//! to Rust structures consisting of `heapless` data types.
//!
//! We currently follow the non-public editor's draft dated 19 March 2019.
//! It still uses `FIDO_2_1_PRE` to signal new commands, but uses non-vendor
//! API numbering (e.g. 0xA for credential management).
//!
//! It also contains a lightweight CBOR deserializer, as the existing `serde_cbor`
//! creates very large code.
//!
//! The various transport protocols (USB, NFC, BLE) are expected to handle
//! low-level protocol details and deserialize requests / serialize responses,
//! so the authenticator logic is decoupled from these details.
#[macro_use]
extern crate delog;
generate_macros!();
pub use heapless;
pub use heapless::{String, Vec};
pub use heapless_bytes;
pub use heapless_bytes::Bytes;
pub use serde_bytes::ByteArray;
#[cfg(feature = "arbitrary")]
mod arbitrary;
pub mod authenticator;
pub mod ctap1;
pub mod ctap2;
pub(crate) mod operation;
pub use cbor_smol as serde;
pub mod sizes;
pub mod webauthn;
pub use ctap2::{Error, Result};
use core::fmt::{self, Display, Formatter};
/// An error returned by the `TryFrom<&str>` implementation for enums if an invalid value is
/// provided.
#[derive(Debug)]
pub struct TryFromStrError;
impl Display for TryFromStrError {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
"invalid enum value".fmt(f)
}
}
#[cfg(test)]
mod tests {}
/// Call a remote procedure with a request, receive a response, maybe.
pub trait Rpc<Error, Request, Response> {
fn call(&mut self, request: &Request) -> core::result::Result<Response, Error>;
}