Encryption (deprecated)

Encryption.encrypt() and Encryption.decrypt() are deprecated.

Use the Crypto library instead.

Collection of encryption functions.

Methods

encrypt (deprecated)

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 (deprecated)

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')

Last updated