ByteLock is a lightweight utility for encrypting and decrypting messages using a simple cipher key generated from two unique IDs.
- 🔑 Generate a cipher key from sender and receiver IDs
- 🔒 Encrypt messages
- 🔓 Decrypt messages
Import and use the ByteLock class:
import ByteLock from 'bytelock';Generates a numeric key from two string IDs (Best use-case: MongoDB ObjectIds).
const sender_id = '66abe1cc11f58bf19a8dcef7';
const receiver_id = '66b1097c4ede2430559fa193';
const key = ByteLock.generateCipherKey(sender_id, receiver_id);
console.log(key); // 32Encrypts a plain text message using the provided key.
const encrypted = ByteLock.cipherMessage('Hello!', key);
console.log(encrypted); // 140f80c80c80580860Decrypts an encrypted message using the same key.
const original = ByteLock.decipherMessage(encrypted, key);
console.log(original); // Hello!- Only ASCII/ANSI characters (32–255) are encrypted.
- Encryption is reversible only with the same key.
- Not designed for production-grade security.
@akindejuh