secret

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package secret provides interfaces and implementations for managing user secrets. Secret values are stored in the system keychain; non-sensitive metadata is persisted in a JSON file under the kdn storage directory.

Index

Constants

View Source
const TypeOther = "other"

TypeOther is the secret type for custom secrets that require explicit host, path, header, and headerTemplate descriptors.

Variables

View Source
var ErrSecretAlreadyExists = errors.New("secret already exists")

ErrSecretAlreadyExists is returned when a secret with the same name already exists.

View Source
var ErrSecretNotFound = errors.New("secret not found")

ErrSecretNotFound is returned when no secret with the given name exists.

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	Name           string
	Type           string
	Value          string
	Description    string
	Hosts          []string
	Path           string
	Header         string
	HeaderTemplate string
	Envs           []string
}

CreateParams holds all parameters needed to create a secret.

type ListItem

type ListItem struct {
	Name           string
	Type           string
	Description    string
	Hosts          []string
	Path           string
	Header         string
	HeaderTemplate string
	Envs           []string
}

ListItem holds the metadata fields returned by List.

type Store

type Store interface {
	// Create stores the secret value in the system keychain and persists
	// the remaining metadata to the storage directory.
	Create(params CreateParams) error
	// List returns the metadata for all stored secrets.
	List() ([]ListItem, error)
	// Get returns the metadata and value for the named secret.
	// Returns ErrSecretNotFound if no secret with the given name exists.
	Get(name string) (ListItem, string, error)
	// Remove deletes the secret value from the system keychain and removes
	// its metadata from the storage directory.
	Remove(name string) error
}

Store manages persistent storage of secrets.

func NewStore

func NewStore(storageDir string) Store

NewStore creates a Store backed by the system keychain and the given storage directory.

Jump to

Keyboard shortcuts

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