> For the complete documentation index, see [llms.txt](https://docs.rulecube.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rulecube.com/v2.5/language-reference/encryption-deprecated.md).

# Encryption (deprecated)

> <mark style="color:red;">Encryption.encrypt() and Encryption.decrypt() are deprecated.</mark>&#x20;
>
> <mark style="color:red;">Use the Crypto library instead.</mark>

Collection of encryption functions.

## Methods

### encrypt (deprecated)

```javascript
encrypt(text: string, key: string)
```

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

#### Parameters

&#x20;   **text&#x20;*****string***

&#x20;       The text to encrypt.

&#x20;   **key&#x20;*****string***

&#x20;       The encryption key.

#### Return type

&#x20;   string

#### Examples

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

### decrypt (deprecated)

```javascript
decrypt(text: string, key: string)
```

Decrypts a string using the AES algorithm.

#### Parameters

&#x20;   **text&#x20;*****string***

&#x20;       The text to decrypt.

&#x20;   **key&#x20;*****string***

&#x20;       The encryption key.

#### Return type

&#x20;   string

#### Examples

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rulecube.com/v2.5/language-reference/encryption-deprecated.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
