Class SecureSmsConfig

java.lang.Object
cloud.opencode.base.sms.config.SecureSmsConfig
All Implemented Interfaces:
AutoCloseable

public final class SecureSmsConfig extends Object implements AutoCloseable
Secure SMS Config 安全短信配置

Wrapper for SMS config that protects sensitive data.

保护敏感数据的短信配置包装器。

Features | 主要功能:

  • Stores credentials as char[] for secure clearing - 使用char[]存储凭据以便安全清除
  • Implements AutoCloseable for credential cleanup - 实现AutoCloseable用于凭据清理
  • Volatile cleared flag for thread visibility - volatile标志确保线程可见性

Usage Examples | 使用示例:

try (SecureSmsConfig config = new SecureSmsConfig(httpConfig)) {
    String apiUrl = config.getApiUrl();
    // use config...
} // credentials are cleared on close

Security | 安全性:

  • Thread-safe: Yes (synchronized access to credentials) - 线程安全: 是(同步访问凭据)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-sms V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • SecureSmsConfig

      public SecureSmsConfig(HttpSmsConfig config)
      Create secure config from HTTP config 从HTTP配置创建安全配置
      Parameters:
      config - the HTTP config | HTTP配置
  • Method Details

    • getName

      public String getName()
      Get name 获取名称
      Returns:
      the name | 名称
    • getApiUrl

      public String getApiUrl()
      Get API URL 获取API地址
      Returns:
      the API URL | API地址
    • getAppId

      public String getAppId()
      Get app ID 获取应用ID
      Returns:
      the app ID | 应用ID
      Throws:
      IllegalStateException - if already cleared | 如果已清除则抛出异常
    • getAppKey

      public String getAppKey()
      Get app key 获取应用密钥
      Returns:
      the app key | 应用密钥
      Throws:
      IllegalStateException - if already cleared | 如果已清除则抛出异常
    • getSignName

      public String getSignName()
      Get sign name 获取签名名称
      Returns:
      the sign name | 签名名称
    • clear

      public void clear()
      Clear sensitive data 清除敏感数据
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object