更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -13,19 +13,8 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// =============================================================
|
||||
// 渠道敏感参数的对称加密与掩码
|
||||
//
|
||||
// yz_platform_payment_channel.config_json 中的密钥/私钥/Secret 以 AES-256-GCM 加密后存储,
|
||||
// 格式:base64( "YZP1:" + nonce + ciphertext )。
|
||||
// 密钥来源:app.conf 的 payment_secret_key(任意长度字符串,内部做 SHA-256 派生);
|
||||
// 未配置时退回内置兜底密钥(保证开箱可用),上线前务必在 app.conf 配置该值,
|
||||
// 且注意:更换密钥后,历史密文将无法解密,需要重新保存各渠道配置。
|
||||
// =============================================================
|
||||
|
||||
const configCipherPrefix = "YZP1:"
|
||||
|
||||
// fallbackSecretKey 内置兜底密钥,仅用于开发/未配置场景
|
||||
const fallbackSecretKey = "yunzer_payment_default_secret_key_v1"
|
||||
|
||||
func configKey() []byte {
|
||||
@@ -37,7 +26,6 @@ func configKey() []byte {
|
||||
return sum[:]
|
||||
}
|
||||
|
||||
// EncryptConfig 加密渠道参数 JSON
|
||||
func EncryptConfig(plain string) (string, error) {
|
||||
if plain == "" {
|
||||
return "", nil
|
||||
@@ -60,7 +48,6 @@ func EncryptConfig(plain string) (string, error) {
|
||||
return base64.StdEncoding.EncodeToString(buf), nil
|
||||
}
|
||||
|
||||
// DecryptConfig 解密渠道参数 JSON;空串原样返回
|
||||
func DecryptConfig(encoded string) (string, error) {
|
||||
if encoded == "" {
|
||||
return "", nil
|
||||
@@ -89,7 +76,6 @@ func DecryptConfig(encoded string) (string, error) {
|
||||
return string(plain), nil
|
||||
}
|
||||
|
||||
// MaskSecret 生成掩码:保留末 4 位
|
||||
func MaskSecret(v string) string {
|
||||
if v == "" {
|
||||
return ""
|
||||
@@ -100,7 +86,6 @@ func MaskSecret(v string) string {
|
||||
return "******" + v[len(v)-4:]
|
||||
}
|
||||
|
||||
// IsMasked 判断前端回传的值是否仍是掩码(表示「不修改原值」)
|
||||
func IsMasked(v string) bool {
|
||||
return strings.HasPrefix(v, "******")
|
||||
}
|
||||
Reference in new issue
Block a user