crypto

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SharedSecretKeyRedisKey = "trustgate:server:secret-key"

SharedSecretKeyRedisKey is the Redis key under which the auto-provisioned SERVER_SECRET_KEY is stored so every replica encrypts vault material and verifies admin-plane JWTs with the same secret.

Variables

This section is empty.

Functions

func ResolveSharedSecretKey added in v0.18.0

func ResolveSharedSecretKey(ctx context.Context, rdb *redis.Client, logger *slog.Logger) (string, error)

ResolveSharedSecretKey returns a base64-encoded secret shared across replicas via Redis. It returns the stored secret when present; otherwise it generates one and stores it with SETNX so concurrent replicas converge on a single value instead of each minting with its own ephemeral secret.

Types

type Cipher

type Cipher struct {
	// contains filtered or unexported fields
}

func NewCipher

func NewCipher(secret string) (*Cipher, error)

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(encoded string) (string, error)

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(plaintext string) (string, error)

Jump to

Keyboard shortcuts

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