secret

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package secret provides a layer for storing secretes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a secret is not found.
	ErrNotFound = errors.New("secret not found")

	// ErrKeyringUnsupported indicates that secure storage
	// via the system keychain is not supported on the current platform.
	ErrKeyringUnsupported = keyring.ErrUnsupportedPlatform
)

Functions

This section is empty.

Types

type Keyring

type Keyring struct{}

Keyring is a secure secret store that uses the system's keychain if available.

Its zero value is ready for use.

func (*Keyring) DeleteSecret

func (*Keyring) DeleteSecret(service, key string) error

DeleteSecret deletes a secret from the keyring.

func (*Keyring) LoadSecret

func (*Keyring) LoadSecret(service, key string) (string, error)

LoadSecret loads a secret from the keyring.

func (*Keyring) SaveSecret

func (*Keyring) SaveSecret(service, key, secret string) error

SaveSecret saves a secret in the keyring.

type MemoryStash

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

MemoryStash is an in-memory secret store for testing. Its zero value is ready for use.

func (*MemoryStash) DeleteSecret

func (m *MemoryStash) DeleteSecret(service string, key string) error

DeleteSecret deletes a secret from the memory stash.

func (*MemoryStash) LoadSecret

func (m *MemoryStash) LoadSecret(service string, key string) (string, error)

LoadSecret loads a secret from the memory stash.

func (*MemoryStash) SaveSecret

func (m *MemoryStash) SaveSecret(service string, key string, secret string) error

SaveSecret saves a secret in the memory stash.

type Stash

type Stash interface {
	SaveSecret(service, key, secret string) error
	LoadSecret(service, key string) (string, error)

	// DeleteSecret deletes a secret from the stash.
	// It is a no-op if the secret does not exist.
	DeleteSecret(service, key string) error
}

Stash stores and retrieves secrets.

Directories

Path Synopsis
Package secrettest provides a cross-process testable secret.Stash.
Package secrettest provides a cross-process testable secret.Stash.

Jump to

Keyboard shortcuts

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