Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slashhuang/koa-cookie-cipher-middleware
A koa cookie cipher middleware using openssl aes-192 algorithm
https://github.com/slashhuang/koa-cookie-cipher-middleware
cipher cookie koa
Last synced: 21 days ago
JSON representation
A koa cookie cipher middleware using openssl aes-192 algorithm
- Host: GitHub
- URL: https://github.com/slashhuang/koa-cookie-cipher-middleware
- Owner: slashhuang
- Created: 2017-02-14T09:01:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T04:52:47.000Z (almost 8 years ago)
- Last Synced: 2024-12-10T05:37:52.885Z (30 days ago)
- Topics: cipher, cookie, koa
- Language: JavaScript
- Homepage:
- Size: 2.07 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa-cookie-cipher-middleware
> simple cookie cipher middleware for koa2.
## Installation
```bash
npm install koa-cookie-cipher-middleware
```## Usage
> [use case](./test/test.js)
```javascript
const app = new Koa();
const Cipher = require('koa-cookie-cipher-middleware');
const PORT = 3000;
const TestMiddleware = async function(ctx,next) {
console.log(`cipher name slashhuang\n`);
let cookieCipher = await ctx.cookie_decoder.cipher('slashhuang')
console.log(`cipher slashhuang to ${cookieCipher}\n`);
let cookieDecipher = await ctx.cookie_decoder.decipher('slashhuang');
console.log(`decipher cookie ${cookieCipher} to ${cookieDecipher}`);
}
const MiddlewareArr = [ Cipher('hello'),TestMiddleware ];
app.use(Compose(MiddlewareArr));
app.listen(PORT);```
## demo page
![cipher demo]( ./assets/cipher.png)## Author
slashhuang##License
MIT