react-js-plugins 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -680,6 +680,11 @@ Checks if text would be truncated based on the character limit.
|
|
|
680
680
|
_isTruncate('This is a long text example', 10);
|
|
681
681
|
// Returns: true
|
|
682
682
|
```
|
|
683
|
+
### ✅ **_encryptJson**
|
|
684
|
+
Encrypts a JSON object using AES encryption with a secret key.
|
|
685
|
+
```ts
|
|
686
|
+
const encrypted = _encryptJson({ name: "John" }, "secret123");
|
|
687
|
+
```
|
|
683
688
|
|
|
684
689
|
### ✅ **_decryptJson**
|
|
685
690
|
Decrypts AES-encrypted JSON string using a secret key.
|
|
@@ -687,28 +692,48 @@ Decrypts AES-encrypted JSON string using a secret key.
|
|
|
687
692
|
const decrypted = _decryptJson(encryptedString, "secret123");
|
|
688
693
|
```
|
|
689
694
|
|
|
695
|
+
### ✅ **_encryptString**
|
|
696
|
+
Encrypts a plain string using AES encryption, with optional random IV.
|
|
697
|
+
```ts
|
|
698
|
+
const result = _encryptString("mySecretText", "secretKey");
|
|
699
|
+
```
|
|
700
|
+
|
|
690
701
|
### ✅ **_decryptString**
|
|
691
702
|
Decrypts an AES-encrypted string using the provided IV and secret key.
|
|
692
703
|
```ts
|
|
693
704
|
const plainText = _decryptString(ciphertext, iv, "secretKey");
|
|
694
705
|
```
|
|
695
706
|
|
|
696
|
-
### ✅ **
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
```
|
|
707
|
+
### ✅ **_encrypt**
|
|
708
|
+
|
|
709
|
+
Encrypts a full JSON payload using a **random key and IV**, both of which are **secured by a main secret key**.
|
|
710
|
+
This ensures that each encryption produces a unique ciphertext, even for the same input data.
|
|
701
711
|
|
|
702
|
-
### ✅ **_encryptPayload**
|
|
703
|
-
Encrypts a full payload using a randomly generated key and IV, secured by a static key.
|
|
704
712
|
```ts
|
|
705
|
-
const
|
|
713
|
+
const encryptedPayload = _encrypt({ userId: 101, role: "admin" }, "mainSecretKey");
|
|
714
|
+
|
|
715
|
+
/*
|
|
716
|
+
Returns:
|
|
717
|
+
{
|
|
718
|
+
data: "<AES-encrypted JSON payload>",
|
|
719
|
+
header: "<Encrypted random key & IV using mainSecretKey>",
|
|
720
|
+
iv: "<Base64 IV used for header encryption>"
|
|
721
|
+
}
|
|
722
|
+
*/
|
|
706
723
|
```
|
|
707
724
|
|
|
708
|
-
### ✅ **
|
|
709
|
-
|
|
725
|
+
### ✅ **_decrypt**
|
|
726
|
+
|
|
727
|
+
Securely decrypts a payload that was encrypted using `_encrypt`.
|
|
728
|
+
It first decrypts the header (which contains the AES key and IV), then uses those to decrypt the main payload.
|
|
729
|
+
|
|
710
730
|
```ts
|
|
711
|
-
const
|
|
731
|
+
const decryptedPayload = _decrypt(encryptedPayload, "mainSecretKey");
|
|
732
|
+
|
|
733
|
+
/*
|
|
734
|
+
Returns:
|
|
735
|
+
{ userId: 101, role: "admin" }
|
|
736
|
+
*/
|
|
712
737
|
```
|
|
713
738
|
|
|
714
739
|
### ✅ **_escapeHTML**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-js-plugins",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|