summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/credential/cargo-credential/README.md
blob: 049b3ba552d20886f3bb9fd800b139771d9c9bc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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/unstable.html#credential-process

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:

```toml
# Add this to your Cargo.toml:

[dependencies]
cargo-credential = "0.3"
```

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:

```rust
// src/main.rs

use cargo_credential::{Credential, Error};

struct MyCredential;

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

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