[−][src]Struct otpauth::TOTP
Two-step verification of TOTP algorithm
Methods
impl TOTP
[src]
pub fn new<S: Into<String>>(secret: S) -> TOTP
[src]
Constructs a new TOTP
pub fn from_base32<S: Into<String>>(secret: S) -> Option<TOTP>
[src]
Constructs a new TOTP
with base-32 encoded secret bytes
pub fn from_bytes(bytes: &[u8]) -> TOTP
[src]
Constructs a new TOTP
with secret bytes
pub fn generate(&self, period: u64, timestamp: u64) -> u32
[src]
Generate a TOTP code.
A TOTP code is an extension of HOTP algorithm.
period
: A period that a TOTP code is valid in seconds
timestamp
: Create TOTP at this given timestamp
pub fn verify(&self, code: u32, period: u64, timestamp: u64) -> bool
[src]
Valid a TOTP code.
code
: A number that is less than 6 characters.
period
: A period that a TOTP code is valid in seconds
timestamp
: Validate TOTP at this given timestamp
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) -> String
[src]
Generate the otpauth protocal string.
label
: Label of the identifier.
issuer
: The company, the organization or something else.
Trait Implementations
impl Eq for TOTP
[src]
impl Clone for TOTP
[src]
fn clone(&self) -> TOTP
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<TOTP> for TOTP
[src]
impl Debug for TOTP
[src]
Auto Trait Implementations
impl Unpin for TOTP
impl Sync for TOTP
impl Send for TOTP
impl UnwindSafe for TOTP
impl RefUnwindSafe for TOTP
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,