security

package
v3.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package security provides security functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles encryption and decryption of sensitive data.

func NewManager

func NewManager(secret secret.Value, opts ...Option) *Manager

NewManager creates a new Manager with the given secret and options.

func (*Manager) Decrypt

func (m *Manager) Decrypt(encodedCiphertext string) (string, error)

Decrypt decrypts the given base64-encoded ciphertext using the configured secret.

func (*Manager) Encrypt

func (m *Manager) Encrypt(plaintext string) (string, error)

Encrypt encrypts the given plaintext using the configured secret. It returns a base64-encoded string of the ciphertext.

func (*Manager) IsEncryptionEnabled

func (m *Manager) IsEncryptionEnabled() bool

IsEncryptionEnabled returns true if an encryption secret is configured.

type Option

type Option func(*Manager)

Option configures the behavior of the Manager.

func WithAllowEmptySecret

func WithAllowEmptySecret() Option

WithAllowEmptySecret permits running without an encryption secret.

func WithAllowPlaintext

func WithAllowPlaintext() Option

WithAllowPlaintext permits plaintext values when decrypting.

Jump to

Keyboard shortcuts

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