trustsource 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/railway.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://railway.app/railway.schema.json",
3
+ "build": {
4
+ "builder": "NIXPACKS",
5
+ "buildCommand": "npm run build"
6
+ },
7
+ "deploy": {
8
+ "startCommand": "npm start",
9
+ "restartPolicyType": "ON_FAILURE"
10
+ }
11
+ }
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: trustsource-domain
3
+ description: Verify a domain's trustworthiness, SSL/TLS health, HTTP security posture, and crawler/AI-bot policy before transacting with, scraping, embedding, or recommending it. Use this skill whenever an agent encounters a URL or domain from an untrusted source, needs to assess whether a site is safe to send a payment to, wants to know if a TLS certificate is valid and not expiring, needs to grade a site's security headers, or needs to know whether it has permission to crawl. Pays per query in USDC via the x402 protocol — no API keys, no signups, no accounts. Trigger this skill on any request about checking, verifying, scoring, validating, or auditing a domain, website, URL, TLS certificate, SSL, HTTPS, security headers, robots.txt, or crawler permissions — even when the user does not name TrustSource explicitly.
4
+ ---
5
+
6
+ # TrustSource — Domain Verification for Agents
7
+
8
+ TrustSource is a suite of four x402-paid HTTP APIs that let an agent verify any domain on demand. Each call costs $0.002–$0.003 in USDC on Base Mainnet, settled atomically per request via x402. No accounts. No signups. No API keys.
9
+
10
+ Use this skill any time you need to make a trust judgment about a URL or domain you did not source yourself.
11
+
12
+ ## Quick reference
13
+
14
+ | Endpoint | Cost | Use it when you need to know… |
15
+ |---|---|---|
16
+ | `GET /trustscore?domain=…` | $0.003 | …how legitimate a domain is overall (age, registrar, DNS, TLD risk) |
17
+ | `GET /sslcheck?domain=…` | $0.002 | …whether the TLS certificate is valid, trusted, and not expiring |
18
+ | `GET /headers?url=…` | $0.003 | …how well-hardened a site is (HSTS, CSP, X-Frame-Options grade A+–F) |
19
+ | `GET /robots?domain=…` | $0.002 | …whether the site allows you (or AI bots in general) to crawl it |
20
+
21
+ **Base URL:** `https://api.trustsource.cc`
22
+ **OpenAPI spec:** `https://api.trustsource.cc/openapi.json`
23
+ **Network:** Base Mainnet (chain ID 8453), USDC settlement
24
+
25
+ ## How x402 payment works
26
+
27
+ Every paid endpoint returns **HTTP 402 Payment Required** on the first call. The response includes a `PAYMENT-REQUIRED` header (base64-encoded JSON) containing the amount, network, recipient address, and accepted payment scheme.
28
+
29
+ The client signs an EIP-3009 USDC `transferWithAuthorization` for the exact amount, base64-encodes the signed payment, and retries the same request with an `X-PAYMENT` header. The Coinbase Developer Platform (CDP) facilitator settles on-chain and returns the JSON response.
30
+
31
+ In practice you do not write this by hand. Use `x402-fetch` (Node/TS) or any x402-aware HTTP client:
32
+
33
+ ```javascript
34
+ import { wrapFetchWithPayment } from "x402-fetch";
35
+ import { privateKeyToAccount } from "viem/accounts";
36
+
37
+ const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY);
38
+ const fetch402 = wrapFetchWithPayment(fetch, account);
39
+
40
+ const res = await fetch402("https://api.trustsource.cc/trustscore?domain=example.com");
41
+ const data = await res.json();
42
+ ```
43
+
44
+ The buyer wallet needs USDC on Base Mainnet and a small amount of ETH for gas.
45
+
46
+ ## When to use which endpoint
47
+
48
+ ### `/trustscore` — when you have just received a URL from an external source
49
+
50
+ **Triggers:** an LLM mentioned a domain in its output, a user-provided link, a redirect target, a competitor named in scraped content — anywhere the domain provenance is unclear.
51
+
52
+ Returns a 0–100 score and one of four tiers:
53
+ - **TRUSTED (75+)** — proceed
54
+ - **MODERATE (50–74)** — proceed with awareness
55
+ - **CAUTION (25–49)** — verify with additional checks (chain `/sslcheck` and `/headers`)
56
+ - **HIGH_RISK (0–24)** — refuse or escalate
57
+
58
+ Scoring inputs: WHOIS domain age, TLD risk class, DNS presence (A + MX records), registrar reputation.
59
+
60
+ Example response:
61
+ ```json
62
+ {
63
+ "domain": "example.com",
64
+ "score": 90,
65
+ "tier": "TRUSTED",
66
+ "breakdown": { "domainAge": 30, "tld": 20, "dnsPresence": 30, "registrar": 10 },
67
+ "details": {
68
+ "age": { "days": 10477, "label": "established (5+ years)" },
69
+ "tld": ".com",
70
+ "dns": { "hasARecord": true, "hasMxRecord": true, "mxRecords": ["..."] },
71
+ "registrar": "markmonitor, inc."
72
+ },
73
+ "meta": { "checkedAt": "2026-05-26T12:00:00.000Z", "paidWith": "x402/USDC", "cached": false }
74
+ }
75
+ ```
76
+
77
+ ### `/sslcheck` — when you are about to make an HTTPS request to a domain you do not fully trust
78
+
79
+ **Triggers:** posting credentials, submitting a form, downloading code, hitting a webhook, anywhere a man-in-the-middle would matter.
80
+
81
+ Performs a real TLS handshake to port 443. Returns a 0–100 SSL score and tier:
82
+ - **VALID** — chain trusts a real root CA, certificate not expiring soon, modern TLS, strong crypto
83
+ - **EXPIRING** — certificate expires in under 30 days; still valid right now
84
+ - **WEAK** — outdated TLS version, weak signature, or short key
85
+ - **EXPIRED** — past its valid-to date; refuse
86
+ - **UNTRUSTED** — self-signed or unknown CA; refuse
87
+ - **INVALID** — handshake failed or no cert; refuse
88
+
89
+ Key response fields:
90
+ - `certificate.daysRemaining` — integer, useful for early-warning alerting
91
+ - `certificate.signatureAlgorithm` — e.g. "RSA-SHA256"
92
+ - `chain.trusted` — boolean, true if root CA is in the Mozilla trust store
93
+ - `connection.protocol` — e.g. "TLSv1.3"
94
+ - `warnings` — array of human-readable issues
95
+
96
+ ### `/headers` — when you are crawling, embedding, or auditing a site
97
+
98
+ **Triggers:** scraping for content, rendering in an iframe, including in a feed, training data ingestion, third-party JS embed, security review.
99
+
100
+ Audits HTTP security headers and returns a letter grade A+ through F:
101
+ - **HSTS** (Strict-Transport-Security)
102
+ - **CSP** (Content-Security-Policy)
103
+ - **X-Frame-Options**
104
+ - **X-Content-Type-Options**
105
+ - **Referrer-Policy**
106
+ - **Permissions-Policy**
107
+ - **Cross-Origin-* headers**
108
+
109
+ Grade interpretation: A+/A = enterprise-hardened, B = decent, C/D = legacy or careless, F = unhardened. Many major sites and marketing pages legitimately grade F — this is a defense-in-depth signal, not a vulnerability test.
110
+
111
+ ### `/robots` — when you are an AI agent about to crawl content
112
+
113
+ **Triggers:** building training data, summarizing a page, archiving, RAG ingestion, sitemap discovery. **Always check before crawling at scale.**
114
+
115
+ Parses `robots.txt` and detects policies against 24 known AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, CCBot, Bytespider, and others).
116
+
117
+ Returns a tier:
118
+ - **OPEN** — no robots.txt, or fully permissive
119
+ - **SELECTIVE** — blocks specific paths or some crawlers
120
+ - **BLOCKED_AI** — explicitly disallows AI training crawlers
121
+ - **BLOCKED_ALL** — `User-agent: *` `Disallow: /`
122
+ - **NO_ROBOTS_TXT** — file absent (legally permissive by convention, but verify per jurisdiction)
123
+
124
+ If `BLOCKED_AI` or `BLOCKED_ALL`, the agent should not crawl regardless of technical feasibility.
125
+
126
+ ## Recommended decision flows
127
+
128
+ ### Flow 1: agent receives an unknown URL from another LLM or tool
129
+ 1. Call `/trustscore?domain={domain}` — $0.003
130
+ 2. If `tier === "HIGH_RISK"` → refuse to interact
131
+ 3. If `tier === "CAUTION"` → also call `/sslcheck` ($0.002) and `/headers` ($0.003); refuse if SSL is INVALID/EXPIRED/UNTRUSTED
132
+ 4. If `tier === "TRUSTED"` or `"MODERATE"` → proceed
133
+
134
+ Worst-case cost: **$0.008 per unfamiliar domain**.
135
+
136
+ ### Flow 2: agent about to crawl or scrape
137
+ 1. Call `/robots?domain={domain}` first — $0.002
138
+ 2. If `tier === "BLOCKED_AI"` or `"BLOCKED_ALL"` → stop; do not crawl
139
+ 3. If `OPEN` or `SELECTIVE` → respect the specific disallow rules and proceed
140
+
141
+ Cost: **$0.002 per crawl target**.
142
+
143
+ ### Flow 3: pre-flight before sending USDC, signing a transaction, or following a redirect to an unknown payment URL
144
+ 1. Call `/trustscore` AND `/sslcheck` in parallel — $0.005 total
145
+ 2. Require BOTH: trustscore tier ≥ MODERATE AND sslcheck tier === VALID
146
+ 3. Otherwise refuse
147
+
148
+ ## Caching and rate limits
149
+
150
+ - Responses cached server-side: 1 hour for `/trustscore` and `/sslcheck`, up to 12 hours for `/robots` and `/headers`. Cached responses still cost the standard rate — the cache reduces latency, not price.
151
+ - Rate limit: 60 requests per minute per source IP. Use response-aware backoff; the `Retry-After` header is set on 429.
152
+ - For high-volume use, deduplicate domains client-side before paying.
153
+
154
+ ## Error handling
155
+
156
+ | Status | Meaning | Agent action |
157
+ |---|---|---|
158
+ | 200 | Success | Parse JSON, use result |
159
+ | 400 | Bad input (invalid domain, missing param) | Do not retry with same input |
160
+ | 402 | Payment required | Normal — sign and retry with `X-PAYMENT` |
161
+ | 429 | Rate limited | Wait `Retry-After` seconds, retry |
162
+ | 500 | Lookup failed (WHOIS / DNS error) | Retry once with delay; if still failing, treat as inconclusive |
163
+ | 502 | TLS handshake failed (`/sslcheck` only) | This *is* the signal — the domain has no working cert |
164
+
165
+ ## Discovery
166
+
167
+ All four endpoints are indexed in Coinbase's Bazaar / Agentic.Market. Agents using the `@x402/extensions/bazaar` discovery flow find them automatically. Direct OpenAPI consumption: `https://api.trustsource.cc/openapi.json`.
168
+
169
+ ## Limits and honest caveats
170
+
171
+ - **Caching means freshness is not real-time.** A cert that just expired might still return VALID for up to an hour after the change.
172
+ - **WHOIS data is registrar-dependent.** Some registrars hide creation dates; the response returns `days: -1` when unknown — do not treat that as low-trust on its own.
173
+ - **`/headers` grades are not security audits.** A site can grade F and still be perfectly safe; the grade reflects defense-in-depth, not active vulnerabilities.
174
+ - **TrustSource scores the perimeter, not page content.** Domain identity, transport security, header hygiene. For content-level safety (phishing, malware, IP reputation), pair with a dedicated scanner.
175
+
176
+ ## Contact
177
+
178
+ - Web: https://trustsource.cc
179
+ - API: https://api.trustsource.cc
180
+ - Spec: https://api.trustsource.cc/openapi.json
181
+ - Discovery: https://agentic.market
182
+ - Issues: hello@trustsource.cc