🔒 QXY-FE cipher utils for OA projects.
npm -i @qxy/cipher crypto-js -S
yarn add @qxy/cipher crypto-js
pnpm add @qxy/cipher crypto-js
import { createCipher } from '@qxy/cipher'
import { getHash } from '@/services/utils'
const password = 'foobar'
const { hash: key } = await getHash()
const { encrypt, decrypt } = createCipher({ key })
const encryptedPassword = encrypt(password)
console.log(encryptedPassword) // => encryptedMessage
const decryptedPassword = decrypt(encryptedPassword)
console.log(decryptedPassword) // => `foobar`