The client
package in the docker-credential-helpers project provides functions for interacting with credential helpers from other command-line applications. It includes the following functions:
NewClient
: creates a new client for interacting with credential helpers.GetSecrets
: retrieves secrets from the specified credential helper.StoreSecrets
: stores secrets in the specified credential helper.ListHelpers
: lists all available credential helpers.
Here are examples of how to use each function:
- Creating a new client:
client, err := client.NewClient("osxkeychain")
if err != nil {
// handle error
}
- Retrieving secrets:
secrets, err := client.GetSecrets("my.registry.com", "my-username", "my-password")
if err != nil {
// handle error
}
fmt.Println(secrets)
- Storing secrets:
err := client.StoreSecrets("my.registry.com", "my-username", "my-password")
if err != nil {
// handle error
}
- Listing available credential helpers:
helpers, err := client.ListHelpers()
if err != nil {
// handle error
}
fmt.Println(helpers)
These functions allow developers to interact with credential helpers programmatically, making it easier to manage credentials for different registries and applications.
Sources:
- docker-credential-helpers documentation
- Docker credential helpers protocol documentation
- Docker Desktop release notes
- Authenticate with the Container Registry documentation
- Sign in documentation for Open Policy Containers
- Compatible OCI Registries documentation
- Authentication documentation for OCI Registry As Storage
- Configuration documentation for Prometheus
- Configuration documentation for Prometheus (latest version)