@ashlar-blue/x402-trust 0.3.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/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/attested-directory.d.ts +78 -0
- package/dist/attested-directory.d.ts.map +1 -0
- package/dist/attested-directory.js +163 -0
- package/dist/attested-directory.js.map +1 -0
- package/dist/badges.d.ts +131 -0
- package/dist/badges.d.ts.map +1 -0
- package/dist/badges.js +213 -0
- package/dist/badges.js.map +1 -0
- package/dist/catalog-mcp.d.ts +145 -0
- package/dist/catalog-mcp.d.ts.map +1 -0
- package/dist/catalog-mcp.js +409 -0
- package/dist/catalog-mcp.js.map +1 -0
- package/dist/census-reconcile.d.ts +69 -0
- package/dist/census-reconcile.d.ts.map +1 -0
- package/dist/census-reconcile.js +162 -0
- package/dist/census-reconcile.js.map +1 -0
- package/dist/directory-classify.d.ts +47 -0
- package/dist/directory-classify.d.ts.map +1 -0
- package/dist/directory-classify.js +54 -0
- package/dist/directory-classify.js.map +1 -0
- package/dist/discovery.d.ts +304 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +926 -0
- package/dist/discovery.js.map +1 -0
- package/dist/evidence-ref.d.ts +96 -0
- package/dist/evidence-ref.d.ts.map +1 -0
- package/dist/evidence-ref.js +179 -0
- package/dist/evidence-ref.js.map +1 -0
- package/dist/facilitator-config.d.ts +83 -0
- package/dist/facilitator-config.d.ts.map +1 -0
- package/dist/facilitator-config.js +94 -0
- package/dist/facilitator-config.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest-sig.d.ts +131 -0
- package/dist/manifest-sig.d.ts.map +1 -0
- package/dist/manifest-sig.js +262 -0
- package/dist/manifest-sig.js.map +1 -0
- package/dist/merkle-transcript.d.ts +34 -0
- package/dist/merkle-transcript.d.ts.map +1 -0
- package/dist/merkle-transcript.js +162 -0
- package/dist/merkle-transcript.js.map +1 -0
- package/dist/open-catalog.d.ts +111 -0
- package/dist/open-catalog.d.ts.map +1 -0
- package/dist/open-catalog.js +307 -0
- package/dist/open-catalog.js.map +1 -0
- package/dist/reconcile.d.ts +150 -0
- package/dist/reconcile.d.ts.map +1 -0
- package/dist/reconcile.js +136 -0
- package/dist/reconcile.js.map +1 -0
- package/dist/trust-sdk.d.ts +127 -0
- package/dist/trust-sdk.d.ts.map +1 -0
- package/dist/trust-sdk.js +147 -0
- package/dist/trust-sdk.js.map +1 -0
- package/dist/types.d.ts +213 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +68 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// GENERATED from src/x402/types.ts by scripts/sdk/sync-sdk.ts — do not edit here.
|
|
2
|
+
// The canonical module is the one FlareClaw runs in production; this is a copy so
|
|
3
|
+
// that what we publish and what we run cannot diverge. Edit the canonical file.
|
|
4
|
+
/**
|
|
5
|
+
* x402 protocol wire types — EMITS v1, PARSES v1 and v2.
|
|
6
|
+
*
|
|
7
|
+
* Shapes follow the x402 spec (Coinbase/x402 Foundation): a resource
|
|
8
|
+
* server answers 402 with `PaymentRequiredResponse`; the client retries
|
|
9
|
+
* with an `X-PAYMENT` header carrying base64(JSON(PaymentPayload)); the
|
|
10
|
+
* facilitator verifies and settles; the server attaches
|
|
11
|
+
* `X-PAYMENT-RESPONSE` = base64(JSON(SettleResponse)).
|
|
12
|
+
*
|
|
13
|
+
* FlareClaw is the first x402 facilitator on Flare (Coston2 first —
|
|
14
|
+
* network id "coston2", eip155:114).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The version we EMIT in our own 402 challenges.
|
|
18
|
+
*
|
|
19
|
+
* We accept v2 payloads too (see `normalizeRequirements` /
|
|
20
|
+
* `decodePaymentHeader`) — being a co-author of x402 extensions while
|
|
21
|
+
* silently refusing the ecosystem's current wire format would be an
|
|
22
|
+
* embarrassing kind of wrong. Emission stays on v1 until every one of
|
|
23
|
+
* our own clients is v2-ready; acceptance is widened first, because
|
|
24
|
+
* accepting more than you emit is the only safe direction to move a
|
|
25
|
+
* protocol version.
|
|
26
|
+
*/
|
|
27
|
+
export const X402_VERSION = 1;
|
|
28
|
+
/** Versions this implementation can PARSE. */
|
|
29
|
+
export const SUPPORTED_X402_VERSIONS = [1, 2];
|
|
30
|
+
export const PAYMENT_HEADER = 'X-PAYMENT';
|
|
31
|
+
/**
|
|
32
|
+
* v2 servers may deliver the challenge in a RESPONSE HEADER with a null body
|
|
33
|
+
* instead of in the body. Measured on a live commercial deployment
|
|
34
|
+
* (x402.glassnode.com, 2026-08-06): `payment-required:` base64, body `null`.
|
|
35
|
+
* A client that only reads the body sees nothing and cannot pay them.
|
|
36
|
+
*/
|
|
37
|
+
export const PAYMENT_REQUIRED_HEADER = 'payment-required';
|
|
38
|
+
export const PAYMENT_RESPONSE_HEADER = 'X-PAYMENT-RESPONSE';
|
|
39
|
+
/**
|
|
40
|
+
* The amount a requirement asks for, whichever version wrote it.
|
|
41
|
+
* Throws rather than defaulting: a missing price must never quietly
|
|
42
|
+
* become zero on a payment path.
|
|
43
|
+
*/
|
|
44
|
+
export function requirementAmount(r) {
|
|
45
|
+
const v = r.maxAmountRequired ?? r.amount;
|
|
46
|
+
if (v === undefined)
|
|
47
|
+
throw new Error('x402: requirement has neither maxAmountRequired (v1) nor amount (v2)');
|
|
48
|
+
return v;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The offered requirements of a 402 body.
|
|
52
|
+
*
|
|
53
|
+
* `accepts` is the spec field in BOTH versions. The `accepted` fallback exists
|
|
54
|
+
* only to tolerate servers that put the chosen-requirement field in a 402 by
|
|
55
|
+
* mistake; it is normalised to an array so no caller has to care.
|
|
56
|
+
*/
|
|
57
|
+
export function offeredRequirements(body) {
|
|
58
|
+
if (body.accepts)
|
|
59
|
+
return body.accepts;
|
|
60
|
+
if (!body.accepted)
|
|
61
|
+
return [];
|
|
62
|
+
return Array.isArray(body.accepted) ? body.accepted : [body.accepted];
|
|
63
|
+
}
|
|
64
|
+
/** Declared transfer method, defaulting per spec to `eip3009`. */
|
|
65
|
+
export function transferMethod(r) {
|
|
66
|
+
return r.extra?.assetTransferMethod ?? 'eip3009';
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAE9B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAU,CAAC;AAevD,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAmD5D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAsB;IACpD,MAAM,CAAC,GAAG,CAAC,CAAC,iBAAiB,IAAI,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC7G,OAAO,CAAC,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA6B;IAC7D,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtC,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,cAAc,CAAC,CAAsB;IACjD,OAAO,CAAC,CAAC,KAAK,EAAE,mBAAmB,IAAI,SAAS,CAAC;AACrD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ashlar-blue/x402-trust",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "The institutional trust layer for autonomous AI agents: discover payment endpoints via DNS, verify TEE hardware quotes, and generate SCITT transparency receipts. Zero dependencies.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"x402",
|
|
7
|
+
"agents",
|
|
8
|
+
"payments",
|
|
9
|
+
"attestation",
|
|
10
|
+
"tee",
|
|
11
|
+
"discovery",
|
|
12
|
+
"scitt",
|
|
13
|
+
"flare",
|
|
14
|
+
"xrpl"
|
|
15
|
+
],
|
|
16
|
+
"author": "Corrente Labs, Inc. <contact@correntelabs.com>",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"sync": "tsx ../../scripts/sdk/sync-sdk.ts",
|
|
38
|
+
"build": "npm run sync && tsc -p tsconfig.json",
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "^5.6.0"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/correntelabs/ashlar-blue.git"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://ashlar.blue",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/correntelabs/ashlar-blue/issues"
|
|
51
|
+
}
|
|
52
|
+
}
|