Documentation
¶
Overview ¶
A `pass` based credential helper. Passwords are stored as arguments to pass of the form: "$PASS_FOLDER/base64-url(serverURL)/username". We base64-url encode the serverURL, because under the hood pass uses files and folders, so /s will get translated into additional folders.
Index ¶
- Constants
- Variables
- func Erase(helper StoreHelper, reader io.Reader) error
- func Get(helper StoreHelper, reader io.Reader, writer io.Writer) error
- func IsCredentialsMissingServerURL(err error) bool
- func IsCredentialsMissingServerURLMessage(err string) bool
- func IsCredentialsMissingUsername(err error) bool
- func IsCredentialsMissingUsernameMessage(err string) bool
- func IsErrCredentialsNotFound(err error) bool
- func IsErrCredentialsNotFoundMessage(err string) bool
- func List(helper StoreHelper, writer io.Writer) error
- func NewErrCredentialsMissingServerURL() error
- func NewErrCredentialsMissingUsername() error
- func NewErrCredentialsNotFound() error
- func SetCredsLabel(label string)
- func Store(helper StoreHelper, reader io.Reader) error
- type Credentials
- type Pass
- type StoreHelper
Constants ¶
const PASS_FOLDER = cst.CmdRoot
Variables ¶
var CredsLabel = "Vault Token"
CredsLabel holds the way Docker credentials should be labeled as such in credentials stores that allow labeling. That label allows to filter out non-Docker credentials too at lookup/search in macOS keychain, Windows credentials manager and Linux libsecret. Default value is "Vault Token"
Functions ¶
func Erase ¶
func Erase(helper StoreHelper, reader io.Reader) error
Erase removes credentials from the store. The reader must contain the server URL to remove.
func Get ¶
Get retrieves the credentials for a given server url. The reader must contain the server URL to search. The writer is used to write the JSON serialization of the credentials.
func IsCredentialsMissingServerURL ¶
IsCredentialsMissingServerURL returns true if the error was an errCredentialsMissingServerURL.
func IsCredentialsMissingServerURLMessage ¶
IsCredentialsMissingServerURLMessage checks for an errCredentialsMissingServerURL in the error message.
func IsCredentialsMissingUsername ¶
IsCredentialsMissingUsername returns true if the error was an errCredentialsMissingUsername.
func IsCredentialsMissingUsernameMessage ¶
IsCredentialsMissingUsernameMessage checks for an errCredentialsMissingUsername in the error message.
func IsErrCredentialsNotFound ¶
IsErrCredentialsNotFound returns true if the error was caused by not having a set of credentials in a store.
func IsErrCredentialsNotFoundMessage ¶
IsErrCredentialsNotFoundMessage returns true if the error was caused by not having a set of credentials in a store.
This function helps to check messages returned by an external program via its standard output.
func List ¶
func List(helper StoreHelper, writer io.Writer) error
List returns all the serverURLs of keys in the OS store as a list of strings
func NewErrCredentialsMissingServerURL ¶
func NewErrCredentialsMissingServerURL() error
NewErrCredentialsMissingServerURL creates a new error for errCredentialsMissingServerURL.
func NewErrCredentialsMissingUsername ¶
func NewErrCredentialsMissingUsername() error
NewErrCredentialsMissingUsername creates a new error for errCredentialsMissingUsername.
func NewErrCredentialsNotFound ¶
func NewErrCredentialsNotFound() error
NewErrCredentialsNotFound creates a new error for when the credentials are not in the store.
func SetCredsLabel ¶
func SetCredsLabel(label string)
SetCredsLabel is a simple setter for CredsLabel
Types ¶
type Credentials ¶
Credentials holds the information shared between docker and the credentials store.
type Pass ¶
type Pass struct{}
Pass handles secrets using Linux secret-service as a store.
func (Pass) Add ¶
func (h Pass) Add(creds *Credentials) error
Add adds new credentials to the keychain.
func (Pass) CheckInitialized ¶
CheckInitialized checks whether the password helper can be used. It internally caches and so may be safely called multiple times with no impact on performance, though the first call may take longer.
type StoreHelper ¶
type StoreHelper interface {
// Add appends credentials to the store.
Add(*Credentials) error
// Delete removes credentials from the store.
Delete(serverURL string) error
// Get retrieves credentials from the store.
// It returns username and secret as strings.
Get(serverURL string) (string, string, error)
// List returns the stored serverURLs and their associated usernames.
List(prefix string) (map[string]string, error)
// GetName returns the friendly name of helper.
GetName() string
}
StoreHelper is the interface a credentials store helper must implement.