Documentation ¶
Index ¶
- func Erase(program ProgramFunc, serverURL string) error
- func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error)
- func List(program ProgramFunc) (map[string]string, error)
- func Store(program ProgramFunc, creds *credentials.Credentials) error
- type Program
- type ProgramFunc
- type Shell
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Erase ¶
func Erase(program ProgramFunc, serverURL string) error
Erase executes a program to remove the server credentials from the native store.
Example ¶
p := NewShellProgramFunc("docker-credential-secretservice") if err := Erase(p, "https://example.com"); err != nil { fmt.Println(err) }
Output:
func Get ¶
func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error)
Get executes an external program to get the credentials from a native store.
Example ¶
p := NewShellProgramFunc("docker-credential-secretservice") creds, err := Get(p, "https://example.com") if err != nil { fmt.Println(err) } fmt.Printf("Got credentials for user `%s` in `%s`\n", creds.Username, creds.ServerURL)
Output:
func List ¶
func List(program ProgramFunc) (map[string]string, error)
List executes a program to list server credentials in the native store.
func Store ¶
func Store(program ProgramFunc, creds *credentials.Credentials) error
Store uses an external program to save credentials.
Example ¶
p := NewShellProgramFunc("docker-credential-secretservice") c := &credentials.Credentials{ ServerURL: "https://example.com", Username: "calavera", Secret: "my super secret token", } if err := Store(p, c); err != nil { fmt.Println(err) }
Output:
Types ¶
type ProgramFunc ¶
ProgramFunc is a type of function that initializes programs based on arguments.
func NewShellProgramFunc ¶
func NewShellProgramFunc(name string) ProgramFunc
NewShellProgramFunc creates programs that are executed in a Shell.
func NewShellProgramFuncWithEnv ¶
func NewShellProgramFuncWithEnv(name string, env *map[string]string) ProgramFunc
NewShellProgramFuncWithEnv creates programs that are executed in a Shell with environment variables
Click to show internal directories.
Click to hide internal directories.