10 stable releases

1.3.1 Mar 13, 2024
1.3.0 Mar 6, 2024
1.2.3 Feb 27, 2024
1.2.1 Nov 23, 2023
1.0.1 Apr 16, 2019

#89 in Authentication

Download history 28051/week @ 2024-07-26 30234/week @ 2024-08-02 28793/week @ 2024-08-09 31175/week @ 2024-08-16 30186/week @ 2024-08-23 39698/week @ 2024-08-30 36398/week @ 2024-09-06 29759/week @ 2024-09-13 32999/week @ 2024-09-20 35817/week @ 2024-09-27 37366/week @ 2024-10-04 36049/week @ 2024-10-11 42437/week @ 2024-10-18 45979/week @ 2024-10-25 43440/week @ 2024-11-01 41636/week @ 2024-11-08

181,004 downloads per month
Used in 92 crates (13 directly)

MIT/Apache

20KB
401 lines

docker_credential

Latest version Documentation

A Rust library for reading a user's Docker or Podman credentials from config.

Parses a docker config.json either at the location specified by the $DOCKER_CONFIG environment variable or in $HOME/.docker. If credential helpers or a credential store is configured these will be contacted to retrieve the requested credential.

Usage

Add the following to your cargo.toml:

[dependencies]
docker_credential = "1.0.1"

Then invoke from within your along the lines of:

use docker_credential;
use docker_credential::DockerCredential;

let credential = docker_credential::get_credential("https://index.docker.io/v1/").expect("Unable to retrieve credential");

match credential {
  DockerCredential::IdentityToken(token) => println!("Identity token: {}", token),
  DockerCredential::UsernamePassword(user_name, password) => println!("Username: {}, Password: {}", user_name, password),
};

Dependencies

~1–1.8MB
~39K SLoC