Documentation ¶
Overview ¶
Package passphrase is a utility function for managing passphrase for TUF and Notary keys.
Index ¶
Constants ¶
This section is empty.
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") )
Functions ¶
This section is empty.
Types ¶
type Retriever ¶
type Retriever func(keyName, alias string, createNew bool, attempts int) (passphrase string, giveup bool, err error)
Retriever is a callback function that should retrieve a passphrase for a given named key. If it should be treated as new passphrase (e.g. with confirmation), createNew will be true. Attempts is passed in so that implementers decide how many chances to give to a human, for example.
func PromptRetriever ¶
func PromptRetriever() Retriever
PromptRetriever returns a new Retriever which will provide a prompt on stdin and stdout to retrieve a passphrase. The passphrase will be cached such that subsequent prompts will produce the same passphrase.
func PromptRetrieverWithInOut ¶
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.