1
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-09-19 17:27:31 +08:00
parent 8300cbaccf
commit c77ca02cbc
2 changed files with 13 additions and 8 deletions

View File

@ -19,14 +19,19 @@ export const Encrypt = {
if (sessionStorage.getItem('PublicKey')) {
PublicKey = sessionStorage.getItem('PublicKey');
} else {
let res = await getPublicKey();
if (res.IsSuccess) {
PublicKey = decodeURI(res.Result)
sessionStorage.setItem('PublicKey', res.Result)
} else {
return false;
try {
let res = await getPublicKey();
if (res.IsSuccess) {
PublicKey = atob(res.Result)
sessionStorage.setItem('PublicKey', PublicKey)
} else {
return false;
}
} catch (err) {
console.log(err)
}
}
console.log(PublicKey)
let encryptor = new JSEncrypt()
encryptor.setPublicKey(PublicKey)
return encryptor.encrypt(JSON.stringify(plaintext))

View File

@ -7,8 +7,8 @@ export const encryptConfig = async (config) => {
}
if (config.data && Object.prototype.toString.call(config.data) === '[object Object]') {
Object.keys(config.data).forEach(async key => {
// config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
config.data[key] = await Encrypt.encrypt(config.data[key])
config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
// config.data[key] = await Encrypt.encrypt(config.data[key])
})
}
return config;