keyringencdec

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package keyringencdec provides a value encoder/decoder backed by the OS keyring. It encrypts string values with AES-256-GCM and persists the key in the OS keyring. Ensure a compatible keyring backend is available in headless/container environments.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("keystore: secret not found")

Functions

This section is empty.

Types

type EncryptedStringValueEncoderDecoder

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

EncryptedStringValueEncoderDecoder uses AES-256-GCM + base64 for encoding/decoding and persists the AES key in the OS keyring under the configured service/username.

func NewEncryptedStringValueEncoderDecoder

func NewEncryptedStringValueEncoderDecoder(
	service, username string,
	opts ...Option,
) (*EncryptedStringValueEncoderDecoder, error)

NewEncryptedStringValueEncoderDecoder constructs a new instance.

func (*EncryptedStringValueEncoderDecoder) Decode

func (*EncryptedStringValueEncoderDecoder) Encode

type KeyStore

type KeyStore interface {
	Get(service, username string) (string, error)
	Set(service, username, secret string) error
}

type Option

Option is a functional option for configuring EncryptedStringValueEncoderDecoder.

func WithDebug

func WithDebug(debug bool) Option

WithDebug sets debug mode.

func WithKeyStore

func WithKeyStore(ks KeyStore) Option

Jump to

Keyboard shortcuts

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