@fiderail/core 2.3.1 → 2.3.2
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/README.md +7 -1
- package/dist/policy.d.ts +2 -0
- package/dist/policy.js +7 -1
- package/dist/remote-client.js +14 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -35,6 +35,12 @@ console.log(verdict.decision, verdict.reasons);
|
|
|
35
35
|
- **Anti-Sybil Scoring (`trust-v2`)**: `createTrustScorerV2`, `DEFAULT_TRUST_SCORER`, `DEFAULT_TRUST_V2_CONFIG`, `computeCreditProfilesFromPayments`, `computeActiveModelHash`, `detectDirectedCycles2And3`, `evaluateAssociatedCredit`
|
|
36
36
|
- **Merkle State Roots & Proofs**: `buildTrustStateRootCommitment`, `buildTrustMerkleProof`, `hashTrustProfileLeaf`, `buildMerkleInclusionProof`, `verifyMerkleInclusionProof`
|
|
37
37
|
|
|
38
|
+
## Important Integration Semantics
|
|
39
|
+
|
|
40
|
+
- **Strict blocking of unknown / low-trust addresses (including micro-payments)**: By default, `DEFAULT_FIREWALL_POLICY` sets `allowUnknownMaxUsdc: 0.05` so unknown or low-score addresses are permitted up to `$0.05 USDC` with `WARN`. **If you need to hard-block all unknown or low-trust counterparties regardless of amount, set `allowUnknownMaxUsdc: 0` alongside `minTrustScore`.**
|
|
41
|
+
- **`onOutage` applies only to firewall decisions**: **`onOutage` (`"fail-closed"` / `"fail-open-micro"`) is enforced only inside `preflightPaymentGuard` (and `@fiderail/guard`'s `guardedX402Fetch`); `getAgentTrust` always throws when the cloud oracle is unreachable and no stale cache entry exists.**
|
|
42
|
+
- **`RemoteTrustClient.getPayerActivity` returns `null` remotely**: **In `RemoteTrustClient`, `getPayerActivity` returns `null` by default (only direct repository engines query local indexed outgoing flows); for remote seller-side buyer screening, call `POST /v1/trust-provider/before-settle`.**
|
|
43
|
+
|
|
38
44
|
## Runtime Requirements
|
|
39
45
|
|
|
40
46
|
Runtime-agnostic ESM with **zero `node:*` imports** (depends only on `@fiderail/spec` and `@fiderail/zk-types`). Works in Node.js, Bun, Deno, Cloudflare Workers, and browsers.
|
|
@@ -44,7 +50,7 @@ Runtime-agnostic ESM with **zero `node:*` imports** (depends only on `@fiderail/
|
|
|
44
50
|
- Portal: [https://fiderail.com](https://fiderail.com)
|
|
45
51
|
- Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
|
|
46
52
|
- Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
|
|
47
|
-
- Mirror (GitHub): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
|
|
53
|
+
- Mirror (GitHub — pending reinstatement): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
|
|
48
54
|
|
|
49
55
|
## License
|
|
50
56
|
|
package/dist/policy.d.ts
CHANGED
|
@@ -15,11 +15,13 @@ export declare function computePaymentFingerprint(params: {
|
|
|
15
15
|
/**
|
|
16
16
|
* Deterministic cryptographic digest binding exact quote terms
|
|
17
17
|
* (method, URL, request body hash, chain, payTo, asset, amount) before approval/signing.
|
|
18
|
+
* Accepts either a precomputed `bodyHash` or raw `body` (hashed via `sha256Hex(serializeBody(body))`).
|
|
18
19
|
*/
|
|
19
20
|
export declare function computeQuoteDigest(params: {
|
|
20
21
|
method?: string;
|
|
21
22
|
url: string;
|
|
22
23
|
bodyHash?: string;
|
|
24
|
+
body?: unknown;
|
|
23
25
|
chain: string;
|
|
24
26
|
payTo: string;
|
|
25
27
|
asset?: string | null;
|
package/dist/policy.js
CHANGED
|
@@ -33,9 +33,15 @@ export function computePaymentFingerprint(params) {
|
|
|
33
33
|
/**
|
|
34
34
|
* Deterministic cryptographic digest binding exact quote terms
|
|
35
35
|
* (method, URL, request body hash, chain, payTo, asset, amount) before approval/signing.
|
|
36
|
+
* Accepts either a precomputed `bodyHash` or raw `body` (hashed via `sha256Hex(serializeBody(body))`).
|
|
36
37
|
*/
|
|
37
38
|
export function computeQuoteDigest(params) {
|
|
38
|
-
|
|
39
|
+
const resolvedBodyHash = params.bodyHash !== undefined && params.bodyHash !== null && params.bodyHash !== ""
|
|
40
|
+
? String(params.bodyHash)
|
|
41
|
+
: params.body !== undefined && params.body !== null
|
|
42
|
+
? sha256Hex(serializeBody(params.body))
|
|
43
|
+
: "";
|
|
44
|
+
return sha256Hex(`${String(params.method || "GET").toUpperCase()}|${String(params.url)}|${resolvedBodyHash}|${String(params.chain)}|${String(params.payTo)}|${String(params.asset || "")}|${Number(params.amountUsdc).toFixed(6)}`);
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Tamper-evident Settlement Attestation Receipt v1 (`fiderail-sar-v1`).
|
package/dist/remote-client.js
CHANGED
|
@@ -153,6 +153,11 @@ export function createRemoteTrustClient(options = {}) {
|
|
|
153
153
|
const hz = await fetchJson("/healthz");
|
|
154
154
|
return hz.dataset || { storageMode: "remote_cloud_client", apiBaseUrl };
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Fetches the indexed `trust-v2` profile for `(chain, address)`.
|
|
158
|
+
* Always throws when the cloud oracle is unreachable and no stale cache entry is available;
|
|
159
|
+
* `onOutage` degradation applies only to `preflightPaymentGuard` / `guardedX402Fetch`.
|
|
160
|
+
*/
|
|
156
161
|
async function getAgentTrust(chainInput, addressInput) {
|
|
157
162
|
const chain = normalizeChainName(chainInput);
|
|
158
163
|
if (!chain) {
|
|
@@ -168,6 +173,10 @@ export function createRemoteTrustClient(options = {}) {
|
|
|
168
173
|
}
|
|
169
174
|
return profile;
|
|
170
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Returns `null` on remote `RemoteTrustClient` instances (local repository engines query indexed outgoing activity).
|
|
178
|
+
* For remote seller-side buyer screening, call `POST /v1/trust-provider/before-settle`.
|
|
179
|
+
*/
|
|
171
180
|
async function getPayerActivity(chainInput, addressInput) {
|
|
172
181
|
const chain = normalizeChainName(chainInput);
|
|
173
182
|
if (!chain) {
|
|
@@ -231,6 +240,11 @@ export function createRemoteTrustClient(options = {}) {
|
|
|
231
240
|
qs.set("limit", String(opts.limit));
|
|
232
241
|
return fetchJson(`/v1/services?${qs.toString()}`);
|
|
233
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Evaluates a planned payment against cloud trust intelligence and local policy caps.
|
|
245
|
+
* To hard-block all unknown or low-trust addresses (including micro-payments), set
|
|
246
|
+
* `allowUnknownMaxUsdc: 0` alongside `minTrustScore`.
|
|
247
|
+
*/
|
|
234
248
|
async function preflightPaymentGuard({ chain, counterparty, amountUsdc, assetSymbol = "USDC", spentTodayUsdc = 0, policy = {}, }) {
|
|
235
249
|
const normChain = normalizeChainName(chain);
|
|
236
250
|
if (!normChain) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiderail/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Protocol-agnostic FideRail Control Plane kernel: PaymentIntent, Attenuated Capability Mandates, Firewall Policy, Secret Scrubber, and Trust Engine (runtime-agnostic, zero Node deps).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"homepage": "https://fiderail.com",
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://gitlab.com/fiderail/fiderail.git",
|
|
30
|
+
"url": "git+https://gitlab.com/fiderail/fiderail.git",
|
|
31
31
|
"directory": "packages/core"
|
|
32
32
|
},
|
|
33
33
|
"bugs": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"x402"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@fiderail/spec": "2.3.
|
|
49
|
-
"@fiderail/zk-types": "2.3.
|
|
48
|
+
"@fiderail/spec": "2.3.2",
|
|
49
|
+
"@fiderail/zk-types": "2.3.2"
|
|
50
50
|
},
|
|
51
51
|
"license": "MIT"
|
|
52
52
|
}
|