Introduce a trait to abstract the CTAP environment
The end goal is to provide users with: - the Env trait that they should implement - the Ctap struct that they can use
This commit is contained in:
committed by
Julien Cretin
parent
8a2e99960f
commit
18faf9f38f
18
src/env/mod.rs
vendored
Normal file
18
src/env/mod.rs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::ctap::hid::ChannelID;
|
||||
use crate::ctap::status_code::Ctap2StatusCode;
|
||||
use crypto::rng256::Rng256;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub mod test;
|
||||
|
||||
pub trait UserPresence {
|
||||
fn check(&self, cid: ChannelID) -> Result<(), Ctap2StatusCode>;
|
||||
}
|
||||
|
||||
pub trait Env {
|
||||
type Rng: Rng256;
|
||||
type UserPresence: UserPresence;
|
||||
|
||||
fn rng(&mut self) -> &mut Self::Rng;
|
||||
fn user_presence(&mut self) -> &mut Self::UserPresence;
|
||||
}
|
||||
Reference in New Issue
Block a user