encrypt

Encrypt data with Dashboard encryption api.

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.

How to use

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

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

Last updated