0.1.0 • Published 3 years ago
node-securecookie v0.1.0
node-securecookie
securecookie implementation for Node.js
The main purpose of this package is to provide encoding and decoding capabilities that are compatible with gorilla/securecookie.
Installation
$ npm install node-securecookie
Usage
import { SecureCookie } from 'node-securecookie';
// pass hash key and block key
const sc = new SecureCookie('12345', '1234567890123456');
const value = {
foo: 'bar',
};
const encoded = sc.encode('cookie-name', value);
console.log(encoded);
const decoded = sc.decode<Record<string, string>>('cookie-name', encoded);
console.log(decoded);
See /example
for the sample code that actually works using express.js.
TODO
- Make errors easear to handle
- Do more tests
- Support
encoding/gob
serializer
License
MIT © fmatzy
0.1.0
3 years ago