Documentation ¶
Index ¶
- Constants
- Variables
- func Builder(ctx context.Context, c any) (secrets.Keeper, error)
- type Config
- type LastPass
- func (l *LastPass) CopySecret(ctx context.Context, id, grp string) (secrets.Secret, error)
- func (l *LastPass) DeleteSecret(ctx context.Context, id string) error
- func (l *LastPass) GetSecret(ctx context.Context, id string) (secrets.Secret, error)
- func (l *LastPass) GetSecretsByName(ctx context.Context, name string) ([]secrets.Secret, error)
- func (l *LastPass) ListLocations(ctx context.Context) ([]string, error)
- func (l *LastPass) ListSecrets(ctx context.Context, location string) ([]string, error)
- func (l *LastPass) MoveSecret(ctx context.Context, id, grp string) (secrets.Secret, error)
- func (l *LastPass) SetSecret(ctx context.Context, secret secrets.Secret) (secrets.Secret, error)
- type LastPassClient
- type Secret
- func (s *Secret) Fields() map[string]string
- func (s *Secret) GetField(name string) string
- func (s *Secret) ID() string
- func (s *Secret) LastModified() time.Time
- func (s *Secret) Location() string
- func (s *Secret) Name() string
- func (s *Secret) Password() string
- func (s *Secret) SetField(name, value string)
- func (s *Secret) SetFields(fields map[string]string)
- func (s *Secret) SetName(name string)
- func (s *Secret) SetPassword(secret string)
- func (s *Secret) SetType(typ string)
- func (s *Secret) SetUrl(url *url.URL)
- func (s *Secret) SetUsername(username string)
- func (s *Secret) Type() string
- func (s *Secret) Url() *url.URL
- func (s *Secret) Username() string
Constants ¶
const ConfigType = "lastpass"
ConfigType is the name of the config type for the lastpass secret keeper.
Variables ¶
var ErrTooManyRetries = errors.New("too many retries")
Functions ¶
Types ¶
type Config ¶
type Config struct { // Username is the username to use to log into LastPass. Username string `mapstructure:"username" yaml:"username"` // Password is the password to use to log into LastPass. Password string `mapstructure:"password" yaml:"password"` }
Config is the configuration for the lastpass secret keeper.
type LastPass ¶
type LastPass struct {
// contains filtered or unexported fields
}
LastPass is a secret Keeper that gets secrets from the LastPass password manager service.
func NewLastPass ¶
NewLastPass constructs and returns a new LastPass Keeper or returns an error if there was a problem during construction.
The username and password arguments are used to authenticate with LastPass.
func NewLastPassWithClient ¶
func NewLastPassWithClient( lp LastPassClient, ) (*LastPass, error)
NewLastPassWithClient constructs a new LastPass Keeper with a custom LastPass client. This constructor is mostly intended for use during testing.
func (*LastPass) CopySecret ¶
CopySecret copies the account from one group to another in LastPass.
func (*LastPass) DeleteSecret ¶
DeleteSecret removes the account from LastPass.
func (*LastPass) GetSecretsByName ¶
GetSecretsByName returns all the secrets from the LastPass service with the given name.
func (*LastPass) ListLocations ¶
ListLocations returns a list of LastPass folders.
func (*LastPass) ListSecrets ¶
ListSecrets returns a list of secrets in each folder.
func (*LastPass) MoveSecret ¶
MoveSecret copies the account to a new group and deletes the old one.
type LastPassClient ¶
type LastPassClient interface { // Accounts should list secrets. Accounts(ctx context.Context) ([]*lastpass.Account, error) // Update updates a single secret. Update(ctx context.Context, a *lastpass.Account) error // Add creates a new secret. Add(ctx context.Context, a *lastpass.Account) error // Delete deletes a secret. Delete(ctx context.Context, a *lastpass.Account) error }
LastPassClient defines the interface required for a LastPass client. Normally, this is fulfilled by lastpass.Client, but is handled as an interface to make testing possible without an actual LastPass account.
type Secret ¶
type Secret struct { *lastpass.Account // contains filtered or unexported fields }
Secret is a secrets.Secret implementation that wraps a LastPass account.
func (*Secret) LastModified ¶
LastModified returns the LastPass account LastModifiedGMT.
func (*Secret) SetPassword ¶
SetPassword sets the LastPass account password.
func (*Secret) SetUsername ¶
SetUsername sets the LastPass account username.