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 ¶
NewManager creates a new Manager with the given secret and options.
func (*Manager) Decrypt ¶
Decrypt decrypts the given base64-encoded ciphertext using the configured secret.
func (*Manager) Encrypt ¶
Encrypt encrypts the given plaintext using the configured secret. It returns a base64-encoded string of the ciphertext.
func (*Manager) IsEncryptionEnabled ¶
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.