mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:09:32 +00:00
feat: 侧边栏记录
This commit is contained in:
1 parent
b6e5c59a9c
commit
b03f804e35
10 files changed
+177
-36
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user