Add documentation
This commit is contained in:
committed by
Julien Cretin
parent
18faf9f38f
commit
6b8523ba93
4
src/env/mod.rs
vendored
4
src/env/mod.rs
vendored
@@ -6,9 +6,13 @@ use crypto::rng256::Rng256;
|
|||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
pub trait UserPresence {
|
pub trait UserPresence {
|
||||||
|
/// Blocks for user presence.
|
||||||
|
///
|
||||||
|
/// Returns an error in case of timeout or keepalive error.
|
||||||
fn check(&self, cid: ChannelID) -> Result<(), Ctap2StatusCode>;
|
fn check(&self, cid: ChannelID) -> Result<(), Ctap2StatusCode>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Describes what CTAP needs to function.
|
||||||
pub trait Env {
|
pub trait Env {
|
||||||
type Rng: Rng256;
|
type Rng: Rng256;
|
||||||
type UserPresence: UserPresence;
|
type UserPresence: UserPresence;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ pub mod ctap;
|
|||||||
pub mod embedded_flash;
|
pub mod embedded_flash;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
|
|
||||||
|
/// CTAP implementation parameterized by its environment.
|
||||||
pub struct Ctap<E: Env> {
|
pub struct Ctap<E: Env> {
|
||||||
env: E,
|
env: E,
|
||||||
state: CtapState,
|
state: CtapState,
|
||||||
@@ -35,6 +36,7 @@ pub struct Ctap<E: Env> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<E: Env> Ctap<E> {
|
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
|
// This should only take the environment, but it temporarily takes the boot time until the
|
||||||
// clock is part of the environment.
|
// clock is part of the environment.
|
||||||
pub fn new(mut env: E, now: ClockValue) -> Self {
|
pub fn new(mut env: E, now: ClockValue) -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user