Skip to content

Commit 0880917

Browse files
committed
update readme and file
1 parent 3aaf2e7 commit 0880917

12 files changed

+89
-50
lines changed

.idea/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/js-cookie-encrypt.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
# Encrypt-cookiejs (Protected by Secret Key)
1+
# JS-cookie-encrypt (Protected by Secret Key)
22

3-
**Encrypt-cookiejs** encrypt-cookiejs is a lightweight JavaScript package designed to securely manage data in browser cookies using advanced encryption techniques. This package ensures that sensitive data stored in cookies is encrypted, providing a higher level of security for client-side storage. It allows for flexible and customizable cookie management with support for various cookie attributes such as path, domain, expires, sameSite, and secure.
3+
**JS-cookie-encrypt** is a lightweight JavaScript package designed to securely manage data in browser cookies using advanced encryption techniques. This package ensures that sensitive data stored in cookies is encrypted, providing a higher level of security for client-side storage. It allows for flexible and customizable cookie management with support for various cookie attributes such as path, domain, expires, sameSite, and secure.
44

5+
Your cookie data will be securely stored in an encrypted format, ensuring that sensitive information remains protected and accessible only to you.
6+
7+
## Protecting Your Cookie Data
8+
9+
Your Cookie Will be some thing like this only you can read / access it.
10+
```Cookie
11+
UHzDpCrDicOQd1XCssKMw5F0w60OLsK3WDvDqTnDgcOBBQ7Do8Kew4R/w6oGMcKzSznDpjTCjMOCRlzCqMKSwoQ3wr0DM8K0TDvCvXrDiMOMRl/CoMOdwoo5w7oHPMK7TzvCvXrDjcOGQVXCqcKWw4tbw7gHPMK7TzfDpDfDgcKGWg==
12+
```
513

614
## Key Features
715

816
- 🔐 Built-in encryption support
917
- 📦 Type-safe cookie storage
1018
- 🛣️ Nested path operations
11-
- 🎯 Batch operations support
1219
- 🔄 Automatic serialization/deserialization
1320
- 🌐 Cross-browser compatibility
1421
- 🔧 Configurable options
@@ -29,19 +36,19 @@
2936
## Installation
3037

3138
```bash
32-
npm install encrypt-cookiejs
39+
npm install js-cookie-encrypt
3340
# or
34-
yarn add encrypt-cookiejs
41+
yarn add js-cookie-encrypt
3542
# or
36-
pnpm add encrypt-cookiejs
43+
pnpm add js-cookie-encrypt
3744
```
3845

3946
## Basic Usage
4047

4148
### 1. Define Your Data Structure (Creating an Instance)
4249

4350
```bash
44-
import EncryptCookie from 'encrypt-cookiejs'
51+
import JsCookieEncrypt from 'js-cookie-encrypt'
4552

4653
// Configuration for encryption and cookie handling
4754
const config = {
@@ -52,8 +59,8 @@ const config = {
5259
}
5360
}
5461

55-
// Create a new instance of EncryptCookie
56-
const cookie = new EncryptCookie(config);
62+
// Create a new instance of JsCookieEncrypt
63+
const cookie = new JsCookieEncrypt(config);
5764
```
5865

5966
```bash
@@ -104,7 +111,7 @@ cookie.clear();
104111
### Use Path
105112
```bash
106113
// Initialize the cookie manager
107-
const cookie = new EncryptCookie({ storageKey: 'myAppData' });
114+
const cookie = new JsCookieEncrypt({ storageKey: 'myAppData' });
108115

109116
// Set some initial data
110117
cookie.set({ user: { name: 'John Doe', address: { city: 'Los Angeles' } } });
@@ -168,12 +175,12 @@ If a domain is specified, it will return only the cookies associated with that d
168175
169176
```base
170177
// Retrieve all cookies
171-
const allCookies = EncryptCookie.getAllCookies();
178+
const allCookies = JsCookieEncrypt.getAllCookies();
172179
console.log(allCookies);
173180
// Output: { "cookie1": "value1", "cookie2": "value2", ... }
174181

175182
// Retrieve cookies specific to a domain
176-
const domainCookies = EncryptCookie.getAllCookies('example.com');
183+
const domainCookies = JsCookieEncrypt.getAllCookies('example.com');
177184
console.log(domainCookies);
178185
// Output: { "cookie1": "value1", "cookie2": "value2", ... } for cookies on example.com
179186

@@ -189,13 +196,13 @@ path (default: /): The path for the cookies. The default is /, which clears cook
189196
190197
```base
191198
// Clear all cookies for the current domain
192-
EncryptCookie.clearAll();
199+
JsCookieEncrypt.clearAll();
193200

194201
// Clear all cookies for a specific domain
195-
EncryptCookie.clearAll('example.com');
202+
JsCookieEncrypt.clearAll('example.com');
196203

197204
// Clear all cookies for a specific domain and path
198-
EncryptCookie.clearAll('example.com', '/specific-path');
205+
JsCookieEncrypt.clearAll('example.com', '/specific-path');
199206

200207
```
201208

dist/encrypt-cookie.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/encrypt-cookie.d.ts renamed to dist/js-cookie-encrypt.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! encrypt-cookiejs v1.0.2 | MIT (c) 2024 Abdullah Al Fahim | https://github.com/abfahimb/encrypt-cookieJS */
1+
/*! js-cookie-encrypt v1.0.2 | MIT (c) 2024 Abdullah Al Fahim | https://github.com/abfahimb/js-cookie-encrypt */
22
export interface CookieOptions {
33
path?: string;
44
expires?: number | Date;
@@ -19,7 +19,7 @@ export interface StorageConfig {
1919
}
2020
type PathImpl<T, K extends keyof T> = K extends string ? T[K] extends Record<string, any> ? T[K] extends ArrayLike<any> ? K | `${K}.${PathImpl<T[K], Exclude<keyof T[K], keyof any[]>>}` : K | `${K}.${PathImpl<T[K], keyof T[K]>}` : K : never;
2121
type Path<T> = PathImpl<T, keyof T> | keyof T;
22-
export declare class EncryptCookie<T extends Record<string, any>> {
22+
export declare class JsCookieEncrypt<T extends Record<string, any>> {
2323
private storageKey;
2424
private crypto;
2525
private defaultOptions;
@@ -43,4 +43,4 @@ export declare class EncryptCookie<T extends Record<string, any>> {
4343
clear(options?: CookieOptions): void;
4444
private appendCookieOptions;
4545
}
46-
export default EncryptCookie;
46+
export default JsCookieEncrypt;

dist/encrypt-cookie.js renamed to dist/js-cookie-encrypt.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)