Skip to main content

moltrust

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

Method Status Notes
did:moltrust:* ✅ Native Including bridge-resolved did:moltrust:ext_*
did:web:* ✅ Native Resolved via the MolTrust API or directly per W3C spec
did:agentnexus:* 🔜 Roadmap Bridge-resolution path planned
did:meeet:* 🔜 Roadmap Bridge-resolution path planned
did:key:* ❌ Out of scope Use a did:key resolver such as didkit-py
Other methodNotSupported Caller can fall back to a different resolver

Errors

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

Reason When
methodNotSupported DID method not handled by this resolver
notFound DID syntactically valid, no document found
invalidDid Malformed DID input
didNotResolved Network 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:

Flag Trigger
repetitive_endorsements >80% of endorsements to one DID
low_confidence Active in only 1 vertical after 30+ days
young_endorser_cluster Endorsed by >5 agents under 7 days old
score_drop_anomaly Score dropped >20 points in 24h

Headers Convention

Header Purpose
X-Agent-DID Agent's MolTrust DID (primary)
X-Agent-Credential Credential 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

Metadata

Release files for moltrust 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moltrust 0.2.0
File Size Uploaded
moltrust-0.2.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moltrust 0.2.0
File Interpreter ABI Platform
moltrust-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / moltrust-0.2.0.tar.gz

Download URL moltrust-0.2.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb178a0e2929c461b31f03b365d2330241ade64ad94ee94121c5c8090a403fe1
BLAKE2b-256 checksum
How to use checksums
b9423b93cbe05b1fd6281439594adfac2ed0c3a414cbdd19d888a8a9c60c71b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release files / moltrust-0.2.0-py3-none-any.whl

Download URL moltrust-0.2.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fb8b0d451c6a40e71c78ecb87786a04277cca1b50091d6d08b50ad6312b8220
BLAKE2b-256 checksum
How to use checksums
4ffc7f278a6d50e14a76bfe15654b792b352373630781c37c8a7a93d8effaacb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page