feat: 侧边栏记录

This commit is contained in:
ChenZhaoYu
2023-02-14 11:34:46 +08:00
parent b6e5c59a9c
commit b03f804e35
10 changed files with 177 additions and 36 deletions

18
src/utils/crypto/index.ts Normal file
View File

@@ -0,0 +1,18 @@
import CryptoJS from 'crypto-js'
const CryptoSecret = '__CRYPTO_SECRET__'
export function enCrypto(data: any) {
const str = JSON.stringify(data)
return CryptoJS.AES.encrypt(str, CryptoSecret).toString()
}
export function deCrypto(data: string) {
const bytes = CryptoJS.AES.decrypt(data, CryptoSecret)
const str = bytes.toString(CryptoJS.enc.Utf8)
if (str)
return JSON.parse(str)
return null
}