encrypted-cookie
v0.1.8
Published
Simply use aes encrypted cookie
Downloads
214
Maintainers
Readme
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.
Built With
- 100% JavaScript
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
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
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)
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)
Browser Support
Native support
- Chrome
- Safari
- FireFox
License
Developed by
Karunaaharan Bavaram
Copyright
Copyright (c) 2022 Karunaaharan Bavaram
, contributors. Released under the MIT, GPL licenses