keystore

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Store(service, key string, secret []byte) error
	Load(service, key string) ([]byte, error)
	Delete(service, key string) error
}

func New

func New() (Backend, error)

type CredsBackend

type CredsBackend struct {
	Dir string
	// Command is the systemd-creds executable; tests replace it.
	Command string
}

CredsBackend keeps each secret in a file encrypted with `systemd-creds --user` (systemd 256 or later). systemd binds the file to this user and to the machine: to the host key in /var/lib/systemd, and also to the TPM when there is one, which the user does not need access to. It is the fallback for Linux without a Secret Service, such as a server, a container or WSL. The secret passes through stdin and stdout only.

func (*CredsBackend) Delete

func (c *CredsBackend) Delete(service, key string) error

func (*CredsBackend) Load

func (c *CredsBackend) Load(service, key string) ([]byte, error)

func (*CredsBackend) Probe

func (c *CredsBackend) Probe() error

Probe encrypts a throwaway value, which fails before systemd 256, without the user's credential service, or without a host key.

func (*CredsBackend) Store

func (c *CredsBackend) Store(service, key string, secret []byte) error

type KeyringBackend

type KeyringBackend struct{}

func (*KeyringBackend) Delete

func (k *KeyringBackend) Delete(service, key string) error

func (*KeyringBackend) Load

func (k *KeyringBackend) Load(service, key string) ([]byte, error)

func (*KeyringBackend) Probe

func (k *KeyringBackend) Probe() error

Probe checks access without writing a key or waiting indefinitely for a locked or missing Secret Service.

func (*KeyringBackend) Store

func (k *KeyringBackend) Store(service, key string, secret []byte) error

type TextBackend

type TextBackend struct{}

func (*TextBackend) Delete

func (t *TextBackend) Delete(service, key string) error

func (*TextBackend) Load

func (t *TextBackend) Load(service, key string) ([]byte, error)

func (*TextBackend) Store

func (t *TextBackend) Store(service, key string, secret []byte) error

Jump to

Keyboard shortcuts

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