encryption

package
v1.3.1-0...-c69dc0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Steps to run this sample:

  1. Run a Temporal service.
  2. Run the following command to start the remote codec server
go run ./codec-server
  1. Run the following command to start the worker
go run worker/main.go
  1. Run the following command to start the example
go run starter/main.go
  1. Run the following command and see the payloads cannot be decoded
tctl workflow show --wid encryption_workflowID
  1. Run the following command and see the decoded payloads
tctl --codec_endpoint 'http://localhost:8081/' workflow show --wid encryption_workflowID

Note: The codec server provided in this sample does not support decoding payloads for the Temporal Web UI, only tctl. Please see the codec-server sample for a more complete example of a codec server which provides UI decoding and oauth.

Documentation

Index

Constants

View Source
const (
	// MetadataEncodingEncrypted is "binary/encrypted"
	MetadataEncodingEncrypted = "binary/encrypted"

	// MetadataEncryptionKeyID is "encryption-key-id"
	MetadataEncryptionKeyID = "encryption-key-id"
)

Variables

View Source
var PropagateKey = contextKey{}

PropagateKey is the key used to store the value in the Context object

Functions

func Activity

func Activity(ctx context.Context, info map[string]string) (string, error)

func NewContextPropagator

func NewContextPropagator() workflow.ContextPropagator

NewContextPropagator returns a context propagator that propagates a set of string key-value pairs across a workflow

func Workflow

func Workflow(ctx workflow.Context, name string) (string, error)

Workflow is a standard workflow definition. Note that the Workflow and Activity don't need to care that their inputs/results are being encrypted/decrypted.

Types

type Codec

type Codec struct {
	KeyID string
}

Codec implements PayloadCodec using AES Crypt.

func (*Codec) Decode

func (e *Codec) Decode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Decode implements converter.PayloadCodec.Decode.

func (*Codec) Encode

func (e *Codec) Encode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Encode implements converter.PayloadCodec.Encode.

type CryptContext

type CryptContext struct {
	KeyID string `json:"keyId"`
}

CryptConfig is a struct holding values

type DataConverter

type DataConverter struct {
	converter.DataConverter
	// contains filtered or unexported fields
}

func NewEncryptionDataConverter

func NewEncryptionDataConverter(dataConverter converter.DataConverter, options DataConverterOptions) *DataConverter

NewEncryptionDataConverter creates a new instance of EncryptionDataConverter wrapping a DataConverter

func (*DataConverter) WithContext

func (dc *DataConverter) WithContext(ctx context.Context) converter.DataConverter

TODO: Implement workflow.ContextAware in EncodingDataConverter Note that you only need to implement this function if you need to vary the encryption KeyID per workflow.

func (*DataConverter) WithWorkflowContext

func (dc *DataConverter) WithWorkflowContext(ctx workflow.Context) converter.DataConverter

TODO: Implement workflow.ContextAware in CodecDataConverter Note that you only need to implement this function if you need to vary the encryption KeyID per workflow.

type DataConverterOptions

type DataConverterOptions struct {
	KeyID string
	// Enable ZLib compression before encryption.
	Compress bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL