[][src]Struct otpauth::HOTP

pub struct HOTP { /* fields omitted */ }

Two-step verfication of HOTP algorithm.

Methods

impl HOTP[src]

pub fn new<S: Into<String>>(secret: S) -> HOTP[src]

Constructs a new HOTP

pub fn from_base32<S: Into<String>>(secret: S) -> Option<HOTP>[src]

Constructs a new HOTP with base-32 encoded secret bytes

pub fn from_bytes(bytes: &[u8]) -> HOTP[src]

Constructs a new HOTP with secret bytes

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

Generate a HOTP code.

counter: HOTP is a counter based algorithm.

pub fn verify(&self, code: u32, last: u64, trials: u64) -> bool[src]

Valid a HOTP code.

code: A number that is less than 6 characters.

last: Guess HOTP code from last + 1 range.

trials: Guess HOTP code end at last + trials + 1.

pub fn base32_secret(&self) -> String[src]

Return the secret bytes in base32 encoding.

pub fn to_uri<S: AsRef<str>>(&self, label: S, issuer: S, counter: u64) -> String[src]

Generate the otpauth protocal string.

label: Label of the identifier.

issuer: The company, the organization or something else.

counter: Counter of the HOTP algorithm.

Trait Implementations

impl Eq for HOTP[src]

impl Clone for HOTP[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<HOTP> for HOTP[src]

impl Debug for HOTP[src]

Auto Trait Implementations

impl Unpin for HOTP

impl Sync for HOTP

impl Send for HOTP

impl UnwindSafe for HOTP

impl RefUnwindSafe for HOTP

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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