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

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