Skip to content

qxy-fe/qxy-cipher

Repository files navigation

qxy-cipher

CI NPM VERSION Coverage Status LICENSE

🔒 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`

License

MIT License © 2022 ntnyq