pub struct HotpConfig {
pub issuer: String,
pub account_name: String,
pub secret: String,
pub algorithm: TotpAlgorithm,
pub digits: u32,
pub counter: u64,
}Expand description
HOTP (HMAC-based One-Time Password) 配置
Fields§
§issuer: String发行者
account_name: String用户账号
secret: String密钥 (Base32 编码)
algorithm: TotpAlgorithm哈希算法
digits: u32数字位数
counter: u64计数器
Implementations§
Source§impl HotpConfig
impl HotpConfig
Sourcepub fn new(
issuer: impl Into<String>,
account_name: impl Into<String>,
secret: impl Into<String>,
) -> Self
pub fn new( issuer: impl Into<String>, account_name: impl Into<String>, secret: impl Into<String>, ) -> Self
创建新的 HOTP 配置
Sourcepub fn with_counter(self, counter: u64) -> Self
pub fn with_counter(self, counter: u64) -> Self
设置计数器
Sourcepub fn with_digits(self, digits: u32) -> Self
pub fn with_digits(self, digits: u32) -> Self
设置数字位数
Sourcepub fn with_algorithm(self, algorithm: TotpAlgorithm) -> Self
pub fn with_algorithm(self, algorithm: TotpAlgorithm) -> Self
设置哈希算法
Trait Implementations§
Source§impl Clone for HotpConfig
impl Clone for HotpConfig
Source§fn clone(&self) -> HotpConfig
fn clone(&self) -> HotpConfig
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 HotpConfig
impl RefUnwindSafe for HotpConfig
impl Send for HotpConfig
impl Sync for HotpConfig
impl Unpin for HotpConfig
impl UnsafeUnpin for HotpConfig
impl UnwindSafe for HotpConfig
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