pub struct HotpService { /* private fields */ }Expand description
HOTP 服务
Implementations§
Source§impl HotpService
impl HotpService
Sourcepub fn new(config: HotpConfig) -> Result<Self, WaeError>
pub fn new(config: HotpConfig) -> Result<Self, WaeError>
创建新的 HOTP 服务
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>
创建新的 HOTP 服务 (使用随机密钥)
Sourcepub fn generate_code(&self) -> Result<String, WaeError>
pub fn generate_code(&self) -> Result<String, WaeError>
生成当前计数器的 HOTP 码
Sourcepub fn set_counter(&mut self, counter: u64)
pub fn set_counter(&mut self, counter: u64)
设置计数器值
Sourcepub fn secret(&self) -> &TotpSecret
pub fn secret(&self) -> &TotpSecret
获取密钥
Sourcepub fn config(&self) -> &HotpConfig
pub fn config(&self) -> &HotpConfig
获取配置
Trait Implementations§
Source§impl Clone for HotpService
impl Clone for HotpService
Source§fn clone(&self) -> HotpService
fn clone(&self) -> HotpService
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 HotpService
impl RefUnwindSafe for HotpService
impl Send for HotpService
impl Sync for HotpService
impl Unpin for HotpService
impl UnsafeUnpin for HotpService
impl UnwindSafe for HotpService
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