Skip to content

Latest commit

 

History

History
181 lines (129 loc) · 6.04 KB

README.md

File metadata and controls

181 lines (129 loc) · 6.04 KB

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

encrypted-cookie

Simply use aes encrypted cookie
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About Project
  2. Built With
  3. Features
  4. Installation
  5. Usages
  6. Note
  7. Browser Support
  8. License

About Project

This is fully secure cookies with AES Encryption. You can store encrypted cookie. This is specially you can use unlimited length key and store unlimited length of string value in cookie. Encrypt Json array also storable. It's have default key value and you can change own key value to store.

(back to top)

Built With

(back to top)

Features

  • AES-unlimited encryption cookie service without key
  • AES-unlimited decryption cookie service without key
  • AES-unlimited encryption cookie service with key
  • AES-unlimited decryption cookie service with key
  • Store json array in cookie (Normally other cookie packages not support to store json array)
  • Set expire days
  • well secure AES Encryption
  • You can erase manually with erase function

(back to top)

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

Installation is done using the npm install command:

Using npm:

$ npm i encrypted-cookie

Using yarn:

$ yarn add encrypted-cookie

(back to top)

Usage

import CookieService from "encrypted-cookie";

//WithoutKey

CookieService.setCookie("userName", "Bavaram", 7); //set Cookie  (key,value,expire_days)
CookieService.getCookie("userName"); //get Cookie (key)
CookieService.setArrayCookie("userDetails", [{name:"bavaram",age:"23"}], 7);  //(key,jsonArray,expire_days)
CookieService.getArrayCookie("userDetails"); //get json array cookie (key)
CookieService.checkCookie("userDetails"); //Check cookie name available ,respones will be comes with boolean (key)
CookieService.eraseCookie("userDetails"); //erase set Cookie (key)

//WithKey
// Note: secretKey can be unlimited letters

CookieService.setCookie("userName", "Bavaram", 7,"passKey"); //set Cookie with encrypted key (key,value,expire_days,encrypt_Key)
CookieService.getCookie("userName","passKey"); //get Cookie with encrypted key (key,encrypt_Key)
CookieService.setArrayCookie("userDetails", [{name:"bavaram",age:"23"}], 7,"passKey"); //(key,jsonArray,expire_days,encrypt_Key)
CookieService.getArrayCookie("userDetails","passKey"); //(key,encrypt_Key)
CookieService.checkCookie("userDetails","passKey"); //Check cookie name available ,respones will be comes with boolean (key,encrypt_Key)
CookieService.eraseCookie("userDetails","passKey"); //erase set Cookie (key,encrypt_Key)

 

(back to top)

Note

CookieService.checkCookie() //=>returns boolean value 
// (If encrypted key is wrong => False)
// (cookie is not available   => False)

CookieService.eraseCookie()
// (If encrypted key is wrong  =>nothing happen)

(back to top)

Browser Support

Native support

  • Chrome
  • Safari
  • FireFox

(back to top)

License

MIT

Developed by Karunaaharan Bavaram

(back to top)

Copyright

Copyright (c) 2022 Karunaaharan Bavaram, contributors. Released under the MIT, GPL licenses

(back to top)