moltrust

April 25, 2026 · View on GitHub

PyPI Python License

DID resolver and trust layer for the agent economy. Python + TypeScript SDKs for did:moltrust:* and did:web:* resolution against api.moltrust.ch.

What is MolTrust?

MolTrust resolves W3C Decentralized Identifiers (DIDs) for autonomous agents and exposes trust scores, verifiable credentials, and reputation signals through a single API. It is operated by CryptoKRI GmbH, Zürich.

This package ships two SDKs:

  • Python (pip install moltrust) — primary, includes the DID resolver
  • TypeScript (npm install @moltrust/sdk) — standalone trust verification

Quick Start (Python)

pip install moltrust

Resolve a DID:

from moltrust import MolTrustResolver

with MolTrustResolver() as resolver:
    doc = resolver.resolve("did:moltrust:d34ed796a4dc4698")
    print(doc.id)
    # did:moltrust:d34ed796a4dc4698

Async variant:

from moltrust import AsyncMolTrustResolver

async with AsyncMolTrustResolver() as resolver:
    doc = await resolver.resolve("did:web:api.moltrust.ch")
    print(doc.id)

Use as a drop-in resolver for any DID-aware harness that accepts the W3C resolution Protocol:

from moltrust import MolTrustResolver

# Constructor injection: any harness that accepts a `resolve(did) -> DIDDocument`
# Protocol can use MolTrustResolver as-is.
harness = SomeHarness(resolver=MolTrustResolver())

Supported DID Methods

MethodStatusNotes
did:moltrust:*✅ NativeIncluding bridge-resolved did:moltrust:ext_*
did:web:*✅ NativeResolved via the MolTrust API or directly per W3C spec
did:agentnexus:*🔜 RoadmapBridge-resolution path planned
did:meeet:*🔜 RoadmapBridge-resolution path planned
did:key:*❌ Out of scopeUse a did:key resolver such as didkit-py
OthermethodNotSupportedCaller can fall back to a different resolver

Errors

MolTrustResolver.resolve() raises ResolutionError with a reason attribute matching the W3C error codes:

ReasonWhen
methodNotSupportedDID method not handled by this resolver
notFoundDID syntactically valid, no document found
invalidDidMalformed DID input
didNotResolvedNetwork error, malformed response, etc.

Other Python APIs

from moltrust import MolTrust, AsyncMolTrust

with MolTrust(api_key="mt_...") as mt:
    agent = mt.register("My Agent")
    rep = mt.get_reputation(agent.did)
    cred = mt.issue_credential(agent.did)

See moltrust.client.MolTrust for the full client API.


Quick Start (TypeScript)

npm install @moltrust/sdk
import { AgentTrust } from '@moltrust/sdk';

const result = await AgentTrust.verify('did:moltrust:abc123');
if (!result.verified) throw new Error(result.reason);

VerificationResult

{
  verified: boolean;     // true if all checks passed
  did: string;
  trustScore: number;    // 0-100
  grade: string;         // "A" | "B" | "C" | "D" | "F"
  flags: string[];       // anomaly flags (empty = clean)
  reason?: string;       // why verified=false
  checkedAt: string;     // ISO timestamp
}

Express Middleware

import express from 'express';
import { AgentTrust } from '@moltrust/sdk';

const app = express();

app.use('/api/action', AgentTrust.middleware({ minScore: 70 }));

app.post('/api/action', (req, res) => {
  const trust = req.agentVerification;
  res.json({ ok: true, trust });
});

Hono Middleware

import { Hono } from 'hono';
import { agentTrust } from '@moltrust/sdk/hono';

const app = new Hono();
app.use('/secure/*', agentTrust({ minScore: 60 }));

Trust Flags

Informational anomaly signals — no score deduction:

FlagTrigger
repetitive_endorsements>80% of endorsements to one DID
low_confidenceActive in only 1 vertical after 30+ days
young_endorser_clusterEndorsed by >5 agents under 7 days old
score_drop_anomalyScore dropped >20 points in 24h

Headers Convention

HeaderPurpose
X-Agent-DIDAgent's MolTrust DID (primary)
X-Agent-CredentialCredential ID for AAE lookup
Authorization: Bearer did:...Fallback DID extraction

Used By

License

MIT — see LICENSE.

Full developer docs: https://moltrust.ch/developers Open issues: https://github.com/MoltyCel/moltrust-sdk/issues