keystore

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TxFromContext

func TxFromContext(ctx context.Context) *sql.Tx

TxFromContext extracts the transaction set by WithTx, or returns nil.

func WithTx

func WithTx(ctx context.Context, tx *sql.Tx) context.Context

WithTx returns a child context carrying the given transaction. The PostgreSQL KeyStore implementation will use this transaction for all operations (reads and writes) instead of the connection pool.

Types

type EncryptedKey

type EncryptedKey struct {
	Scope        string
	ScopeID      string
	KeyVersion   int
	EncryptedDEK []byte
	SystemKeyID  string
	CreatedAt    time.Time
	RevokedAt    *time.Time
}

EncryptedKey represents a stored encrypted DEK.

type KeyStore

type KeyStore interface {
	GetActiveKey(ctx context.Context, scope, scopeID string) (*EncryptedKey, error)
	GetKey(ctx context.Context, scope, scopeID string, version int) (*EncryptedKey, error)
	CreateKey(ctx context.Context, scope, scopeID string, version int, encryptedDEK []byte, systemKeyID string) error
	// RevokeKeys revokes all keys for the scope except the highest version.
	RevokeKeys(ctx context.Context, scope, scopeID string) error
	DestroyKeys(ctx context.Context, scope, scopeID string) error
}

KeyStore manages encrypted DEK storage and retrieval.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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