加密测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
c77ca02cbc
commit
449e999d43
|
@ -17,13 +17,13 @@ export const Encrypt = {
|
|||
encrypt: async function (plaintext) {
|
||||
let PublicKey = null;
|
||||
if (sessionStorage.getItem('PublicKey')) {
|
||||
PublicKey = sessionStorage.getItem('PublicKey');
|
||||
PublicKey = atob(sessionStorage.getItem('PublicKey'));
|
||||
} else {
|
||||
try {
|
||||
let res = await getPublicKey();
|
||||
if (res.IsSuccess) {
|
||||
PublicKey = atob(res.Result)
|
||||
sessionStorage.setItem('PublicKey', PublicKey)
|
||||
sessionStorage.setItem('PublicKey', res.Result)
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export const Encrypt = {
|
|||
console.log(PublicKey)
|
||||
let encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(PublicKey)
|
||||
return encryptor.encrypt(JSON.stringify(plaintext))
|
||||
return encryptor.encrypt(plaintext)
|
||||
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue