feat(secrets): implement SecretStore interface and StaticStore/LocalStore for credential management

This commit is contained in:
Alex Lovell-Troy 2025-03-07 17:10:31 -05:00
parent 76b9d35ec7
commit 1f2e72dab6
No known key found for this signature in database
13 changed files with 525 additions and 29 deletions

View file

@ -0,0 +1,28 @@
package secrets
import "fmt"
type StaticStore struct {
Username string
Password string
}
// NewStaticStore creates a new StaticStore with the given username and password.
func NewStaticStore(username, password string) *StaticStore {
return &StaticStore{
Username: username,
Password: password,
}
}
func (s *StaticStore) GetSecretByID(secretID string) (string, error) {
return fmt.Sprintf(`{"username":"%s","password":"%s"}`, s.Username, s.Password), nil
}
func (s *StaticStore) StoreSecretByID(secretID, secret string) error {
return nil
}
func (s *StaticStore) ListSecrets() (map[string]string, error) {
return map[string]string{
"static_creds": fmt.Sprintf(`{"username":"%s","password":"%s"}`, s.Username, s.Password),
}, nil
}