> For the complete documentation index, see [llms.txt](https://docs.navigaglobal.com/dashboard-plugin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.navigaglobal.com/dashboard-plugin/api-and-gui/api/encrypt.md).

# encrypt

Encrypt data with Dashboard encryption api.

{% hint style="info" %}
encrypt method returns a promise, which **resolves** when Dashboard successfully encrypted your payload and **rejects** if missing requirements or if something went wrong with Dashboard encryption api.
{% endhint %}

## How to use

```jsx
import { Plugin } from '@root'

Plugin.encrypt({
    ...ENCRYPT_PARAMS
}).then(data).catch(error)
```

## Encrypt params

| Param        | Typeof | Default | Required | Description                                          |
| ------------ | ------ | ------- | :------: | ---------------------------------------------------- |
| **payload**  | String | null    |     ✅    | the data that you want Dashboard to encrypt for you. |
| **password** | String | null    |     ✅    | the encryption password to use to encrypt your data. |

## Encrypt custom payload

```jsx
import { Plugin } from '@root'

const dataToEncrypt = {
    username: 'Dashboard user',
    secretId: 'supper-secret-id'
}

Plugin.encrypt({
    payload: JSON.stringify(dataToEncrypt),
    password: 'my-super-secret-password'
}).then(encryptedData => {
    console.log(encryptedData)
}).catch(error => {
    console.error(error)
})
```
