Quickstart

Create two agents with post-quantum identity and exchange signed messages.

from trusthub import TrustAgent

# Create agents with ML-DSA-65 identity
alice = TrustAgent.create(org="acme", entity_type="agent")
bob = TrustAgent.create(org="acme", entity_type="human")

# Sign a message
signed = alice.sign_message(b"Transfer $500 to account XYZ")
print(f"DID: {alice.did}")
print(f"Algorithm: {signed.algorithm}")  # ML-DSA-65

# Verify (Bob needs Alice's DID document)
bob._resolver.register(alice.did_document)
assert bob.verify_message(signed, alice.did)
print("Verified!")

Trust Scoring

from trusthub import LedgerStore, TrustScorer
from trusthub.constants import LedgerEntryType

store = LedgerStore("ledger.db")

# Record trust proofs
store.append(LedgerEntryType.TRUST_PROOF,
             alice.did, bob.did, {"proof": "verified"})

# Compute trust score
scorer = TrustScorer(store)
score = scorer.compute_score(bob.did)
print(f"Trust Score: {score.score:.1%}")
print(f"Components: {score.components}")

Next Steps