1
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
8300cbaccf
commit
c77ca02cbc
|
@ -19,14 +19,19 @@ export const Encrypt = {
|
||||||
if (sessionStorage.getItem('PublicKey')) {
|
if (sessionStorage.getItem('PublicKey')) {
|
||||||
PublicKey = sessionStorage.getItem('PublicKey');
|
PublicKey = sessionStorage.getItem('PublicKey');
|
||||||
} else {
|
} else {
|
||||||
let res = await getPublicKey();
|
try {
|
||||||
if (res.IsSuccess) {
|
let res = await getPublicKey();
|
||||||
PublicKey = decodeURI(res.Result)
|
if (res.IsSuccess) {
|
||||||
sessionStorage.setItem('PublicKey', res.Result)
|
PublicKey = atob(res.Result)
|
||||||
} else {
|
sessionStorage.setItem('PublicKey', PublicKey)
|
||||||
return false;
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(PublicKey)
|
||||||
let encryptor = new JSEncrypt()
|
let encryptor = new JSEncrypt()
|
||||||
encryptor.setPublicKey(PublicKey)
|
encryptor.setPublicKey(PublicKey)
|
||||||
return encryptor.encrypt(JSON.stringify(plaintext))
|
return encryptor.encrypt(JSON.stringify(plaintext))
|
||||||
|
|
|
@ -7,8 +7,8 @@ export const encryptConfig = async (config) => {
|
||||||
}
|
}
|
||||||
if (config.data && Object.prototype.toString.call(config.data) === '[object Object]') {
|
if (config.data && Object.prototype.toString.call(config.data) === '[object Object]') {
|
||||||
Object.keys(config.data).forEach(async key => {
|
Object.keys(config.data).forEach(async key => {
|
||||||
// config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
|
config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
|
||||||
config.data[key] = await Encrypt.encrypt(config.data[key])
|
// config.data[key] = await Encrypt.encrypt(config.data[key])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
|
|
Loading…
Reference in New Issue