The Temporal Encryption Converter is a Go package designed to deliver encryption and decryption solutions for payloads within the Temporal workflow engine. The package incorporates a unique context propagator, enabling the transmission of context values across multiple workflows.
Install the package with the go get command:
go get github.com/saga420/temporal-encryption-converter
SEE example/*.go for more examples
// Generate a key pair for the client
client, _ := encryption.GenerateKeyPair()
fmt.Println("Client's Private Key: ", client.PrivateKey)
fmt.Println("Client's Public Key: ", client.PublicKey)
// Generate a key pair for the worker
worker, _ := encryption.GenerateKeyPair()
fmt.Println("Worker's Private Key: ", worker.PrivateKey)
fmt.Println("Worker's Public Key: ", worker.PublicKey)
The X25519 algorithm is used for key exchange. Before initiating a workflow, the client must possess knowledge of the worker's public key, which is essential for encrypting data intended solely for that worker to decrypt and process.
Intriguingly, it's not required for the worker to preconfigure the client's public key. This key is conveyed within the context metadata of the workflow, allowing any client (each potentially with different key pairs) to transmit encrypted data to the worker using the worker's public key. The worker can subsequently receive and process workflow messages from any client, promoting a flexible and secure communication system.
Note: Error handling is critical in production code. While errors are omitted for brevity in these examples, in a production environment, it's crucial to always check and handle errors effectively.
- Empowers payload encryption and decryption in Temporal workflows.
- Implements AES256_GCM_PBKDF2_Curve25519 and XChaCha20_Poly1305_PBKDF2_Curve25519 encryption algorithms.
- Supports ZLib compression pre-encryption for payload size optimization.
- Facilitates passing of context values across diverse workflows.
We warmly welcome contributions. Kindly fork the repository and submit a pull request with your amendments.
This package is distributed under the terms of the MIT License.