secrets

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMasterKey

func GenerateMasterKey() (string, error)

GenerateMasterKey creates a 32-byte random key and returns it as a hex string.

Types

type LocalSecretStore

type LocalSecretStore struct {
	Secrets map[string]string `json:"secrets"`
	// contains filtered or unexported fields
}

Structure to store encrypted secrets in a JSON file

func NewLocalSecretStore

func NewLocalSecretStore(masterKeyHex, filename string, create bool) (*LocalSecretStore, error)

func (*LocalSecretStore) GetSecretByID

func (l *LocalSecretStore) GetSecretByID(secretID string) (string, error)

GetSecretByID decrypts the secret using the master key and returns it

func (*LocalSecretStore) ListSecrets

func (l *LocalSecretStore) ListSecrets() (map[string]string, error)

ListSecrets returns a copy of secret IDs to secrets stored in memory

func (*LocalSecretStore) StoreSecretByID

func (l *LocalSecretStore) StoreSecretByID(secretID, secret string) error

StoreSecretByID encrypts the secret using the master key and stores it in the JSON file

type SecretStore

type SecretStore interface {
	GetSecretByID(secretID string) (string, error)
	StoreSecretByID(secretID, secret string) error
	ListSecrets() (map[string]string, error)
}

type StaticStore

type StaticStore struct {
	Username string
	Password string
}

func NewStaticStore

func NewStaticStore(username, password string) *StaticStore

NewStaticStore creates a new StaticStore with the given username and password.

func (*StaticStore) GetSecretByID

func (s *StaticStore) GetSecretByID(secretID string) (string, error)

func (*StaticStore) ListSecrets

func (s *StaticStore) ListSecrets() (map[string]string, error)

func (*StaticStore) StoreSecretByID

func (s *StaticStore) StoreSecretByID(secretID, secret string) error

Jump to

Keyboard shortcuts

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