cargo/credential/cargo-credential
2024-05-27 21:27:03 -05:00
..
examples Remove repetitive words 2023-12-29 13:55:24 +08:00
src refactor: Resolve snapbox deprecations 2024-05-27 10:28:13 -05:00
tests refactor: Resolve deprecations 2024-05-27 21:27:03 -05:00
Cargo.toml chore: Bump cargo-credential 2024-05-24 14:55:42 -05:00
LICENSE-APACHE credential: include license files in all published crates 2023-11-10 17:12:40 +01:00
LICENSE-MIT credential: include license files in all published crates 2023-11-10 17:12:40 +01:00
README.md feat: stabilize credential-process and registry-auth 2023-09-16 22:40:45 -05:00

cargo-credential

This package is a library to assist writing a Cargo credential helper, which provides an interface to store tokens for authorizing access to a registry such as https://crates.io/.

Documentation about credential processes may be found at https://doc.rust-lang.org/nightly/cargo/reference/credential-provider-protocol.html

Example implementations may be found at https://github.com/rust-lang/cargo/tree/master/credential

Usage

Create a Cargo project with this as a dependency:

# Add this to your Cargo.toml:

[dependencies]
cargo-credential = "0.4"

And then include a main.rs binary which implements the Credential trait, and calls the main function which will call the appropriate method of the trait:

// src/main.rs

use cargo_credential::{Credential, Error};

struct MyCredential;

impl Credential for MyCredential {
    /// implement trait methods here...
}

fn main() {
    cargo_credential::main(MyCredential);
}