Skip to content

baseid-proofs

Build verifiable identity chains linking your DID to social accounts, domains, and signing keys. Each proof is hash-linked and auditable via Merkle trees.

  • Sigchains — append-only, hash-linked identity logs where every entry is immutable and cryptographically chained to the previous
  • Identity Statements — five types: SocialProof, DomainProof, KeyAddition, KeyRevocation, Endorsement
  • Merkle Trees — efficient inclusion proofs let anyone verify a specific identity claim without downloading the entire chain
  • Social Verification — pluggable adapters for platform-specific proof verification (GitHub gist, DNS TXT, Mastodon)
  • Key Rotation Tracking — full history of key additions and revocations with active key computation
use baseid_proofs::*;
// Create a sigchain for a DID
let mut chain = Sigchain::new("did:key:alice");
// Append a social proof (e.g., GitHub ownership)
chain.append(IdentityStatement::SocialProof {
platform: "github".to_string(),
username: "alice-dev".to_string(),
proof_url: "https://gist.github.com/alice-dev/proof".to_string(),
});
// Append a domain proof (DNS TXT record)
chain.append(IdentityStatement::DomainProof {
domain: "alice.dev".to_string(),
method: DomainVerificationMethod::DnsTxt,
value: "did:key:alice".to_string(),
});
// Verify the integrity of the entire chain
assert!(chain.verify_integrity().is_ok());
assert_eq!(chain.len(), 2);
assert_eq!(chain.social_proofs().len(), 1);
assert_eq!(chain.domain_proofs().len(), 1);
VariantFieldsDescription
SocialProofplatform, username, proof_urlProves ownership of a social media account
DomainProofdomain, method, valueProves ownership of a domain via DNS TXT or .well-known
KeyAdditionkey_id, key_type, purposeRecords addition of a new signing key
KeyRevocationkey_id, reasonRecords revocation of an existing key
Endorsementendorser, claim, signaturePeer endorsement from another DID

Track the full lifecycle of signing keys through the sigchain:

let mut chain = Sigchain::new("did:key:alice");
chain.append(IdentityStatement::KeyAddition {
key_id: "key-1".to_string(),
key_type: "Ed25519".to_string(),
purpose: "authentication".to_string(),
});
chain.append(IdentityStatement::KeyAddition {
key_id: "key-2".to_string(),
key_type: "P256".to_string(),
purpose: "assertion".to_string(),
});
assert_eq!(chain.active_keys(), vec!["key-1", "key-2"]);
// Revoke key-1
chain.append(IdentityStatement::KeyRevocation {
key_id: "key-1".to_string(),
reason: "rotated".to_string(),
});
assert_eq!(chain.active_keys(), vec!["key-2"]);

Build a Merkle tree from a sigchain and generate inclusion proofs:

use baseid_proofs::*;
let mut chain = Sigchain::new("did:key:alice");
for i in 0..4 {
chain.append(IdentityStatement::SocialProof {
platform: format!("platform-{i}"),
username: "alice".to_string(),
proof_url: format!("https://example.com/proof-{i}"),
});
}
// Build the tree
let tree = IdentityTree::build(&chain);
assert_eq!(tree.leaf_count(), 4);
// Generate and verify an inclusion proof for entry 2
let proof = tree.prove_inclusion(2).unwrap();
assert!(IdentityTree::verify_proof(&proof));

Pluggable verification adapters validate proof ownership:

use baseid_proofs::*;
// Mock verifier for testing — accepts proofs where proof_url contains the DID
let verifier = MockSocialVerifier;
let stmt = IdentityStatement::SocialProof {
platform: "github".to_string(),
username: "alice".to_string(),
proof_url: "https://gist.github.com/alice/did:key:alice-proof".to_string(),
};
let result = verifier.verify(&stmt, "did:key:alice").unwrap();
assert!(result.verified);
// GenericVerifier validates URL format without fetching
let generic = GenericVerifier;
let result = generic.verify(&stmt, "did:key:alice").unwrap();
assert!(result.verified);
TypeDescription
SigchainAppend-only, hash-linked identity log
SigchainEntrySingle entry with sequence, statement, prev_hash, hash, timestamp
IdentityStatementTagged enum: SocialProof, DomainProof, KeyAddition, KeyRevocation, Endorsement
DomainVerificationMethodDnsTxt or WellKnown
IdentityTreeMerkle tree built from sigchain entry hashes
MerkleProofInclusion proof with leaf_hash, path, and root
MerkleProofStepSingle step in the proof path with hash and position
SocialVerifierTrait for platform-specific proof verification adapters
MockSocialVerifierTest verifier that checks proof_url contains the owner DID
GenericVerifierValidates URL format without network fetching
ProofErrorBilingual error type (EN/FR)

When using baseid-server, identity proof operations are available via REST:

MethodEndpointDescription
POST/api/proofs/sigchainCreate a new sigchain for a DID
GET/api/proofs/sigchain/:didGet the full sigchain
POST/api/proofs/sigchain/:did/appendAppend an identity statement
GET/api/proofs/sigchain/:did/verifyVerify chain integrity
POST/api/proofs/merkle/:didBuild Merkle tree and return root
POST/api/proofs/merkle/:did/proveGenerate an inclusion proof for an entry
  • baseid-core — ClaimSet, lifecycle traits, bilingual errors
  • baseid-did — DID resolution for sigchain owners
  • baseid-vc — Verifiable Credentials (sigchain entries can be issued as VCs)
  • baseid-trust — Reputation attestations complement identity proofs