test-cryptex-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Secure Encryption SDK

Overview

The Secure Encryption SDK provides an easy-to-use encryption and decryption system for securely storing and managing user data. This SDK ensures data confidentiality by using a central key, a master key, and automatically rotating user-specific encryption keys.

Features

  • Secure Data Encryption: Encrypts user data with unique encryption keys.
  • Automatic Key Rotation: Enhances security by periodically rotating encryption keys.
  • Master Key Recovery: Allows data recovery in case of lost encryption keys.
  • Lightweight & Fast: Optimized for performance and security.

Installation

You can install the SDK using npm or yarn:

npm install secure-encryption-sdk

or

yarn add secure-encryption-sdk

Usage

Importing the SDK

const { encryptData, decryptData } = require('secure-encryption-sdk');

Encrypting Data

const centralKey = process.env.CENTRAL_KEY;
const masterKey = process.env.MASTER_KEY;
const userData = "Sensitive Information";

const { encryptedData, userKey } = encryptData(userData, centralKey, masterKey);
console.log("Encrypted Data:", encryptedData);
console.log("User Key:", userKey);

Decrypting Data

const decryptedData = decryptData(encryptedData, userKey, centralKey, masterKey);
console.log("Decrypted Data:", decryptedData);

Key Rotation

To enhance security, the SDK automatically rotates encryption keys upon decryption:

const { newEncryptedData, newUserKey, decryptedData } = decryptData(encryptedData, userKey, centralKey, masterKey, true);
console.log("New Encrypted Data:", newEncryptedData);
console.log("New User Key:", newUserKey);
console.log("Decrypted Data:", decryptedData);

Environment Variables

Ensure you set the following environment variables:

CENTRAL_KEY=<your-central-key>
MASTER_KEY=<your-master-key>

Security Best Practices

  • Store CENTRAL_KEY and MASTER_KEY securely (e.g., in environment variables or a vault).
  • Rotate keys periodically to maintain security.
  • Do not expose user encryption keys in logs or UI.

License

This SDK is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i test-cryptex-js

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

39.3 kB

Total Files

23

Last publish

Collaborators

  • onyemap