secret

package
v0.0.0-...-59817e7 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package secret provides utility functions for handling secrets.

Index

Constants

View Source
const Secret = "Secret"

Secret is the type of a secret value.

Variables

This section is empty.

Functions

func PromptPassword

func PromptPassword(ctx context.Context, out io.Writer) (redact.Secret, error)

PromptPassword prompts a password input from stdin.

func PromptUsername

func PromptUsername(ctx context.Context, out io.Writer) (string, error)

PromptUsername prompts a username input from stdin.

Types

type Value

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

Value implements ValueResolver.

func (*Value) Get

func (v *Value) Get(ctx context.Context) (redact.Secret, error)

Get returns the value of the secret resolved from the secret source.

func (*Value) Set

func (v *Value) Set(s string) error

Set parses a secret source into the source prefix and value.

func (*Value) String

func (v *Value) String() string

String returns the original secret source provided to Set().

func (*Value) Type

func (v *Value) Type() string

Type returns the type of the pflag.Value, i.e. "Secret".

type ValueResolver

type ValueResolver interface {
	pflag.Value

	// Get returns the secret value.
	Get(context.Context) (redact.Secret, error)
}

ValueResolver extends pflag.Value with a secret value getter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳