Class Totp.Builder
java.lang.Object
cloud.opencode.base.crypto.otp.Totp.Builder
- Enclosing class:
Totp
Builder for constructing Totp instances with custom configuration.
用于自定义配置构建 Totp 实例的 Builder
- Since:
- JDK 25, opencode-base-crypto V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Details
-
algorithm
Sets the HMAC algorithm. 设置 HMAC 算法- Parameters:
algorithm- the HMAC algorithm name (e.g., "HmacSHA1", "HmacSHA256") | HMAC 算法名称- Returns:
- this Builder | 当前 Builder
-
period
Sets the time period in seconds. 设置时间步长(秒)- Parameters:
period- the period in seconds (must be positive) | 时间步长(必须为正数)- Returns:
- this Builder | 当前 Builder
- Throws:
IllegalArgumentException- if period is not positive | 当步长不为正数时抛出
-
digits
Sets the number of digits in the generated code. 设置生成验证码的位数- Parameters:
digits- the number of digits (6-8) | 位数(6-8)- Returns:
- this Builder | 当前 Builder
- Throws:
IllegalArgumentException- if digits is not 6-8 | 当位数不在 6-8 范围时抛出
-
build
Builds the Totp instance with the configured settings. 使用配置的设置构建 Totp 实例- Returns:
- a new Totp instance | 新的 Totp 实例
-