pub enum TwoFactorCode {
Totp(String),
Backup(String),
}Expand description
Validated second-factor code supplied during login.
Its custom fmt::Debug implementation redacts the code.
Variants§
Totp(String)
Six-digit time-based one-time password.
Backup(String)
Normalized one-time recovery code.
Implementations§
Source§impl TwoFactorCode
impl TwoFactorCode
Sourcepub fn parse(raw: String) -> Result<Self, ParseError>
pub fn parse(raw: String) -> Result<Self, ParseError>
Parses either a six-digit TOTP or an alphanumeric backup code.
Sourcepub fn totp_value(&self) -> Option<u32>
pub fn totp_value(&self) -> Option<u32>
Returns the numeric TOTP value when this is a TOTP code.
Sourcepub fn backup_code(&self) -> Option<&str>
pub fn backup_code(&self) -> Option<&str>
Returns the normalized recovery value when this is a backup code.
Trait Implementations§
Source§impl Clone for TwoFactorCode
impl Clone for TwoFactorCode
Source§impl Debug for TwoFactorCode
impl Debug for TwoFactorCode
impl Eq for TwoFactorCode
Source§impl PartialEq for TwoFactorCode
impl PartialEq for TwoFactorCode
impl StructuralPartialEq for TwoFactorCode
Auto Trait Implementations§
impl Freeze for TwoFactorCode
impl RefUnwindSafe for TwoFactorCode
impl Send for TwoFactorCode
impl Sync for TwoFactorCode
impl Unpin for TwoFactorCode
impl UnsafeUnpin for TwoFactorCode
impl UnwindSafe for TwoFactorCode
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