notary: github.com/docker/notary/passphrase Index | Files

package passphrase

import "github.com/docker/notary/passphrase"

Package passphrase is a utility function for managing passphrase for TUF and Notary keys.

Index

Package Files

passphrase.go

Variables

var (
    // ErrTooShort is returned if the passphrase entered for a new key is
    // below the minimum length
    ErrTooShort = errors.New("Passphrase too short")

    // ErrDontMatch is returned if the two entered passphrases don't match.
    // new key is below the minimum length
    ErrDontMatch = errors.New("The entered passphrases do not match")

    // ErrTooManyAttempts is returned if the maximum number of passphrase
    // entry attempts is reached.
    ErrTooManyAttempts = errors.New("Too many attempts")

    // ErrNoInput is returned if we do not have a valid input method for passphrases
    ErrNoInput = errors.New("Please either use environment variables or STDIN with a terminal to provide key passphrases")
)

func ConstantRetriever Uses

func ConstantRetriever(constantPassphrase string) notary.PassRetriever

ConstantRetriever returns a new Retriever which will return a constant string as a passphrase.

func GetPassphrase Uses

func GetPassphrase(in *bufio.Reader) ([]byte, error)

GetPassphrase get the passphrase from bufio.Reader or from terminal. If typing on the terminal, we disable terminal to echo the passphrase.

func PromptRetriever Uses

func PromptRetriever() notary.PassRetriever

PromptRetriever returns a new Retriever which will provide a prompt on stdin and stdout to retrieve a passphrase. stdin will be checked if it is a terminal, else the PromptRetriever will error when attempting to retrieve a passphrase. Upon successful passphrase retrievals, the passphrase will be cached such that subsequent prompts will produce the same passphrase.

func PromptRetrieverWithInOut Uses

func PromptRetrieverWithInOut(in io.Reader, out io.Writer, aliasMap map[string]string) notary.PassRetriever

PromptRetrieverWithInOut returns a new Retriever which will provide a prompt using the given in and out readers. The passphrase will be cached such that subsequent prompts will produce the same passphrase. aliasMap can be used to specify display names for TUF key aliases. If aliasMap is nil, a sensible default will be used.

Package passphrase imports 9 packages (graph) and is imported by 339 packages. Updated 2018-02-15. Refresh now. Tools for package owners.