Skip to main content

gitway_lib/
lib.rs

1// SPDX-License-Identifier: GPL-3.0-or-later
2// Rust guideline compliant 2026-04-05
3// S3: enforce zero unsafe in all project-owned code at compile time.
4#![forbid(unsafe_code)]
5//! # gitway-lib
6//!
7//! Purpose-built SSH transport library for Git operations against GitHub,
8//! GitLab, Codeberg, and self-hosted Git instances.
9//!
10//! Written in pure Rust on top of [`russh`](https://docs.rs/russh) v0.59, it
11//! replaces the general-purpose `ssh` binary in the Git transport pipeline.
12//!
13//! ## Quick start
14//!
15//! ```no_run
16//! use gitway_lib::{GitwayConfig, GitwaySession};
17//!
18//! # async fn doc() -> Result<(), gitway_lib::GitwayError> {
19//! // GitHub
20//! let config = GitwayConfig::github();
21//! // GitLab
22//! let config = GitwayConfig::gitlab();
23//! // Codeberg
24//! let config = GitwayConfig::codeberg();
25//!
26//! let mut session = GitwaySession::connect(&config).await?;
27//! session.authenticate_best(&config).await?;
28//!
29//! let exit_code = session.exec("git-upload-pack 'user/repo.git'").await?;
30//! session.close().await?;
31//! # Ok(())
32//! # }
33//! ```
34//!
35//! ## Design principles
36//!
37//! - **Pinned host keys** — SHA-256 fingerprints for GitHub, GitLab, and
38//!   Codeberg are embedded; no TOFU (Trust On First Use) for known hosts.
39//! - **Narrow scope** — only exec channels; no PTY, SFTP, or port forwarding.
40//! - **Post-quantum ready** — uses `aws-lc-rs` for cryptography.
41//! - **Metric / SI / ISO 8601** throughout all timestamps and measurements.
42
43pub mod auth;
44pub mod config;
45pub mod error;
46pub mod hostkey;
47pub mod relay;
48pub mod session;
49
50// ── Flat re-exports (FR-23) ───────────────────────────────────────────────────
51
52pub use config::GitwayConfig;
53pub use error::GitwayError;
54pub use session::GitwaySession;