Skip to main content
Version: 4.64

encrypt

Encrypts a value with the given algorithm and key. The result will contain "data" and "iv".

Field Configurations​

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters​

KeyTypeDescriptionDefault Value
"algorithm" (required)StringThe algorithm to use for this encryption.null
"async"BooleanSpecifies whether the action should perform asynchronously.null
"input" (required)StringThe input to encrypt.null
"inputEncoding" (required)StringThe encoding of the input.null
"key" (required)StringThe key to use for this encryption.null
"keyEncoding"StringThe encoding of the key.null
"onError"StringEvent that will be fired if the encryption was successfull.null
"onErrorType"OnErrorTypeType of event that will be fired on error.null
"onSuccess"StringEvent that will be fired if the encryption was successfull.null
"onSuccessType"OnSuccessTypeType of event that will be fired on success.null
"outputEncoding"StringThe encoding for the output.null
"useDefaultSalt"BooleanDetermines if the default key salt should be used for the key. If not, the key must be a valid AES key.null

Inherited​

From Base Action

Base Action

Field Configurations

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params"Object,ArrayObject containing the properties of the action.null
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type"StringType name of the action.null

Examples​

Example 1: Encrypt text with a password​

Show ExampleHide Example

Goal: Encrypt text, like a JWT, with a password to savely store it.

Enrypt the given text using the password. On success, the encrypted text is stored base64 encoded in encryptedData.data and the IV is stored base64 encoded in encryptedData.iv.

{
"type": "encrypt",
"leadingDelimiter": "{$",
"trailingDelimiter": "$}",
"dynamicParams": {
"jwt": {
"context": "variable",
"field": "jwt"
},
"password": {
"context": "namedForm",
"field": "login:password"
}
},
"params": {
"algorithm": "AES",
"input": "{$jwt$}",
"key": "${password$}",
"inputEncoding": "utf8",
"keyEncoding": "utf8",
"useDefaultSalt": true,
"outputEncoding": "base64",
"onSuccessType": "return",
"onSuccess": "encryptedData"
}
}