api/utils/utils

Module for some common utility functions that needs to be separated from module:api/utils/common either due to circular references or other reasons

Source:

Methods

(static) decrypt(crypted, keyopt, ivopt, algorithmopt, input_encodingopt, output_encodingopt) → {string}

Source:

Decrypt provided value

Parameters:
Name Type Attributes Description
crypted string

value to decrypt

key string <optional>

key used for encryption and decryption

iv string <optional>

initialization vector used in encryption

algorithm string <optional>

name of the algorithm used in encryption. The algorithm is dependent on OpenSSL, examples are 'aes192', etc. On recent OpenSSL releases, openssl list-cipher-algorithms will display the available cipher algorithms. Default value is aes-256-cbc

input_encoding string <optional>

how decryption input is encoded. Default hex.

output_encoding string <optional>

how decryption output is encoded. Default utf-8.

Returns:

decrypted value

Type
string

(static) encrypt(text, keyopt, ivopt, algorithmopt, input_encodingopt, output_encodingopt) → {string}

Source:

Encrypt provided value

Parameters:
Name Type Attributes Description
text string

value to encrypt

key string <optional>

key used for encryption and decryption

iv string <optional>

initialization vector to make encryption more secure

algorithm string <optional>

name of the algorithm to use for encryption. The algorithm is dependent on OpenSSL, examples are 'aes192', etc. On recent OpenSSL releases, openssl list-cipher-algorithms will display the available cipher algorithms. Default value is aes-256-cbc

input_encoding string <optional>

how encryption input is encoded. Used as output for decrypting. Default utf-8.

output_encoding string <optional>

how encryption output is encoded. Used as input for decrypting. Default hex.

Returns:

encrypted value

Type
string