Generate Secrets

These actions provide ability to encrypt, decrypt and hash data, as well as validate and generate tokens and certificates.

Generate Secrets Actions

All actions of this handler share the following event metadata parameters for getting key inputs:

Parameter
Definition
Example
Default

Key

Constant key to use for operations

1234567890ABC

-

Key Path

Json path of key in event payload

parameters.key

-

Key Id

ID of the key to use from key state

123

-

Key Id Path

Json path of key id to use from key state

parameters.id

-

Encrypt

Encrypts a given json node or string value using preferred algorithms. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the input in request event payload

data

-

Output Element

Json path for the output in response event payload

secret

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Algorithm

Custom cipher algorithm to use

-

Handler default

Key Algorithm

Custom SecretKey algorithm to use

-

Handler default

Provider

Custom security provider to use

-

Handler default

Decrypt

Decryptes a previously encrypted value and returns as a json node or string value. This action uses the same fields as Encrypt action, with the addition of following event metadata parameter:

Parameter
Definition
Example
Default

Is Json

Whether encrypted value is json and should be parsed into an object

true

false

Hash

Hashes a given json node or string value using preferred algorithms. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the input in request event payload

data

-

Output Element

Json path for the output in response event payload

secret

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Algorithm

Custom hash algorithm to use

-

Handler default

Provider

Custom security provider to use

-

Handler default

Iterations

Iterations to update the hash

100

1

circle-info

Hash actions can be used to generate secure API keys, when used together with JmesPath salt_key action that creates secure random key. These keys can be stored with access.roles details for key based authentication.

ValidateHash

Validates the hash of a given json node or string value using preferred algorithms. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the input in request event payload, with "hash" and "data" elements

parameters

-

Output Element

Json path for the output in response event payload

secret

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Algorithm

Custom hash algorithm to use

-

Handler default

Provider

Custom security provider to use

-

Handler default

Iterations

Iterations to update the hash

100

1

GenerateToken

Generates a JWT token for given claims (including special claims such as audience). Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the fields to include as claims in token

parameters

-

Output Element

Json path to add token at

secret

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Provider

Custom security provider to use

-

Handler default

Expiration Time

Milliseconds to expiration of token

60000

0

ValidateToken

Validates a JWT token. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the token

parameters.token

-

Output Element

Json path to add validation result to

isValid

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Provider

Custom security provider to use

-

Handler default

Input Pattern

Jmespath expression to apply on input element

-

-

DecodeToken

Decodes a JWT token and returns its claims. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for the token

parameters.token

-

Output Element

Json path to add decoded claims to

claims

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Provider

Custom security provider to use

-

Handler default

Input Pattern

Jmespath expression to apply on input element

-

-

Validate

Whether the token must be valid to decode

false

true

GenerateCertificate

Generates a certificate, returning private key and public certificate values. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

Input Element

Json path for custom certificate DN and lifetime

parameters.cert

-

Output Element

Json path to add "key" and "certificate" outputs to

produced

-

With event metadata parameters as:

Parameter
Definition
Example
Default

Provider

Custom security provider to use

-

Handler default

Certificate Algorithm

Custom certificate algorithm

-

Handler default

Certificate SignatureAlgorithm

Custom signature algorithm

-

Handler default

Certificate Key Size

Custom key size

-

Handler default

Certificate DN

Custom certificate DN

-

Handler default

Certificate Life Time

Custom certificate lifetime in days

-

Handler default

Last updated