Skip to main content

Crate sync_auth

Crate sync_auth 

Source
Expand description

sync-auth — Bidirectional auth credential sync for dev tools via Git repositories.

This library provides a trait-based, extensible system for syncing authentication credentials for developer tools (GitHub CLI, GitLab CLI, Claude Code, Codex, Gemini CLI, etc.) through a Git repository backend.

§Architecture

  • AuthProvider trait: implement to add support for any dev tool’s credentials
  • [GitBackend] trait: implement to customize how credentials are stored/fetched
  • SyncEngine: orchestrates bidirectional sync between local and remote
  • Built-in providers for common tools via providers module

§Example

use sync_auth::{SyncEngine, SyncConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = SyncConfig {
        repo_url: "https://github.com/user/my-credentials.git".to_string(),
        local_path: "/tmp/sync-auth-repo".into(),
        providers: vec!["gh".to_string(), "claude".to_string()],
        ..Default::default()
    };
    let engine = SyncEngine::new(config)?;
    engine.pull().await?;
    Ok(())
}

Modules§

backend
Git backend for credential storage and retrieval.
providers
Built-in auth providers for common dev tools.

Structs§

CredentialFile
Credential file entry describing a single file to sync.
SyncConfig
Configuration for the sync engine.
SyncEngine
The sync engine coordinates pulling credentials from a Git repo to local filesystem and pushing local credentials to the repo.

Enums§

SyncError
Errors that can occur during sync operations.
ValidationResult
Result of validating a credential.

Constants§

VERSION
Package version (matches Cargo.toml version).

Traits§

AuthProvider
Trait for auth credential providers.