mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00

This is to bring us into conformance with the [Rust crate ownership policy](https://forge.rust-lang.org/policies/crate-ownership.html). Items of note - `cargo-credential-1password` is declared as Experimental as it is intended for the community but I was unsure if we wanted to commit to full support for it. In my mind, the ideal thing to do would be to expatriate this to 1password. - `home` is declared as Internal despite its wide use within the ecosystem. - `cargo-credential` is declared as Intentional as its an API intended for the wider ecosystem and I didn't see a reason to declare it experimental. - `cargo-platform`, `cargo-util-schemas`, and `crates-io` are declared as Intentional as they are both used internally and intended for others to use for logic that integrates with cargo/registries. I wondered about these being Experimental or Internal instead.
1.1 KiB
1.1 KiB
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
This crate is maintained by the Cargo team for use by the wider ecosystem. This crate follows semver compatibility for its APIs.
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);
}