Encryption

Collection of encryption functions.

Methods

encrypt

encrypt(text: string, key: string)

Encrypts a string using the AES algorithm. Returns a base64 encoded string. The result is not deterministic.

Parameters

text string

The text to encrypt.

key string

The encryption key.

Return type

string

Examples

// Encrypts a string using the AES algorithm:
Encryption.encrypt('my secret text', 'my secret key')

decrypt

decrypt(text: string, key: string)

Decrypts a string using the AES algorithm.

Parameters

text string

The text to decrypt.

key string

The encryption key.

Return type

string

Examples

// Decrypts a string using the AES algorithm:
Encryption.decrypt('my encrypted text', 'my secret key')