cargo/credential/cargo-credential
Ed Page c6c1df4758 chore: Make N-2 the default MSRV
We likely don't want to release these packages every 6 months just for
an MSRV bump.
By moving the MSRV out of the package, `cargo bump-check` will ignore
the MSRV bump.

Inspired by #13266
2024-01-18 15:30:41 -06:00
..
examples Remove repetitive words 2023-12-29 13:55:24 +08:00
src lint: allow print_stdout and print_stderr 2023-11-16 11:35:21 -05:00
tests Remove repetitive words 2023-12-29 13:55:24 +08:00
Cargo.toml chore: Make N-2 the default MSRV 2024-01-18 15:30:41 -06: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);
}