Decrypt Data
Decrypts a value produced by crypto.encrypt or $encrypt.
Decrypts a v1.<iv>.<tag>.<ciphertext> token produced by crypto.encrypt and returns the original JSON value under data.
How it works
- Resolves the config;
encryptedis usually{{ $json.encrypted }}. - Leaves through
errorwithencrypted data is requiredwhenencryptedis empty. - Picks the key:
connection_idfirst, otherwise the literalkey. - Checks the format: four dot-separated parts, the first one
v1. - Decrypts with AES-256-GCM and verifies the authentication tag: a wrong key or an altered token fails.
- Returns
{ data: <original value> }onout, with the audit record inmeta.crypto.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-decrypt-payment",
"label": "Decrypt payment details",
"operator_slug": "crypto.decrypt",
"operator_version": "2.0.0",
"config": {
"connection_id": "pi-credential-xxxx",
"encrypted": "{{ $json.encrypted }}"
}
}{
"ok": true,
"port": "out",
"data": {
"data": {
"card_last4": "4242",
"amount": 129.9,
"currency": "USD"
}
},
"meta": {
"crypto": {
"op": "decrypt",
"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 as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id.
-
encryptedstring Required -
v1.<iv>.<tag>.<ciphertext>
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. It must hold the same key used bycrypto.encrypt. -
key - A literal key works, but it is stored in the flow, its version history and Git, and
meta.warningsreports it on every run. Preferconnection_id.
Output ports
out default The token was decrypted and authenticated.
{
"data": {
"card_last4": "4242",
"amount": 129.9,
"currency": "USD"
}
}error The token is missing or malformed, the key is wrong, or the credential cannot be resolved.
{
"error": "Decryption failed: wrong key or tampered value"
}In expressions
What a later node can read from this node's output with $("Decrypt Data").item.json.<path> (write your node's label instead of Decrypt 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 |
|---|---|---|
$("Decrypt Data").item.json.dataDecrypted value | ||
$("Decrypt Data").item.json.data.card_last4 | — | |
$("Decrypt Data").item.json.data.amount | — | |
$("Decrypt Data").item.json.data.currency | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
encrypted data is required | error | encrypted is empty. |
Invalid encrypted value: expected v1.<iv>.<tag>.<ciphertext> | error | The value is not a token from crypto.encrypt (for example the whole { encrypted, algorithm } object was passed instead of encrypted). |
Decryption failed: wrong key or tampered value | error | The key differs from the one used to encrypt, or the token was altered or truncated. |
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 -
encryptedstring Required
Output contract
-
dataany Optional -
Decrypted value
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.decrypt",
"name": "Decrypt Data",
"category": "identity",
"version": "2.0.0",
"description": "Decrypts a value produced by crypto.encrypt or $encrypt. Fails if the key is wrong or the value was altered.",
"capabilities": [
"crypto",
"decryption"
],
"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 as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
},
"encrypted": {
"type": "string",
"description": "v1.<iv>.<tag>.<ciphertext>"
}
},
"required": [
"encrypted"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"key": {
"type": "string"
},
"encrypted": {
"type": "string"
}
},
"required": [
"encrypted"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"data": {
"description": "Decrypted value"
}
}
},
"ports": [
{
"port_id": "out",
"label": "Decrypted",
"description": "Decrypted string",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Decryption 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 as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
},
"encrypted": {
"type": "string",
"description": "v1.<iv>.<tag>.<ciphertext>"
}
},
"required": [
"encrypted"
]
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"key": {
"type": "string"
},
"encrypted": {
"type": "string"
}
},
"required": [
"encrypted"
]
}{
"type": "object",
"properties": {
"data": {
"description": "Decrypted value"
}
}
}[
{
"port_id": "out",
"label": "Decrypted",
"description": "Decrypted string",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Decryption failed",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
sync- Stateful
- No
- Capabilities
cryptodecryption- Tags
cryptosecurity
Notes and limits
- The value comes back under
data.data: read it downstream as{{ $json.data.amount }}. - The decrypted value is plain data in the run from this point on: avoid sending it to logs or external systems you do not need.
- 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