keyring

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const ConfigType = "keyring"

ConfigType is the name of the config type for the keyring secret keeper.

Variables

This section is empty.

Functions

func Builder

func Builder(_ context.Context, c any) (secrets.Keeper, error)

Builder builds a new keyring secret keeper.

Types

type Config

type Config struct {
	// ServiceName is the name of the service to use in the keyring.
	ServiceName string `mapstructure:"service_name" yaml:"service_name"`
}

Config is the configuration for the keyring secret keeper.

type Keyring

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

Keyring is a Keeper with access to the system keyring.

func New

func New(serviceName string) *Keyring

New creates a new Keyring Keeper and returns it.

func (Keyring) CopySecret

func (k Keyring) CopySecret(context.Context, string, string) (secrets.Secret, error)

CopySecret copies the secret with the given ID to the new name.

func (Keyring) DeleteSecret

func (k Keyring) DeleteSecret(_ context.Context, id string) error

DeleteSecret deletes the secret with the given ID.

func (Keyring) GetSecret

func (k Keyring) GetSecret(_ context.Context, id string) (secrets.Secret, error)

GetSecret returns the secret with the given ID.

func (Keyring) GetSecretsByName

func (k Keyring) GetSecretsByName(_ context.Context, name string) ([]secrets.Secret, error)

GetSecretsByName returns a list of secrets in the given location with the given name.

func (Keyring) ListLocations

func (k Keyring) ListLocations(_ context.Context) ([]string, error)

ListLocations returns a list of locations that this Keeper can access.

func (Keyring) ListSecrets

func (k Keyring) ListSecrets(context.Context, string) ([]string, error)

ListSecrets returns a list of secrets in the given location.

func (Keyring) MoveSecret

func (k Keyring) MoveSecret(context.Context, string, string) (secrets.Secret, error)

MoveSecret moves the secret with the given ID to the new name.

func (Keyring) SetSecret

func (k Keyring) SetSecret(_ context.Context, secret secrets.Secret) (secrets.Secret, error)

SetSecret sets the secret with the given ID.

type Secret

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

Secret is a secrets.Secret implementation that wraps a keyring entry. This implementation is unique in that the ID, name, and username are all treated the same.

func FromKeyring

func FromKeyring(name string, value string) (*Secret, error)

FromKeyringt creates a new Secret from the given keyring entry.

func FromSecret

func FromSecret(secret secrets.Secret) (*Secret, error)

FromSecret creates a new Secret from the given secret.

func (*Secret) Fields

func (s *Secret) Fields() map[string]string

Fields returns the fields of the secret.

func (*Secret) GetField

func (s *Secret) GetField(name string) string

GetField returns the value of the given field.

func (*Secret) ID

func (s *Secret) ID() string

ID returns the name of the secret.

func (*Secret) LastModified

func (s *Secret) LastModified() time.Time

LastModified returns the last modified time of the secret.

func (*Secret) Location

func (s *Secret) Location() string

Location returns the location of the secret.

func (*Secret) Name

func (s *Secret) Name() string

Name returns the name of the secret.

func (*Secret) Password

func (s *Secret) Password() string

Password returns the password of the secret.

func (*Secret) Type

func (s *Secret) Type() string

Type returns the type of the secret.

func (*Secret) Url

func (s *Secret) Url() *url.URL

Url returns the URL of the secret.

func (*Secret) Username

func (s *Secret) Username() string

Username returns name of the secret.

Jump to

Keyboard shortcuts

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