pub struct TotpService { /* private fields */ }Expand description
TOTP 服务
Implementations§
Source§impl TotpService
impl TotpService
Sourcepub fn new(config: TotpConfig) -> Result<Self, WaeError>
pub fn new(config: TotpConfig) -> Result<Self, WaeError>
Sourcepub fn create(
issuer: impl Into<String>,
account_name: impl Into<String>,
) -> Result<Self, WaeError>
pub fn create( issuer: impl Into<String>, account_name: impl Into<String>, ) -> Result<Self, WaeError>
Sourcepub fn generate_code(&self) -> Result<String, WaeError>
pub fn generate_code(&self) -> Result<String, WaeError>
生成当前 TOTP 码
Sourcepub fn remaining_seconds(&self) -> u64
pub fn remaining_seconds(&self) -> u64
获取当前步剩余秒数
Sourcepub fn secret(&self) -> &TotpSecret
pub fn secret(&self) -> &TotpSecret
获取密钥
Sourcepub fn formatted_secret(&self, format: SecretFormat) -> String
pub fn formatted_secret(&self, format: SecretFormat) -> String
获取格式化的密钥
Sourcepub fn config(&self) -> &TotpConfig
pub fn config(&self) -> &TotpConfig
获取配置
Trait Implementations§
Source§impl Clone for TotpService
impl Clone for TotpService
Source§fn clone(&self) -> TotpService
fn clone(&self) -> TotpService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TotpService
impl RefUnwindSafe for TotpService
impl Send for TotpService
impl Sync for TotpService
impl Unpin for TotpService
impl UnsafeUnpin for TotpService
impl UnwindSafe for TotpService
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