credentials

package
v0.9.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLegacyPlaintext = errors.New("legacy plaintext credential requires re-save")

Functions

func NewPasswordSecretName added in v0.9.0

func NewPasswordSecretName(profileName string) (string, error)

NewPasswordSecretName returns a unique opaque encrypted-store key.

func ValidateName added in v0.9.0

func ValidateName(name string) (string, error)

func ValidateUsername added in v0.9.0

func ValidateUsername(username string) (string, error)

Types

type Profile

type Profile struct {
	Name           string `json:"name"`
	Username       string `json:"username"`
	Password       string `json:"-"`
	PasswordSecret string `json:"password_secret,omitempty"`
	RequiresResave bool   `json:"requires_resave,omitempty"`
}

Profile stores credential metadata. Password is populated only on Get and is never serialized to credentials.json.

type Store

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

Store manages credential metadata and an encrypted password store.

func LoadStore

func LoadStore(filePath string, encrypted ...*secretstore.Store) *Store

LoadStore reads credential metadata from disk. Passwords are stored in a separate encrypted store beside credentials.json.

func (*Store) Delete

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

Delete removes a credential profile and its encrypted password.

func (*Store) Err added in v0.9.0

func (s *Store) Err() error

Err reports a credential metadata load failure.

func (*Store) Get

func (s *Store) Get(name string) (*Profile, error)

Get returns a credential profile with its password decrypted in memory.

func (*Store) List

func (s *Store) List() []string

List returns all profile names.

func (*Store) ListProfiles added in v0.9.0

func (s *Store) ListProfiles() []*Profile

ListProfiles returns credential metadata without passwords.

func (*Store) ReloadSecrets added in v0.9.0

func (s *Store) ReloadSecrets() error

ReloadSecrets refreshes encrypted passwords written by the prompt helper.

func (*Store) SecretStorePath added in v0.9.0

func (s *Store) SecretStorePath() string

SecretStorePath returns the encrypted password-store path.

func (*Store) Set

func (s *Store) Set(p *Profile) error

Set encrypts a password and adds or updates a credential profile.

func (*Store) SetReference added in v0.9.0

func (s *Store) SetReference(name, username, secretName string) error

SetReference commits metadata for a password already written by the local prompt helper. The referenced encrypted value must exist.

Jump to

Keyboard shortcuts

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