Struct botan::TOTP[][src]

pub struct TOTP { /* fields omitted */ }

Generate or check TOTP tokens

Implementations

impl TOTP[src]

pub fn new(
    key: &[u8],
    hash_algo: &str,
    digits: usize,
    time_step: usize
) -> Result<TOTP>
[src]

Instantiate a new TOTP instance with the given parameters

Examples

let totp = botan::TOTP::new(&[1,2,3,4], "SHA-1", 6, 30);

pub fn generate(&self, timestamp: u64) -> Result<u32>[src]

Generate an TOTP code

pub fn check(
    &self,
    code: u32,
    timestamp: u64,
    allowed_drift: usize
) -> Result<bool>
[src]

Check an TOTP code

Trait Implementations

impl Debug for TOTP[src]

impl Drop for TOTP[src]

Auto Trait Implementations

impl RefUnwindSafe for TOTP

impl !Send for TOTP

impl !Sync for TOTP

impl Unpin for TOTP

impl UnwindSafe for TOTP

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.