全局配置逻辑实现
This commit is contained in:
1 parent
da4af93a1e
commit
cf8220edbd
13 files changed
+361
-35
No files matched your search
@@ -3,6 +3,7 @@ package com.ruoyi.system.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -50,31 +51,31 @@ public class UsdtConfig extends BaseEntity
|
||||
private Long iterations;
|
||||
|
||||
/** AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词 */
|
||||
@Excel(name = "AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词")
|
||||
@JsonIgnore
|
||||
private String encryptedMnemonic;
|
||||
|
||||
/** 助记词 AES-GCM nonce,Base64,通常为 12 字节 */
|
||||
@Excel(name = "助记词 AES-GCM nonce,Base64,通常为 12 字节")
|
||||
@JsonIgnore
|
||||
private String mnemonicNonce;
|
||||
|
||||
/** 由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK */
|
||||
@Excel(name = "由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK")
|
||||
@JsonIgnore
|
||||
private String encryptedDek;
|
||||
|
||||
/** DEK AES-GCM nonce,Base64,通常为 12 字节 */
|
||||
@Excel(name = "DEK AES-GCM nonce,Base64,通常为 12 字节")
|
||||
@JsonIgnore
|
||||
private String dekNonce;
|
||||
|
||||
/** 配置密码派生 KEK 使用的 salt,Base64 */
|
||||
@Excel(name = "配置密码派生 KEK 使用的 salt,Base64")
|
||||
@JsonIgnore
|
||||
private String keySalt;
|
||||
|
||||
/** 配置密码校验哈希使用的独立 salt,Base64 */
|
||||
@Excel(name = "配置密码校验哈希使用的独立 salt,Base64")
|
||||
@JsonIgnore
|
||||
private String passwordSalt;
|
||||
|
||||
/** PBKDF2 配置密码校验值,Base64;不是可逆密码 */
|
||||
@Excel(name = "PBKDF2 配置密码校验值,Base64;不是可逆密码")
|
||||
@JsonIgnore
|
||||
private String passwordHash;
|
||||
|
||||
/** 最近一次配置密码轮换时间 */
|
||||
@@ -264,13 +265,7 @@ public class UsdtConfig extends BaseEntity
|
||||
.append("encryptionAlgorithm", getEncryptionAlgorithm())
|
||||
.append("passwordKdf", getPasswordKdf())
|
||||
.append("iterations", getIterations())
|
||||
.append("encryptedMnemonic", getEncryptedMnemonic())
|
||||
.append("mnemonicNonce", getMnemonicNonce())
|
||||
.append("encryptedDek", getEncryptedDek())
|
||||
.append("dekNonce", getDekNonce())
|
||||
.append("keySalt", getKeySalt())
|
||||
.append("passwordSalt", getPasswordSalt())
|
||||
.append("passwordHash", getPasswordHash())
|
||||
.append("walletEnvelope", "<redacted>")
|
||||
.append("rotatedAt", getRotatedAt())
|
||||
.append("trxNum", getTrxNum())
|
||||
.append("tokenAddress", getTokenAddress())
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -45,25 +46,25 @@ public class UsdtConfigPlus implements Serializable
|
||||
@Excel(name = "PBKDF2 迭代次数;轮换时按当前安全策略更新")
|
||||
private Long iterations;
|
||||
/** AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词 */
|
||||
@Excel(name = "AES-GCM 加密后的助记词密文,Base64;禁止保存明文助记词")
|
||||
@JsonIgnore
|
||||
private String encryptedMnemonic;
|
||||
/** 助记词 AES-GCM nonce,Base64,通常为 12 字节 */
|
||||
@Excel(name = "助记词 AES-GCM nonce,Base64,通常为 12 字节")
|
||||
@JsonIgnore
|
||||
private String mnemonicNonce;
|
||||
/** 由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK */
|
||||
@Excel(name = "由 KEK 包装后的 DEK,Base64;禁止保存明文 DEK")
|
||||
@JsonIgnore
|
||||
private String encryptedDek;
|
||||
/** DEK AES-GCM nonce,Base64,通常为 12 字节 */
|
||||
@Excel(name = "DEK AES-GCM nonce,Base64,通常为 12 字节")
|
||||
@JsonIgnore
|
||||
private String dekNonce;
|
||||
/** 配置密码派生 KEK 使用的 salt,Base64 */
|
||||
@Excel(name = "配置密码派生 KEK 使用的 salt,Base64")
|
||||
@JsonIgnore
|
||||
private String keySalt;
|
||||
/** 配置密码校验哈希使用的独立 salt,Base64 */
|
||||
@Excel(name = "配置密码校验哈希使用的独立 salt,Base64")
|
||||
@JsonIgnore
|
||||
private String passwordSalt;
|
||||
/** PBKDF2 配置密码校验值,Base64;不是可逆密码 */
|
||||
@Excel(name = "PBKDF2 配置密码校验值,Base64;不是可逆密码")
|
||||
@JsonIgnore
|
||||
private String passwordHash;
|
||||
/** 最近一次配置密码轮换时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@@ -249,13 +250,7 @@ public class UsdtConfigPlus implements Serializable
|
||||
.append("encryptionAlgorithm", getEncryptionAlgorithm())
|
||||
.append("passwordKdf", getPasswordKdf())
|
||||
.append("iterations", getIterations())
|
||||
.append("encryptedMnemonic", getEncryptedMnemonic())
|
||||
.append("mnemonicNonce", getMnemonicNonce())
|
||||
.append("encryptedDek", getEncryptedDek())
|
||||
.append("dekNonce", getDekNonce())
|
||||
.append("keySalt", getKeySalt())
|
||||
.append("passwordSalt", getPasswordSalt())
|
||||
.append("passwordHash", getPasswordHash())
|
||||
.append("walletEnvelope", "<redacted>")
|
||||
.append("rotatedAt", getRotatedAt())
|
||||
.append("trxNum", getTrxNum())
|
||||
.append("tokenAddress", getTokenAddress())
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 全局钱包配置首次创建请求。
|
||||
*
|
||||
* 配置密码仅用于本次请求中派生密钥,不会保存到数据库,也不会写入接口响应。
|
||||
*/
|
||||
public class UsdtConfigCreateRequest {
|
||||
private BigDecimal payUsdtNum;
|
||||
private BigDecimal receiveUsdtNum;
|
||||
private Integer tronNetType;
|
||||
private BigDecimal trxNum;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String configurationPassword;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String confirmPassword;
|
||||
|
||||
public BigDecimal getPayUsdtNum() { return payUsdtNum; }
|
||||
public void setPayUsdtNum(BigDecimal payUsdtNum) { this.payUsdtNum = payUsdtNum; }
|
||||
public BigDecimal getReceiveUsdtNum() { return receiveUsdtNum; }
|
||||
public void setReceiveUsdtNum(BigDecimal receiveUsdtNum) { this.receiveUsdtNum = receiveUsdtNum; }
|
||||
public Integer getTronNetType() { return tronNetType; }
|
||||
public void setTronNetType(Integer tronNetType) { this.tronNetType = tronNetType; }
|
||||
public BigDecimal getTrxNum() { return trxNum; }
|
||||
public void setTrxNum(BigDecimal trxNum) { this.trxNum = trxNum; }
|
||||
public String getConfigurationPassword() { return configurationPassword; }
|
||||
public void setConfigurationPassword(String configurationPassword) { this.configurationPassword = configurationPassword; }
|
||||
public String getConfirmPassword() { return confirmPassword; }
|
||||
public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/** 配置密码轮换请求。 */
|
||||
public class UsdtConfigRotateRequest {
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String oldPassword;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String newPassword;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String confirmPassword;
|
||||
|
||||
public String getOldPassword() { return oldPassword; }
|
||||
public void setOldPassword(String oldPassword) { this.oldPassword = oldPassword; }
|
||||
public String getNewPassword() { return newPassword; }
|
||||
public void setNewPassword(String newPassword) { this.newPassword = newPassword; }
|
||||
public String getConfirmPassword() { return confirmPassword; }
|
||||
public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
/**
|
||||
* 全局钱包配置首次创建结果。
|
||||
* mnemonic 只在首次创建成功时返回一次,调用方必须立即离线备份。
|
||||
*/
|
||||
public class UsdtConfigCreateResult {
|
||||
private final Long id;
|
||||
private final Long version;
|
||||
private final String tokenAddress;
|
||||
private final String mnemonic;
|
||||
|
||||
public UsdtConfigCreateResult(Long id, Long version, String tokenAddress, String mnemonic) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
this.tokenAddress = tokenAddress;
|
||||
this.mnemonic = mnemonic;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public Long getVersion() { return version; }
|
||||
public String getTokenAddress() { return tokenAddress; }
|
||||
public String getMnemonic() { return mnemonic; }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
/** 配置密码轮换结果,不包含密码及任何钱包密钥材料。 */
|
||||
public class UsdtConfigRotateResult {
|
||||
private final Long id;
|
||||
private final Long version;
|
||||
private final String tokenAddress;
|
||||
|
||||
public UsdtConfigRotateResult(Long id, Long version, String tokenAddress) {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
this.tokenAddress = tokenAddress;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public Long getVersion() { return version; }
|
||||
public String getTokenAddress() { return tokenAddress; }
|
||||
}
|
||||
Reference in new issue
Block a user