From 6b8523ba935ee42dc977474834b87dab3a8d54ae Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Wed, 2 Mar 2022 20:45:29 +0100 Subject: [PATCH] Add documentation --- src/env/mod.rs | 4 ++++ src/lib.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/env/mod.rs b/src/env/mod.rs index dc79184..c66bd4f 100644 --- a/src/env/mod.rs +++ b/src/env/mod.rs @@ -6,9 +6,13 @@ use crypto::rng256::Rng256; pub mod test; pub trait UserPresence { + /// Blocks for user presence. + /// + /// Returns an error in case of timeout or keepalive error. fn check(&self, cid: ChannelID) -> Result<(), Ctap2StatusCode>; } +/// Describes what CTAP needs to function. pub trait Env { type Rng: Rng256; type UserPresence: UserPresence; diff --git a/src/lib.rs b/src/lib.rs index 12d2301..df4b2a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,6 +28,7 @@ pub mod ctap; pub mod embedded_flash; pub mod env; +/// CTAP implementation parameterized by its environment. pub struct Ctap { env: E, state: CtapState, @@ -35,6 +36,7 @@ pub struct Ctap { } impl Ctap { + /// Instantiates a CTAP implementation given its environment. // This should only take the environment, but it temporarily takes the boot time until the // clock is part of the environment. pub fn new(mut env: E, now: ClockValue) -> Self {