Encryption¶
Payload codecs for encrypting data in Temporal's event history.
EncryptionCodec¶
EncryptionCodec
¶
Bases: PayloadCodec
Temporal PayloadCodec that encrypts/decrypts payloads using AES-GCM.
All data flowing through Temporal's event history (Activity inputs/outputs, Workflow state, Signal payloads) will be encrypted with the provided key.
This is critical for workloads containing PII, as Temporal's event history
is queryable and exportable. Without encryption, all channel state
(including messages lists containing user data) is stored in plaintext.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
bytes | None
|
32-byte encryption key for AES-256-GCM. If not provided,
falls back to the |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no key is provided and the environment variable is not set. |
ValueError
|
If the key is not exactly 32 bytes. |
Source code in langgraph/temporal/encryption.py
FernetEncryptionCodec¶
FernetEncryptionCodec
¶
Bases: PayloadCodec
Temporal PayloadCodec using Fernet symmetric encryption.
Fernet is simpler to use than AES-GCM (key is a URL-safe base64 string) and provides authenticated encryption. Use this for simpler deployments where AES-GCM key management is not needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str | bytes
|
Fernet key (URL-safe base64-encoded 32-byte key).
Generate with |
required |
Source code in langgraph/temporal/encryption.py
generate_encryption_key¶
generate_encryption_key
¶
Generate a random 32-byte encryption key for AES-256-GCM.
Returns:
| Type | Description |
|---|---|
bytes
|
A 32-byte random key suitable for use with |