1.0.3 • Published 10 months ago

miko-basic-json-encryption v1.0.3

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Sure! Below is the README.md file for the custom JSON encryption npm package:

# Custom JSON Encryption

A simple npm package for custom JSON encryption and decryption.

## Installation

You can install the package using npm:

```bash
npm install miko-basic-json-encryption
```

Usage

import { CustomJSONEncryptor } from "miko-basic-json-encryption";

// Create an instance of CustomJSONEncryptor with the encryption key
const encryptionKey = "your_secret_key";
const customEncryptor = new CustomJSONEncryptor(encryptionKey);

// Example JSON object to encrypt
const originalData = { name: "John Doe", age: 30, email: "john@example.com" };

// Encrypt the JSON object
const encryptedJSON = customEncryptor.encryptJSON(originalData);
console.log("Encrypted JSON:", encryptedJSON);

// Decrypt the encrypted data
const decryptedData = customEncryptor.decryptJSON(encryptedJSON);
console.log("Decrypted Data:", decryptedData);

API

generateRandomKey(length: number): string

Generates a random key of the specified length.

  • length: The length of the key to generate.
  • Returns: A random key as a string.

customEncryptJSON(jsonObj: any, key: string): string

Encrypts a JSON object using the custom encryption algorithm.

  • jsonObj: The JSON object to be encrypted.
  • key: The encryption key as a string.
  • Returns: The encrypted data as a string.

customDecryptJSON(encryptedData: string, key: string): any

Decrypts the encrypted data using the custom encryption algorithm.

  • encryptedData: The encrypted data to be decrypted.
  • key: The encryption key as a string.
  • Returns: The decrypted JSON object.

Security Considerations

Please note that this custom encryption algorithm may not provide the same level of security as established encryption algorithms like AES. It is recommended to use well-vetted and widely-used encryption libraries for critical applications.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Make sure to save this content as "README.md" in the root directory of your npm package. This README file will provide an overview of your package, installation instructions, usage examples, and API documentation for the users of your npm package.
1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago