Thanks to visit codestin.com
Credit goes to lib.rs

1 unstable release

new 0.1.0 Dec 23, 2025

#458 in Authentication


Used in guts-node

MIT/Apache

280KB
6.5K SLoC

guts-compat

Git and GitHub compatibility layer for Guts.

Overview

This crate provides compatibility with existing Git workflows:

  • Personal Access Tokens - API authentication
  • User Management - Profile and settings
  • Releases - Tagged releases with assets
  • Contents API - File access via REST

Usage

use guts_compat::{PersonalAccessToken, Release, User};

// Create a personal access token
let token = PersonalAccessToken::generate(user_id, scopes)?;

// Create a release
let release = Release::new("v1.0.0", "First stable release")?;

Part of Guts

This crate is part of Guts, a decentralized, censorship-resistant alternative to GitHub built on BFT consensus.

License

MIT OR Apache-2.0


lib.rs:

Guts Compatibility Layer

Git and GitHub compatibility layer for the Guts code collaboration platform.

This crate provides:

  • User Accounts: User registration and profile management
  • Personal Access Tokens: Token-based authentication for API and Git operations
  • SSH Keys: SSH key management for future SSH protocol support
  • Releases: Release and asset management
  • Contents API: Repository file browsing
  • Archive Downloads: Tarball and zipball generation
  • Rate Limiting: GitHub-compatible rate limiting
  • Pagination: GitHub-style Link header pagination

Example

use guts_compat::{CompatStore, TokenScope};

// Create a store
let store = CompatStore::new();

// Create a user
let user = store.users.create(
    "alice".to_string(),
    "ed25519_pubkey_hex".to_string(),
).unwrap();

// Create a personal access token
let (token, plaintext) = store.tokens.create(
    user.id,
    "CI/CD Token".to_string(),
    vec![TokenScope::RepoRead, TokenScope::RepoWrite],
    None, // No expiration
).unwrap();

println!("Token: {}", plaintext);

// Verify the token later
let (user_id, scopes) = store.tokens.verify(&plaintext).unwrap();
assert_eq!(user_id, user.id);

Authentication

Tokens can be used in several ways:

# Bearer token (recommended)
curl -H "Authorization: Bearer guts_abc12345_XXXXX" https://api.guts.network/user

# Token header (GitHub-style)
curl -H "Authorization: token guts_abc12345_XXXXX" https://api.guts.network/user

# Basic auth (username:token)
curl -u "alice:guts_abc12345_XXXXX" https://api.guts.network/user

Rate Limiting

All API responses include rate limit headers:

X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1234567890
X-RateLimit-Used: 1
X-RateLimit-Resource: core

Dependencies

~23–42MB
~659K SLoC