@qxy/cipher
v0.2.0
Published
QXY cipher utils
Downloads
4
Readme
qxy-cipher
:lock: QXY-FE cipher utils for OA projects.
Install
npm -i @qxy/cipher crypto-js -S
yarn add @qxy/cipher crypto-js
pnpm add @qxy/cipher crypto-js
Usage
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`