Skip to main content

verify_commit_signature

Function verify_commit_signature 

Source
pub async fn verify_commit_signature(
    commit_content: &[u8],
    allowed_keys: &[Ed25519PublicKey],
    provider: &dyn CryptoProvider,
    _repo_path: Option<&Path>,
) -> Result<VerifiedCommit, CommitVerificationError>
Expand description

Verify an SSH-signed git commit against a list of allowed Ed25519 keys.

Args:

  • commit_content: Raw output of git cat-file commit <sha>.
  • allowed_keys: Ed25519 public keys authorized to sign.
  • provider: Crypto backend for Ed25519 verification.
  • repo_path: Optional path to the git repository. When provided, the verifier uses this path for any repo-relative operations instead of requiring callers to chdir.

Usage:

let verified = verify_commit_signature(content, &keys, &provider, Some(Path::new("/repo"))).await?;