package client
import "github.com/docker/docker-credential-helpers/client"
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
- func NewShellProgramFunc(command string) ProgramFunc
- func NewShellProgramFuncWithEnv(command string, env *map[string]string) ProgramFunc
- type Shell
Examples ¶
Functions ¶
func Erase ¶
func Erase(program ProgramFunc, serverURL string) error
Erase executes a program to remove the server credentials from the native store.
Code:
Example¶
{
p := NewShellProgramFunc("docker-credential-pass")
if err := Erase(p, "https://registry.example.com"); err != nil {
_, _ = fmt.Println(err)
}
}
func Get ¶
func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error)
Get executes an external program to get the credentials from a native store.
Code:
Example¶
{
p := NewShellProgramFunc("docker-credential-pass")
creds, err := Get(p, "https://registry.example.com")
if err != nil {
_, _ = fmt.Println(err)
}
_, _ = fmt.Printf("Got credentials for user `%s` in `%s`\n", creds.Username, creds.ServerURL)
}
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.
Code:
Example¶
{
p := NewShellProgramFunc("docker-credential-pass")
c := &credentials.Credentials{
ServerURL: "https://registry.example.com",
Username: "exampleuser",
Secret: "my super secret token",
}
if err := Store(p, c); err != nil {
_, _ = fmt.Println(err)
}
}
Types ¶
type Program ¶
Program is an interface to execute external programs.
type ProgramFunc ¶
ProgramFunc is a type of function that initializes programs based on arguments.
func NewShellProgramFunc ¶
func NewShellProgramFunc(command string) ProgramFunc
NewShellProgramFunc creates a ProgramFunc to run command in a Shell.
func NewShellProgramFuncWithEnv ¶
func NewShellProgramFuncWithEnv(command string, env *map[string]string) ProgramFunc
NewShellProgramFuncWithEnv creates a ProgramFunc tu run command in a Shell with the given environment variables.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell invokes shell commands to talk with a remote credentials-helper.
func (*Shell) Input ¶
Input sets the input to send to a remote credentials-helper.
func (*Shell) Output ¶
Output returns responses from the remote credentials-helper.
Source Files ¶
- Version
- v0.9.3 (latest)
- Published
- Mar 14, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 2 days ago –
Tools for package owners.