credstore

package
v0.14.11 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package credstore is the agent's encrypted store for database credential profiles. Profiles live in <data dir>/credentials.json, encrypted with AES-256-GCM under a random key kept in <data dir>/credentials.key (0600, so only the agent's user can read it; on Windows the key is additionally wrapped with DPAPI for the service account). Passwords therefore never sit in agent.yaml in clear text, and only the profile names and engines are ever reported to the server.

Index

Constants

View Source
const (
	StoreFile = "credentials.json"
	KeyFile   = "credentials.key"
)

File names inside the data directory

Variables

View Source
var ErrNotFound = errors.New("profile not found")

ErrNotFound is returned for an unknown profile name

Functions

func Summaries

func Summaries(profiles map[string]dbspec.CredentialProfile) []dbspec.ProfileSummary

Summaries lists names, engines and users of a profile set (never passwords)

Types

type Store

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

Store is a handle on the encrypted file; every operation reads and writes it whole

func Open

func Open(dataDir string) *Store

Open returns a store for the data directory (nothing is read until needed)

func (*Store) Delete

func (s *Store) Delete(name string) error

Delete removes a profile

func (*Store) Exists

func (s *Store) Exists() bool

Exists reports whether a store file has been written

func (*Store) Load

func (s *Store) Load() (map[string]dbspec.CredentialProfile, error)

Load returns the profiles (an empty map when no store exists)

func (*Store) Names

func (s *Store) Names() ([]dbspec.ProfileSummary, error)

Names lists the profile names and engines without touching the passwords, for the server and the UI. Only this ever leaves the agent.

func (*Store) Path

func (s *Store) Path() string

Path returns the store file's path

func (*Store) Put

func (s *Store) Put(name string, p dbspec.CredentialProfile) error

Put creates or replaces a profile

Jump to

Keyboard shortcuts

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