StegCloak can be used as a module in your JavaScript applications. It uses a functional style and supports AES-256-CTR encryption and HMAC integrity checks.
Initialization
Initialize the instance by passing boolean flags for encryption and integrity. These flags determine how the hide method behaves.
const StegCloak = require('stegcloak');
// Initializes with encryption true and hmac false for hiding
const stegcloak = new StegCloak(true, false);
Note: You can change stegcloak.encrypt and stegcloak.integrity booleans later to modify behavior.
Hiding a secret
Use stegcloak.hide(secret, password, cover) to return a string containing the cover text with the secret embedded invisibly.
const magic = stegcloak.hide("Voldemort is back", "mischief managed", "The WiFi's not working here!");
console.log(magic); // Output: The WiFi's not working here!
Revealing a secret
Use stegcloak.reveal(data, password) to extract the secret. The method automatically detects if encryption or integrity checks were used during the hiding process.
const secret = stegcloak.reveal(magic, "mischief managed");
console.log(secret); // Output: Voldemort is back
const StegCloak = require('stegcloak');
const stegcloak = new StegCloak(true, false);
const magic = stegcloak.hide("Voldemort is back", "mischief managed", "The WiFi's not working here!");
const secret = stegcloak.reveal(magic, "mischief managed");
console.log(secret); // Voldemort is back