Documentation ¶
Index ¶
- Constants
- func Builder(_ context.Context, c any) (secrets.Keeper, error)
- func RemoveQuestion(kc config.KeeperConfig, id string)
- func SetQuestion(kc config.KeeperConfig, id string, presets map[string]any, askFor []string)
- func Validator(_ context.Context, c any) error
- type Config
- type Human
- func (h *Human) AddQuestion(id string, askFor []string, preset map[string]string)
- func (h *Human) CopySecret(_ context.Context, id, location string) (secrets.Secret, error)
- func (h *Human) DeleteSecret(_ context.Context, id string) error
- func (h *Human) GetSecret(_ context.Context, id string) (secrets.Secret, error)
- func (h *Human) GetSecretsByName(ctx context.Context, name string) ([]secrets.Secret, error)
- func (h *Human) ListLocations(_ context.Context) ([]string, error)
- func (h *Human) ListSecrets(_ context.Context, _ string) ([]string, error)
- func (h *Human) MoveSecret(_ context.Context, id, location string) (secrets.Secret, error)
- func (h *Human) SetSecret(_ context.Context, secret secrets.Secret) (secrets.Secret, error)
- type Question
- type QuestionConfig
Constants ¶
const ConfigType = "human"
ConfigType is the type name for the human secrets keeper.
Variables ¶
This section is empty.
Functions ¶
func RemoveQuestion ¶
func RemoveQuestion(kc config.KeeperConfig, id string)
RemoveQuestion removes a question from the given keeper configuration. This is used by the command-line interface to help remove configuration incrementally.
func SetQuestion ¶
SetQuestion adds or updates a question in the given keeper configuration. This is used by the command-line interface to help build up the configuration incrementally.
Types ¶
type Config ¶
type Config struct { // Questions is the list of questions that will be asked of the user. Questions []QuestionConfig `mapstructure:"questions" yaml:"questions"` }
Config is the configuration of the human secrets keeper.
type Human ¶
type Human struct {
// contains filtered or unexported fields
}
Human is a secret keeper that asks the user for the secrets.
func (*Human) AddQuestion ¶
AddQuestion adds a question to the human secrets keeper.
func (*Human) CopySecret ¶
CopySecret fails with an error.
func (*Human) DeleteSecret ¶
DeleteSecret fails with an error.
func (*Human) GetSecret ¶
GetSecret retrieves the secret with the given ID by asking the user for the secret information as defined by the identified question configuration.
func (*Human) GetSecretsByName ¶
GetSecretsByName retrieves the secret with the given name by asking the user for the secret information as defined by the identified question configuration. As ID and name are treated the same by the human secret keeper, this is essentially identical to GetSecret.
func (*Human) ListLocations ¶
ListLocations returns the list of locations from the human secrets keeper. This always just returns "". As of this writing, you should only use an empty location with the human secret keeper.
func (*Human) ListSecrets ¶
ListSecrets returns an empty list.
func (*Human) MoveSecret ¶
MoveSecret fails with an error.
type Question ¶
type Question struct {
// contains filtered or unexported fields
}
Question defines the questions to ask for a secret as well as the preset values to use to fill in the rest.
type QuestionConfig ¶
type QuestionConfig struct { // ID is the unique identifier for the question. It is used to reference // the question in the configuration. ID string `mapstructure:"id" yaml:"id"` // Presets are the values that will be used to populate the parts of the // secret that are not queried directly from the user via pinentry. Presets map[string]string `mapstructure:"presets" yaml:"presets"` // AskFor is the list of fields that will be queried from the user via // pinentry. AskFor []string `mapstructure:"ask_for" yaml:"ask_for"` }
QuestionConfig is the configuration for a single question. Each question behaves as a secret. The contents of the secret are determined by this configuration and user input.