Type Definition otp2::Totp

source ·
pub type Totp = Otp<Time>;
Expand description

Time-based one-time passcode.

Provides one-time passcodes that are valid within a window of time after the passcode is generated.

Implementations§

source§

impl Totp

source

pub fn new(key: String, t0: Instant, window: u64, length: u32) -> Self

Get a TOTP generator.

Repeated calls to Self::get will return the same passcode when in the same window.

source

pub fn new_with_now( key: String, t0: Instant, step: u64, digits: u32, now: Box<dyn Fn() -> Instant> ) -> Self

Get a TOTP generator with a custom function to provide the “now” value.

See Self::new.