Getting Started
Integrate enterprise-grade encryption and storage optimization in seconds.
Installation
Install the StickCode engine via NPM. The package includes all necessary binaries for cross-platform support.
npm install stickcode
Flexible Processing Modes
Version 5.2 introduces a dual-mode system, allowing developers to balance between maximum security and maximum storage efficiency.
1. Secure Mode
Full AES-256-GCM encryption with randomized junk injection. Ideal for PII and sensitive JSON. This is the default behavior.
StickCode.encrypt(data);
2. Optimized Mode
Compression and mapping only. Best for data already hashed (MD5/SHA) to minimize DB bloat.
// Compression Only
StickCode.encrypt(data, true);
Quick Start
Initialize the engine once and handle different data types accordingly:
// Initialize const StickCode = require('stickcode'); await StickCode.init("YOUR_LICENSE_KEY"); // Scenario A: Encrypting PII (Full Security) const pii = StickCode.encrypt("User Credit Card"); // Scenario B: Compressing MD5/Hashes (Optimization Only) // Since hashes are already secure, we only use the mapping layer to save space. const md5Hash = "7fef61729296f4dd3397d10019217c09"; const optimized = StickCode.encrypt(md5Hash, true); // Both modes are decrypted automatically const originalHash = StickCode.decrypt(optimized);
💾 Storage & Networking
To maintain maximum compression and avoid data corruption, always handle the output as **Binary**:
-
1. Saving to Disk
Save the buffer directly to a
.binfile to keep it compact.fs.writeFileSync('data.bin', encrypted); -
2. Uploading to Server
Send the data as a binary stream (octet-stream) to prevent size inflation.
await axios.post(url, encrypted, { headers: { 'Content-Type': 'application/octet-stream' } }); -
3. Database Storage
To keep data compressed, use Buffer/Binary types instead of Strings.
MongoDB (Mongoose):
const userSchema = new Schema({ encryptedData: Buffer // Saves exactly as binary });PostgreSQL (Sequelize):
const Secret = sequelize.define('Secret', { payload: DataTypes.BLOB // Binary Large Object });