
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
A lightweight library for encrypting and decrypting data with strong cryptographic algorithms.
A utility class for asymmetric encryption using RSA. Provides functions for generating, storing, retrieving, encrypting, and decrypting data securely.
Utility class for decrypting AES-GCM encrypted data using a password-derived key.
Utility class for encrypting files using a combination of random per-file keys and a fixed secret key.
Provides AES-GCM encryption with PBKDF2 key derivation for strong security.
Provides methods for securely hashing passwords using PBKDF2, salt, and a pepper.
Class for generating secure keys and random passwords using strong cryptography.
Class for managing secure key storage, decryption, and retrieval. This class supports loading encrypted data, decrypting it, and storing it in memory for fast access.
This class provides advanced security utilities, including HMAC generation and verification, secure key generation using PBKDF2, random key and salt generation, and more.
A utility class for asymmetric encryption using RSA. Provides functions for generating, storing, retrieving, encrypting, and decrypting data securely.
Kind: global class
Objectcrypto.KeyObjectcrypto.KeyObjectBufferstringObjectGenerates an RSA key pair (public and private keys).
Kind: static method of AsimetricUtils
Returns: Object - An object containing the keys in PEM format.
Throws:
Error If key generation fails.| Param | Type | Description |
|---|---|---|
| keySize | number | The size of the RSA key in bits (recommended: 2048 or 4096). |
Example
// Generate a 2048-bit RSA key pair
const keys = AsimetricUtils.generateRSAKeyPair(2048);
console.log("Public Key:\n", keys.publicKey);
console.log("Private Key:\n", keys.privateKey);
Saves a public key to a file.
Kind: static method of AsimetricUtils
Throws:
Error If the file cannot be written.| Param | Type | Description |
|---|---|---|
| publicKey | string | The public key in PEM format. |
| filePath | string | The file path where the key should be saved. |
Example
const keys = AsimetricUtils.generateRSAKeyPair(2048);
AsimetricUtils.savePublicKey(keys.publicKey, './public.pem');
console.log("Public key saved successfully!");
crypto.KeyObjectLoads a public key from a file.
Kind: static method of AsimetricUtils
Returns: crypto.KeyObject - The loaded public key.
Throws:
Error If the file cannot be read.| Param | Type | Description |
|---|---|---|
| filePath | string | The path of the file containing the public key. |
Example
const publicKey = AsimetricUtils.loadPublicKey('./public.pem');
console.log("Loaded Public Key:\n", publicKey);
Saves a private key to a file.
Kind: static method of AsimetricUtils
Throws:
Error If the file cannot be written.| Param | Type | Description |
|---|---|---|
| privateKey | string | The private key in PEM format. |
| filePath | string | The file path where the key should be saved. |
Example
const keys = AsimetricUtils.generateRSAKeyPair(2048);
AsimetricUtils.savePrivateKey(keys.privateKey, './private.pem');
console.log("Private key saved successfully!");
crypto.KeyObjectLoads a private key from a file.
Kind: static method of AsimetricUtils
Returns: crypto.KeyObject - The loaded private key.
Throws:
Error If the file cannot be read.| Param | Type | Description |
|---|---|---|
| filePath | string | The path of the file containing the private key. |
Example
const privateKey = AsimetricUtils.loadPrivateKey('./private.pem');
console.log("Loaded Private Key:\n", privateKey);
BufferEncrypts a message using a public key.
Kind: static method of AsimetricUtils
Returns: Buffer - The encrypted message.
Throws:
Error If encryption fails.| Param | Type | Description |
|---|---|---|
| data | string | The plaintext message to encrypt. |
| publicKey | crypto.KeyObject | The public key used for encryption. |
Example
const publicKey = AsimetricUtils.loadPublicKey('./public.pem');
const encrypted = AsimetricUtils.encryptWithPublicKey("Hello, World!", publicKey);
console.log("Encrypted Data:", encrypted.toString('base64'));
stringDecrypts a message using a private key.
Kind: static method of AsimetricUtils
Returns: string - The decrypted message.
Throws:
Error If decryption fails.| Param | Type | Description |
|---|---|---|
| encryptedData | Buffer | The encrypted data. |
| privateKey | crypto.KeyObject | The private key used for decryption. |
Example
const privateKey = AsimetricUtils.loadPrivateKey('./private.pem');
const decrypted = AsimetricUtils.decryptWithPrivateKey(encryptedData, privateKey);
console.log("Decrypted Message:", decrypted);
Utility class for decrypting AES-GCM encrypted data using a password-derived key.
Kind: global class
string | undefinedNumber of PBKDF2 iterations for key derivation (higher = more secure but slower).
Kind: static property of Decryptor
Salt length in bytes (16 bytes = 128 bits, recommended for security).
Kind: static property of Decryptor
Key length in bytes (32 bytes = 256 bits, AES-256).
Kind: static property of Decryptor
Initialization Vector (IV) length in bytes (12 bytes is recommended for AES-GCM).
Kind: static property of Decryptor
Authentication Tag length in bytes (16 bytes ensures message integrity).
Kind: static property of Decryptor
string | undefinedDecrypts an AES-GCM encrypted message using a password.
Kind: static method of Decryptor
Returns: string | undefined - - The decrypted plaintext string, or undefined if decryption fails.
Throws:
Error If decryption fails.| Param | Type | Description |
|---|---|---|
| encryptedText | string | The Base64-encoded encrypted string (contains salt + IV + cipherText + authTag). |
| password | string | The password used to derive the decryption key. |
Example
const decrypted = Decryptor.decrypt(encryptedData, "my_secure_password");
console.log("Decrypted Text:", decrypted);
Utility class for encrypting files using a combination of random per-file keys and a fixed secret key.
Encrypts a plaintext file and saves it to a new location with obfuscation techniques applied.
Kind: static method of EncryptFile
Throws:
Error If file operations fail or encryption encounters an error.| Param | Type | Description |
|---|---|---|
| inputDecPath | string | Path to the plaintext input file. |
| outputEncPath | string | Path where the encrypted file will be saved. |
Example
EncryptFile.encryptFile("data.txt", "data.enc");
Provides AES-GCM encryption with PBKDF2 key derivation for strong security.
Kind: global class
Number of iterations for PBKDF2 (increases brute-force resistance). Higher values = more security but slower processing.
Kind: static property of Encryptor
Length of the salt in bytes (16 bytes = 128 bits). Salt ensures each encryption is unique, even with the same password.
Kind: static property of Encryptor
AES-256 key length in bytes (32 bytes = 256 bits). AES-256 requires a 32-byte key for maximum security.
Kind: static property of Encryptor
IV (Initialization Vector) length in bytes (12 bytes = recommended for GCM mode). IV ensures non-repeating ciphertext for the same input.
Kind: static property of Encryptor
Authentication Tag length in bytes (16 bytes = 128 bits). Ensures the integrity of the ciphertext and prevents tampering.
Kind: static property of Encryptor
stringEncrypts a plaintext string using AES-256-GCM with a password-derived key.
Kind: static method of Encryptor
Returns: string - - The encrypted text, encoded in Base64 (salt + IV + cipherText + authTag).
Throws:
Error - If encryption fails.| Param | Type | Description |
|---|---|---|
| plainText | string | The text to be encrypted. |
| password | string | The password used to derive the encryption key. |
Example
const encrypted = Encryptor.encrypt("Hello, world!", "my_secure_password");
console.log(encrypted); // Encrypted text in Base64 format
Provides methods for securely hashing passwords using PBKDF2, salt, and a pepper.
Kind: global class
stringstringbooleanbooleanstringbooleanBufferBufferstringGenerates a secure SHA-512 hash using PBKDF2, a random salt, and a secret pepper.
Kind: static method of HashingUtils
Returns: string - The Base64 encoded hash (salt$hash format).
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to hash. |
stringGenerates a secure SHA-256 hash using PBKDF2, a random salt, and a secret pepper.
Kind: static method of HashingUtils
Returns: string - The Base64 encoded hash (salt$hash format).
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to hash. |
booleanVerifies if a SHA-512 hash matches the plain text.
Kind: static method of HashingUtils
Returns: boolean - true if the hash matches, false otherwise.
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to check. |
| storedHash | string | The stored hash (salt$hash in Base64). |
booleanVerifies if a SHA-256 hash matches the plain text.
Kind: static method of HashingUtils
Returns: boolean - true if the hash matches, false otherwise.
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to check. |
| storedHash | string | The stored hash (salt$hash in Base64). |
stringGenerates a secure hash using PBKDF2 + Salt + Pepper.
Kind: static method of HashingUtils
Returns: string - The Base64 encoded hash (salt$hash format).
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to hash. |
| algorithm | "sha512" | "sha256" | The hashing algorithm to use. |
booleanVerifies if a hash corresponds to the plain text.
Kind: static method of HashingUtils
Returns: boolean - true if the hash matches, false otherwise.
| Param | Type | Description |
|---|---|---|
| input | string | The plain text to check. |
| storedHash | string | The stored hash (salt$hash in Base64). |
| algorithm | "sha512" | "sha256" | The hashing algorithm used. |
BufferDerives a key using PBKDF2 + Pepper.
Kind: static method of HashingUtils
Returns: Buffer - The derived hash.
| Param | Type | Description |
|---|---|---|
| input | string | The plain text. |
| salt | Buffer | The salt used in hashing. |
| algorithm | "sha512" | "sha256" | The hashing algorithm used. |
BufferGenerates a random salt.
Kind: static method of HashingUtils
Returns: Buffer - The random salt.
Class for generating secure keys and random passwords using strong cryptography.
Kind: global class
Promise.<Buffer>BufferstringPromise.<Buffer>Generates a secure AES key from a password and salt using PBKDF2 with HMAC-SHA-512.
Kind: static method of KeyGenerator
Returns: Promise.<Buffer> - A secure 256-bit (32-byte) derived key.
Throws:
Error If an error occurs during the key generation.| Param | Type | Description |
|---|---|---|
| password | string | The password used to generate the key. |
| salt | Buffer | The random salt used in the key derivation. |
BufferGenerates a random salt of fixed length.
Kind: static method of KeyGenerator
Returns: Buffer - A random 16-byte salt buffer.
stringGenerates a secure random password containing alphanumeric characters and special symbols.
Kind: static method of KeyGenerator
Returns: string - A securely generated random password.
Throws:
Error If the length is less than or equal to 0.| Param | Type | Description |
|---|---|---|
| length | number | The length of the generated password (minimum 1). |
Class for managing secure key storage, decryption, and retrieval. This class supports loading encrypted data, decrypting it, and storing it in memory for fast access.
Kind: global class
Promise.<void>string | undefinedanystring | nullstring | nullPromise.<void>Initializes the class by loading and decrypting the content of an encrypted file.
Kind: static method of SecureKeys
Returns: Promise.<void> - Resolves when the file is loaded and decrypted successfully.
Throws:
Error If an error occurs during file reading or decryption.| Param | Type | Description |
|---|---|---|
| encFilePath | string | The path to the encrypted .enc file. |
Parses the decrypted content and stores it in a key-value map. Only processes lines that match the format: "| key -> value".
Kind: static method of SecureKeys
string | undefinedDecrypts a given encrypted text using AES-GCM with a key derived from PBKDF2.
Kind: static method of SecureKeys
Returns: string | undefined - The decrypted text or undefined if an error occurs.
Throws:
Error If decryption fails.| Param | Type | Description |
|---|---|---|
| encryptedText | string | The encrypted text in Base64. |
| password | string | The password used to derive the decryption key. |
anyRetrieves the value associated with a key from the in-memory key-value map.
Kind: static method of SecureKeys
Returns: any - The associated value, or null if the key does not exist.
| Param | Type | Description |
|---|---|---|
| keyName | string | The name of the key to retrieve. |
string | nullExtracts the encrypted key from the encrypted file content.
Kind: static method of SecureKeys
Returns: string | null - The encrypted key in Base64 format, or null if not found.
| Param | Type | Description |
|---|---|---|
| content | string | The content of the encrypted file. |
string | nullExtracts the encrypted data from the encrypted file content.
Kind: static method of SecureKeys
Returns: string | null - The encrypted data in Base64 format, or null if not found.
| Param | Type | Description |
|---|---|---|
| content | string | The content of the encrypted file. |
This class provides advanced security utilities, including HMAC generation and verification, secure key generation using PBKDF2, random key and salt generation, and more.
Kind: global class
string | undefinedbooleanstring | undefinedstringBufferstring | undefinedGenerates an HMAC (Hashed Message Authentication Code) using SHA-512 with a secret key.
Kind: static method of SecurityUtils
Returns: string | undefined - The generated HMAC in Base64 format, or undefined if an error occurs.
Throws:
Error If there is an error during HMAC generation.| Param | Type | Description |
|---|---|---|
| message | string | The message to authenticate. |
| secretKey | string | The secret key used to generate the HMAC. |
booleanVerifies if a given HMAC is valid by comparing it with the computed HMAC for the message.
Kind: static method of SecurityUtils
Returns: boolean - Returns true if the HMAC is valid, false otherwise.
| Param | Type | Description |
|---|---|---|
| message | string | The original message. |
| secretKey | string | The secret key used to generate the HMAC. |
| receivedHMAC | string | The received HMAC to verify. |
string | undefinedGenerates a secure secret key using PBKDF2 with HMAC-SHA-512.
Kind: static method of SecurityUtils
Returns: string | undefined - A secure secret key in Base64 format, or undefined if an error occurs.
Throws:
Error If there is an error during key generation.| Param | Type | Description |
|---|---|---|
| password | string | The base password to derive the key. |
| salt | Buffer | A random value to strengthen the key. |
stringGenerates a secure random secret key.
Kind: static method of SecurityUtils
Returns: string - A random secret key in Base64 format.
BufferGenerates a secure random salt.
Kind: static method of SecurityUtils
Returns: Buffer - A random salt in bytes (256 bits).
FAQs
A lightweight library for encrypting and decrypting data with strong cryptographic algorithms.
The npm package cryptix receives a total of 3 weekly downloads. As such, cryptix popularity was classified as not popular.
We found that cryptix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.