mirror of https://github.com/halo-dev/halo-admin
chore: remove crypto-js dependency (#412)
parent
195d922756
commit
e1ccf5b219
@ -1,20 +0,0 @@
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
const CRYPTO_KEY = 'halo-crypt'
|
||||
|
||||
export default {
|
||||
encrypt(plaintObject) {
|
||||
if (!plaintObject) {
|
||||
return undefined
|
||||
}
|
||||
return CryptoJS.AES.encrypt(JSON.stringify(plaintObject), CRYPTO_KEY).toString()
|
||||
},
|
||||
|
||||
decrypt(ciphertext) {
|
||||
if (!ciphertext) {
|
||||
return undefined
|
||||
}
|
||||
const bytes = CryptoJS.AES.decrypt(ciphertext, CRYPTO_KEY)
|
||||
return JSON.parse(bytes.toString(CryptoJS.enc.Utf8))
|
||||
}
|
||||
}
|
Loading…
Reference in new issue