secret

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter bridges the generic envelope encryptor to secret-specific semantics.

func NewAdapter

func NewAdapter(encryptor *envelope.Encryptor) *Adapter

NewAdapter creates a new secret Adapter.

func (*Adapter) Decrypt

func (a *Adapter) Decrypt(ctx context.Context, scope, scopeID string, value EncryptedValue) (string, error)

Decrypt decrypts an EncryptedValue using the stored key version.

func (*Adapter) Encrypt

func (a *Adapter) Encrypt(ctx context.Context, scope, scopeID, plaintext string) (EncryptedValue, error)

Encrypt encrypts plaintext and returns an EncryptedValue with the key version.

type Decryptor

type Decryptor interface {
	Decrypt(ctx context.Context, scope, scopeID string, value EncryptedValue) (string, error)
}

Decryptor decrypts encrypted secrets for a specific scope.

type EncryptedValue

type EncryptedValue struct {
	Content    string
	KeyVersion int
}

EncryptedValue represents an encrypted secret with its associated key version.

func New

func New(content string, keyVersion int) EncryptedValue

New creates a new EncryptedValue.

func (EncryptedValue) IsEmpty

func (e EncryptedValue) IsEmpty() bool

IsEmpty returns true if the Content is empty.

type Encryptor

type Encryptor interface {
	Encrypt(ctx context.Context, scope, scopeID, plaintext string) (EncryptedValue, error)
}

Encryptor encrypts plaintext secrets for a specific scope.

Jump to

Keyboard shortcuts

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