Encrypt Data
Encrypts data with AES-256-GCM (random IV, authenticated).
Encrypts any JSON value with AES-256-GCM and returns a versioned token v1.<iv>.<tag>.<ciphertext> (base64url). The key comes from an encryption-key credential (connection_id) or, discouraged, from a literal key.
How it works
- Resolves the config. A pure expression such as
{{ $json.payment }}indatakeeps the value type; mixed text always yields a string. - Leaves through
errorwithdata is requiredwhendatais undefined, null or an empty string. - Picks the key:
connection_idfirst, otherwise the literalkey. With neither, the node leaves througherror. - Wraps the value as
{ "v": data }, encrypts it with a random 12-byte IV and joins version, IV, authentication tag and ciphertext with dots. - Returns
{ encrypted, algorithm }onout, with a secret-free audit record inmeta.cryptoand literal-key warnings inmeta.warnings.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-encrypt-payment",
"label": "Encrypt payment details",
"operator_slug": "crypto.encrypt",
"operator_version": "2.0.0",
"config": {
"connection_id": "pi-credential-xxxx",
"data": "{{ $json.payment }}"
}
}{
"ok": true,
"port": "out",
"data": {
"encrypted": "v1.sEZVicEyZQ3qzFNu.L_Y2ciTg_ZoET8aUKmDTuw.SRzvsE_YNuaJMYT7_OF3xFIwECFqgqkxBnj3iyY",
"algorithm": "aes-256-gcm"
},
"meta": {
"crypto": {
"op": "encrypt",
"key_source": "credential",
"alias": "connection",
"credential_id": "pi-credential-xxxx",
"algorithm": "aes-256-gcm",
"ok": true
},
"warnings": []
}
}Configuration
-
connection_idstring Optional -
Sommatic AI credential resolved server-side (recommended). Accepts credentials of type `encryption-key`.
-
keystring Optional -
Encryption key (64 hex chars, base64 of 32 bytes, or a passphrase) as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id.
-
dataany Required -
Data to encrypt (any JSON value)
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
connection_id - Takes precedence over the literal
key. The credential is resolved on the server when the node runs, so the secret never appears in the flow. A string secret is used as the key; an object secret must carrykeyorsecret. -
key - Used only when
connection_idis empty. Accepts 64 hexadecimal characters, base64 of 32 bytes, or any other text as a passphrase. Literal keys work, but they are stored in the flow, its version history and Git, andmeta.warningsreports them. -
data - Any JSON value. Objects, arrays, numbers and booleans come back with their type from
crypto.decrypt.
Output ports
out default The value was encrypted.
{
"encrypted": "v1.sEZVicEyZQ3qzFNu.L_Y2ciTg_ZoET8aUKmDTuw.SRzvsE_YNuaJMYT7_OF3xFIwECFqgqkxBnj3iyY",
"algorithm": "aes-256-gcm"
}error data is missing, no key is configured, or the credential cannot be resolved or has no usable key.
{
"error": "data is required"
}In expressions
What a later node can read from this node's output with $("Encrypt Data").item.json.<path> (write your node's label instead of Encrypt Data). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Encrypt Data").item.json.encryptedv1.<iv>.<tag>.<ciphertext> (base64url) | ||
$("Encrypt Data").item.json.algorithm |
Errors
| Message | Port | Cause and fix |
|---|---|---|
data is required | error | data is empty or its expression resolved to nothing. 0 and false are valid values. |
A key is required: pass { credential: "<alias>" } (recommended) or { key } | error | Neither connection_id nor the literal key field is set. Select a credential in connection_id. |
credential binding 'connection' has no key usable for symmetric | error | The credential resolved, but its secret is empty or is an object without a usable field. Store the key as a string, or as an object with the field this operation reads (see connection_id). |
Failed to resolve connection <connection_id>: <detail> | error | The credential id does not exist or is not available to this workflow. Check the id and the credential type. |
Input contract
-
connection_idstring Optional -
keystring Optional -
dataany Required
Output contract
-
encryptedstring Optional -
v1.<iv>.<tag>.<ciphertext> (base64url)
-
algorithmstring Optional
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "crypto.encrypt",
"name": "Encrypt Data",
"category": "identity",
"version": "2.0.0",
"description": "Encrypts data with AES-256-GCM (random IV, authenticated). Output: v1.<iv>.<tag>.<ciphertext>.",
"capabilities": [
"crypto",
"encryption"
],
"config_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Encryption key credential",
"description": "Sommatic AI credential resolved server-side (recommended). Accepts credentials of type `encryption-key`.",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"encryption-key"
]
}
},
"key": {
"type": "string",
"ui_widget": "password",
"x-literal-secret": true,
"description": "Encryption key (64 hex chars, base64 of 32 bytes, or a passphrase) as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
},
"data": {
"description": "Data to encrypt (any JSON value)"
}
},
"required": [
"data"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"key": {
"type": "string"
},
"data": {}
},
"required": [
"data"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"encrypted": {
"type": "string",
"description": "v1.<iv>.<tag>.<ciphertext> (base64url)"
},
"algorithm": {
"type": "string"
}
}
},
"ports": [
{
"port_id": "out",
"label": "Encrypted",
"description": "Encrypted data",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Encryption failed",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "sync",
"required_resources": [],
"compatible_worker_pools": [
"standard"
],
"tags": [
"crypto",
"security"
],
"is_stateful": false,
"publisher": {
"identity": "org_veripass",
"profile": {
"name": "Veripass",
"verified": true,
"url": "https://me.veripass.com/veripass",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Encryption key credential",
"description": "Sommatic AI credential resolved server-side (recommended). Accepts credentials of type `encryption-key`.",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"encryption-key"
]
}
},
"key": {
"type": "string",
"ui_widget": "password",
"x-literal-secret": true,
"description": "Encryption key (64 hex chars, base64 of 32 bytes, or a passphrase) as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
},
"data": {
"description": "Data to encrypt (any JSON value)"
}
},
"required": [
"data"
]
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"key": {
"type": "string"
},
"data": {}
},
"required": [
"data"
]
}{
"type": "object",
"properties": {
"encrypted": {
"type": "string",
"description": "v1.<iv>.<tag>.<ciphertext> (base64url)"
},
"algorithm": {
"type": "string"
}
}
}[
{
"port_id": "out",
"label": "Encrypted",
"description": "Encrypted data",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Encryption failed",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
sync- Stateful
- No
- Capabilities
cryptoencryption- Tags
cryptosecurity
Notes and limits
- Every run uses a fresh random IV, so the same value encrypted twice gives different tokens. Do not compare tokens for equality; use
crypto.hashfor that. - Only
crypto.decryptwith the same key reads the token (formatv1). - Leaving through
errordoes not fail the run: the engine follows the edges wired toerror, and if there are none the branch simply ends.
Reviewed against the orchestrator code · 31e874b · 2026-11-26