pub struct TOTP {
pub label: String,
pub issuer: Option<String>,
pub period: u64,
pub digits: u32,
pub algorithm: TOTPAlgorithm,
/* private fields */
}Expand description
Time-based one-time password settings.
Fields§
§label: StringThe label for this TOTP.
issuer: Option<String>The issuer for this TOTP, if specified.
period: u64The period (in seconds) for which a generated code is valid.
digits: u32The number of digits in the generated code.
algorithm: TOTPAlgorithmThe hash algorithm to use when generating codes.
Implementations§
Source§impl TOTP
impl TOTP
Sourcepub fn value_at(&self, time: u64) -> OTPCode
pub fn value_at(&self, time: u64) -> OTPCode
Get the one-time code for a specific Unix timestamp.
Sourcepub fn value_now(&self) -> Result<OTPCode, SystemTimeError>
pub fn value_now(&self) -> Result<OTPCode, SystemTimeError>
Get the current one-time code.
Sourcepub fn get_secret(&self) -> String
pub fn get_secret(&self) -> String
Get the base32-encoded secret key for this TOTP.
Trait Implementations§
impl Eq for TOTP
impl StructuralPartialEq for TOTP
Auto Trait Implementations§
impl Forget for TOTP
impl Freeze for TOTP
impl Move for TOTP
impl RefUnwindSafe for TOTP
impl Send for TOTPwhere
RawVecInner: Send,
impl Sync for TOTPwhere
RawVecInner: Sync,
impl Unpin for TOTP
impl UnsafeUnpin for TOTP
impl UnwindSafe for TOTPwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.