Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMasterKey ¶
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) RemoveSecretByID ¶ added in v0.2.0
func (l *LocalSecretStore) RemoveSecretByID(secretID string) error
RemoveSecretByID removes the specified secretID stored locally
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) RemoveSecretByID(secretID string) error }
func OpenStore ¶ added in v0.2.0
func OpenStore(filename string) (SecretStore, error)
openStore tries to create or open the LocalSecretStore based on the environment variable MASTER_KEY. If not found, it prints an error.
type StaticStore ¶
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) RemoveSecretByID ¶ added in v0.2.0
func (s *StaticStore) RemoveSecretByID(secretID string) error
func (*StaticStore) StoreSecretByID ¶
func (s *StaticStore) StoreSecretByID(secretID, secret string) error
Click to show internal directories.
Click to hide internal directories.