git_lfs_creds/lib.rs
1//! Credential helper bridge for Git LFS (git credential fill/approve/reject).
2//!
3//! LFS endpoints are usually HTTPS, and HTTPS auth needs a username
4//! and password. Rather than maintaining a separate credential store,
5//! this crate defers to git's existing one: whatever the user has
6//! already configured for their git remote (osxkeychain, libsecret,
7//! manager, store, plain `cache`, …) is what LFS uses too.
8//!
9//! The [`Helper`] trait represents one credential source. A
10//! [`HelperChain`] tries multiple sources in order, broadcasting
11//! [`Helper::approve`] / [`Helper::reject`] to every helper so caches
12//! stay in sync. The bundled implementations are:
13//!
14//! - [`CachingHelper`]: in-process cache keyed on the [`Query`]
15//! tuple (protocol, host, path).
16//! - [`GitCredentialHelper`]: shells out to `git credential
17//! fill/approve/reject`, picking up whatever helper the user has
18//! configured.
19//! - [`AskpassHelper`]: spawns the `GIT_ASKPASS` / `core.askpass` /
20//! `SSH_ASKPASS` program for interactive prompts.
21//! - [`NetrcCredentialHelper`]: parses `~/.netrc` (or `_netrc` on
22//! Windows) for host-keyed login/password pairs.
23//!
24//! SSH remotes follow a different flow. [`SshAuthClient`] runs
25//! `git-lfs-authenticate <path> <operation>` over SSH and parses an
26//! [`SshAuth`] response containing a replacement HTTPS endpoint plus
27//! short-lived authorization headers; no username/password is asked
28//! of the user. Results are cached per request key with the
29//! server-supplied expiry honored.
30
31mod askpass;
32mod chain;
33mod git_helper;
34mod helper;
35mod memory;
36mod netrc;
37mod query;
38mod ssh;
39mod trace;
40
41pub use askpass::AskpassHelper;
42pub use chain::HelperChain;
43pub use git_helper::GitCredentialHelper;
44pub use helper::{Credentials, Helper, HelperError};
45pub use memory::CachingHelper;
46pub use netrc::NetrcCredentialHelper;
47pub use query::Query;
48pub use ssh::{SshAuth, SshAuthClient, SshAuthError, SshOperation};