Giter Site home page Giter Site logo

00mjk / cookie-encryption Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hex7c0/cookie-encryption

0.0 0.0 0.0 227 KB

encrypt/decrypt data to store on cookie with memoization for Nodejs

Home Page: https://github.com/hex7c0/cookie-encryption

License: GNU General Public License v3.0

JavaScript 100.00%

cookie-encryption's Introduction

cookie-encryption

NPM version Linux Status Windows Status Dependency Status Coveralls

Encrypt/decrypt data to store on cookie, with memoization. This class is built with arc4 cipher, autokey cipher, nodejs ciphers, nodejs hash, nodejs hmac, nodejs pbkdf2 and nodejs diffiehellman,

Installation

Install through NPM

npm install cookie-encryption

or

git clone git://github.com/hex7c0/cookie-encryption.git

API

inside expressjs project

var cookiee = require('cookie-encryption');

var vault = cookiee('ciao');

return supported ciphers

var cookiee = require('cookie-encryption');

cookiee.getCiphers();

Check Cookie options

Methods

write data ('pippo') to selected cookie

vault.write(req, 'pippo');

read data from selected cookie

vault.read(req);

flush data cache

vault.flush();

optional arguments inside of previous methods

 * @param {String} [cookie] - fast cookie
 * @param {String} [encoding] - fast encoding

cookiee(secret [, options])

secret

  • secret- String | Buffer Set password (default "required")

[options]

  • cipher - String Type of cipher, grab list from getCiphers (default "arc4")
  • domain - String Domain of cookie (default "null")
  • cookie - String Name of cookie (default "vault")
  • path - String Path of cookie (default "/")
  • maxAge - Number Age of cookie in millisecond (default "1 year")
  • httpOnly - Boolean Flag for http only cookie (default "false")
  • secure - Boolean Flag for using cookie over TLS/SSL (default "false")
  • signed - Boolean Will use the secret passed to cookieParser(secret) to sign the value (default "false")
  • encoding - String Type of output encoding by nodejs (default "hex")
  • extra - Array Extra info for Hmac ([true] to enable instead of Hash) and pbkdf2 ([salt, iterations, keylen]) (default "[ ]")

Examples

Take a look at my examples

License GPLv3

cookie-encryption's People

Contributors

hex7c0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.