Add documentation

This commit is contained in:
Julien Cretin
2022-03-02 20:45:29 +01:00
committed by Julien Cretin
parent 18faf9f38f
commit 6b8523ba93
2 changed files with 6 additions and 0 deletions

4
src/env/mod.rs vendored
View File

@@ -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;

View File

@@ -28,6 +28,7 @@ pub mod ctap;
pub mod embedded_flash;
pub mod env;
/// CTAP implementation parameterized by its environment.
pub struct Ctap<E: Env> {
env: E,
state: CtapState,
@@ -35,6 +36,7 @@ pub struct Ctap<E: Env> {
}
impl<E: Env> Ctap<E> {
/// 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 {