secret

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package secret stores datasource passwords outside the configuration file.

The Store interface exists so that the rest of datavase never imports a keychain library directly; tests use the in-memory implementation and get the same behaviour, guaranteed by the shared contract test.

Index

Constants

View Source
const Service = "datavase"

Service is the keychain service name every datavase entry is filed under. Accounts within it are datasource names.

Variables

View Source
var ErrNotFound = errors.New("no password stored")

ErrNotFound reports that no password is stored for an account.

Functions

This section is empty.

Types

type Keychain

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

Keychain is the OS keychain implementation (macOS Keychain, Secret Service on Linux, Credential Manager on Windows).

func NewKeychain

func NewKeychain() *Keychain

NewKeychain returns a Store backed by the OS keychain.

func (*Keychain) Delete

func (k *Keychain) Delete(account string) error

func (*Keychain) Get

func (k *Keychain) Get(account string) (string, error)

func (*Keychain) Set

func (k *Keychain) Set(account, password string) error

type Memory

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

Memory is an in-memory Store for tests.

func NewMemory

func NewMemory() *Memory

NewMemory returns an empty in-memory Store.

func (*Memory) Delete

func (m *Memory) Delete(account string) error

func (*Memory) Get

func (m *Memory) Get(account string) (string, error)

func (*Memory) Set

func (m *Memory) Set(account, password string) error

type Store

type Store interface {
	Get(account string) (string, error)
	Set(account, password string) error
	Delete(account string) error
}

Store holds one password per datasource name.

Jump to

Keyboard shortcuts

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