MolTrust SDK — DID resolver and trust layer for the agent economy
Project description
moltrust
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
- aeoess/a2a-compliance-harness — A2A protocol compliance probing (drop-in via constructor injection)
License
MIT — see LICENSE.
Full developer docs: https://moltrust.ch/developers Open issues: https://github.com/MoltyCel/moltrust-sdk/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moltrust-0.2.0.tar.gz.
File metadata
- Download URL: moltrust-0.2.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb178a0e2929c461b31f03b365d2330241ade64ad94ee94121c5c8090a403fe1
|
|
| MD5 |
d5ee5f6780e6edb761760c641f92fc25
|
|
| BLAKE2b-256 |
b9423b93cbe05b1fd6281439594adfac2ed0c3a414cbdd19d888a8a9c60c71b6
|
Provenance
The following attestation bundles were made for moltrust-0.2.0.tar.gz:
Publisher:
publish.yml on MoltyCel/moltrust-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moltrust-0.2.0.tar.gz -
Subject digest:
eb178a0e2929c461b31f03b365d2330241ade64ad94ee94121c5c8090a403fe1 - Sigstore transparency entry: 1381797081
- Sigstore integration time:
-
Permalink:
MoltyCel/moltrust-sdk@5f4d307c167867925e85cf1b25dc49fde7b0e321 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MoltyCel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f4d307c167867925e85cf1b25dc49fde7b0e321 -
Trigger Event:
push
-
Statement type:
File details
Details for the file moltrust-0.2.0-py3-none-any.whl.
File metadata
- Download URL: moltrust-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb8b0d451c6a40e71c78ecb87786a04277cca1b50091d6d08b50ad6312b8220
|
|
| MD5 |
ffb56d86981d28511ee987ccc103d4b3
|
|
| BLAKE2b-256 |
4ffc7f278a6d50e14a76bfe15654b792b352373630781c37c8a7a93d8effaacb
|
Provenance
The following attestation bundles were made for moltrust-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on MoltyCel/moltrust-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moltrust-0.2.0-py3-none-any.whl -
Subject digest:
9fb8b0d451c6a40e71c78ecb87786a04277cca1b50091d6d08b50ad6312b8220 - Sigstore transparency entry: 1381797125
- Sigstore integration time:
-
Permalink:
MoltyCel/moltrust-sdk@5f4d307c167867925e85cf1b25dc49fde7b0e321 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MoltyCel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f4d307c167867925e85cf1b25dc49fde7b0e321 -
Trigger Event:
push
-
Statement type: