Type Alias 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.

Aliased Type§

struct Totp { /* private fields */ }

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.