Crypto

The 'crypto' module provides encryption/decryption functionality using OpenSSL

Function Signatures

// Object containing functions related to EVP (Envelope)
const evp = {
    // Generates a key of specified size (default: 32)
    generate_key: (size: Number = 32) => String,
    // Encrypts a string using the provided key
    encrypt: (str: String, key: String) => String,
    // Decrypts a string using the provided key
    decrypt: (str: String, key: String) => String,
}

// Object containing functions related to RSA (Rivest–Shamir–Adleman)
const rsa = {
    // Generates a pair of RSA keys of specified size (default: 2048)
    generate_pair: (size: Number = 2048) => {
        private: String,
        public: String
    },
    // Encrypts a string using the provided RSA key
    encrypt: (str: String, key: String) => String,
    // Decrypts a string using the provided RSA key
    decrypt: (str: String, key: String) => String,
}

Last updated