fiderail 2.3.1__tar.gz

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.
fiderail-2.3.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FideRail Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: fiderail
3
+ Version: 2.3.1
4
+ Summary: Non-custodial AI Agent payment control plane, pre-flight firewall, anti-sybil cloud client, and concurrent SQLite edge ledger (zero dependencies).
5
+ Author-email: FideRail Contributors <founder@fiderail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://fiderail.com
8
+ Project-URL: Documentation, https://fiderail.com/docs
9
+ Project-URL: Repository, https://gitlab.com/fiderail/fiderail
10
+ Project-URL: GitHub, https://github.com/fiderail/fiderail
11
+ Project-URL: Issues, https://gitlab.com/fiderail/fiderail/-/issues
12
+ Keywords: fiderail,ai-agent,payment-control-plane,firewall,x402,anti-sybil,base,solana,arbitrum,polygon,usdc,sqlite
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Security
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Dynamic: license-file
29
+
30
+ # FideRail Python SDK
31
+
32
+ Non-custodial AI Agent payment control plane, pre-flight risk firewall, anti-sybil trust client, and concurrent SQLite WAL edge ledger.
33
+
34
+ - **Zero third-party dependencies** (Python standard library only, Python `>= 3.9`)
35
+ - **100% non-custodial** (never holds private keys, session keys, or user funds)
36
+ - **4 Chains x 2 Stablecoins**: Base (`USDC`, `EURC`), Solana (`USDC`, `USDT`), Arbitrum (`USDC`, `USDT0`), and Polygon (`USDC`, `USDT`)
37
+ - **PEP 561 typed** (`py.typed` included)
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install fiderail
43
+ ```
44
+
45
+ ## Quickstart
46
+
47
+ ### Pre-Flight Payment Guard & Trust Lookup
48
+
49
+ ```python
50
+ from fiderail import FideRailClient
51
+
52
+ client = FideRailClient(
53
+ "https://api.fiderail.com",
54
+ ledger_path="./edge-ledger.db",
55
+ on_outage="fail-closed",
56
+ )
57
+
58
+ try:
59
+ profile = client.get_trust("base", "0x7284d41b5b852f2bd4c99bdf95043d84452d299c")
60
+ verdict = client.preflight_guard(
61
+ chain="base",
62
+ counterparty="0x7284d41b5b852f2bd4c99bdf95043d84452d299c",
63
+ amount_usdc=0.05,
64
+ policy={"maxSingleTxUsdc": 1.0, "maxDailyUsdc": 10.0, "minTrustScore": 40},
65
+ )
66
+ print(verdict["decision"], verdict["reasons"])
67
+ finally:
68
+ client.close()
69
+ ```
70
+
71
+ ### Guarded x402 Request
72
+
73
+ `guarded_x402_request` scans outbound requests for leaked secrets, checks the endpoint circuit breaker, parses HTTP 402 payment challenges, enforces host/agent policy clamps and mandate attenuation chains, reserves atomic daily budget holds in `SqliteSpendLedger`, and generates verifiable `fiderail-sar-v2` delivery receipts.
74
+
75
+ ```python
76
+ result = client.guarded_x402_request(
77
+ "https://api.example.com/paid-endpoint",
78
+ preferred_chain="base",
79
+ policy={"maxSingleTxUsdc": 0.25, "maxDailyUsdc": 5.0, "allowedAssets": ["USDC"]},
80
+ signer=lambda option, guard: my_wallet_sign_x402(option),
81
+ )
82
+ ```
83
+
84
+ Omit `signer` to run a dry-run pre-flight check without executing a payment.
85
+
86
+ ## Included Modules & Helpers
87
+
88
+ - `FideRailClient`: `get_health`, `get_trust`, `get_history`, `list_agents`, `discover_services`, `diagnose_endpoint`, `preflight_guard`, `guarded_x402_request`, `report_delivery_telemetry`
89
+ - `SqliteSpendLedger`: concurrent WAL-mode daily budget reservations, idempotency window, endpoint circuit breaker, mandate revocation/spend tracking, and TTL trust cache
90
+ - Policy & cryptography helpers: `clamp_policy`, `scan_outbound_secrets`, `validate_mandate_chain`, `create_salted_receipt_v2`, `verify_salted_receipt_v2`, `canonicalize_jcs`, `hash_jcs`, `parse_x402_challenge`
91
+ - Network registry: `CHAIN_SPECS`, `ALL_CHAIN_KEYS`, `normalize_chain_name`, `normalize_chain_address`, `is_valid_address`, `get_asset_spec`, `get_primary_asset`
92
+
93
+ ## Links
94
+
95
+ - Portal & Live Grader: [https://fiderail.com](https://fiderail.com)
96
+ - Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
97
+ - REST API & Streamable HTTP MCP: [https://api.fiderail.com](https://api.fiderail.com)
98
+ - Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
99
+ - Mirror (GitHub): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
100
+ - Security & Contact: `security@fiderail.com` · `founder@fiderail.com`
101
+
102
+ ## License
103
+
104
+ [MIT](https://gitlab.com/fiderail/fiderail/-/blob/main/LICENSE)
@@ -0,0 +1,75 @@
1
+ # FideRail Python SDK
2
+
3
+ Non-custodial AI Agent payment control plane, pre-flight risk firewall, anti-sybil trust client, and concurrent SQLite WAL edge ledger.
4
+
5
+ - **Zero third-party dependencies** (Python standard library only, Python `>= 3.9`)
6
+ - **100% non-custodial** (never holds private keys, session keys, or user funds)
7
+ - **4 Chains x 2 Stablecoins**: Base (`USDC`, `EURC`), Solana (`USDC`, `USDT`), Arbitrum (`USDC`, `USDT0`), and Polygon (`USDC`, `USDT`)
8
+ - **PEP 561 typed** (`py.typed` included)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install fiderail
14
+ ```
15
+
16
+ ## Quickstart
17
+
18
+ ### Pre-Flight Payment Guard & Trust Lookup
19
+
20
+ ```python
21
+ from fiderail import FideRailClient
22
+
23
+ client = FideRailClient(
24
+ "https://api.fiderail.com",
25
+ ledger_path="./edge-ledger.db",
26
+ on_outage="fail-closed",
27
+ )
28
+
29
+ try:
30
+ profile = client.get_trust("base", "0x7284d41b5b852f2bd4c99bdf95043d84452d299c")
31
+ verdict = client.preflight_guard(
32
+ chain="base",
33
+ counterparty="0x7284d41b5b852f2bd4c99bdf95043d84452d299c",
34
+ amount_usdc=0.05,
35
+ policy={"maxSingleTxUsdc": 1.0, "maxDailyUsdc": 10.0, "minTrustScore": 40},
36
+ )
37
+ print(verdict["decision"], verdict["reasons"])
38
+ finally:
39
+ client.close()
40
+ ```
41
+
42
+ ### Guarded x402 Request
43
+
44
+ `guarded_x402_request` scans outbound requests for leaked secrets, checks the endpoint circuit breaker, parses HTTP 402 payment challenges, enforces host/agent policy clamps and mandate attenuation chains, reserves atomic daily budget holds in `SqliteSpendLedger`, and generates verifiable `fiderail-sar-v2` delivery receipts.
45
+
46
+ ```python
47
+ result = client.guarded_x402_request(
48
+ "https://api.example.com/paid-endpoint",
49
+ preferred_chain="base",
50
+ policy={"maxSingleTxUsdc": 0.25, "maxDailyUsdc": 5.0, "allowedAssets": ["USDC"]},
51
+ signer=lambda option, guard: my_wallet_sign_x402(option),
52
+ )
53
+ ```
54
+
55
+ Omit `signer` to run a dry-run pre-flight check without executing a payment.
56
+
57
+ ## Included Modules & Helpers
58
+
59
+ - `FideRailClient`: `get_health`, `get_trust`, `get_history`, `list_agents`, `discover_services`, `diagnose_endpoint`, `preflight_guard`, `guarded_x402_request`, `report_delivery_telemetry`
60
+ - `SqliteSpendLedger`: concurrent WAL-mode daily budget reservations, idempotency window, endpoint circuit breaker, mandate revocation/spend tracking, and TTL trust cache
61
+ - Policy & cryptography helpers: `clamp_policy`, `scan_outbound_secrets`, `validate_mandate_chain`, `create_salted_receipt_v2`, `verify_salted_receipt_v2`, `canonicalize_jcs`, `hash_jcs`, `parse_x402_challenge`
62
+ - Network registry: `CHAIN_SPECS`, `ALL_CHAIN_KEYS`, `normalize_chain_name`, `normalize_chain_address`, `is_valid_address`, `get_asset_spec`, `get_primary_asset`
63
+
64
+ ## Links
65
+
66
+ - Portal & Live Grader: [https://fiderail.com](https://fiderail.com)
67
+ - Documentation: [https://fiderail.com/docs](https://fiderail.com/docs)
68
+ - REST API & Streamable HTTP MCP: [https://api.fiderail.com](https://api.fiderail.com)
69
+ - Source (GitLab): [https://gitlab.com/fiderail/fiderail](https://gitlab.com/fiderail/fiderail)
70
+ - Mirror (GitHub): [https://github.com/fiderail/fiderail](https://github.com/fiderail/fiderail)
71
+ - Security & Contact: `security@fiderail.com` · `founder@fiderail.com`
72
+
73
+ ## License
74
+
75
+ [MIT](https://gitlab.com/fiderail/fiderail/-/blob/main/LICENSE)
@@ -0,0 +1,67 @@
1
+ """FideRail Python SDK — Non-Custodial Payment Control Plane & Edge Firewall (zero dependencies)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .spec import (
6
+ ALL_CHAIN_KEYS,
7
+ API_BASE_URL,
8
+ CHAIN_SPECS,
9
+ EUR_USD_DEFAULT_RATE,
10
+ SDK_VERSION,
11
+ get_asset_spec,
12
+ get_primary_asset,
13
+ is_valid_address,
14
+ normalize_chain_address,
15
+ normalize_chain_name,
16
+ raw_amount_to_decimal,
17
+ to_usd_amount,
18
+ )
19
+ from .policy import (
20
+ DEFAULT_FIREWALL_POLICY,
21
+ canonicalize_jcs,
22
+ clamp_policy,
23
+ compute_payment_fingerprint,
24
+ compute_quote_digest,
25
+ create_salted_receipt_v2,
26
+ hash_jcs,
27
+ is_asset_allowed,
28
+ scan_outbound_secrets,
29
+ sha256_hex,
30
+ validate_mandate_chain,
31
+ verify_salted_receipt_v2,
32
+ )
33
+ from .ledger import SqliteSpendLedger
34
+ from .client import FideRailClient, parse_x402_challenge
35
+
36
+ __version__ = SDK_VERSION
37
+
38
+ __all__ = [
39
+ "__version__",
40
+ "SDK_VERSION",
41
+ "API_BASE_URL",
42
+ "ALL_CHAIN_KEYS",
43
+ "CHAIN_SPECS",
44
+ "EUR_USD_DEFAULT_RATE",
45
+ "DEFAULT_FIREWALL_POLICY",
46
+ "normalize_chain_name",
47
+ "normalize_chain_address",
48
+ "is_valid_address",
49
+ "get_primary_asset",
50
+ "get_asset_spec",
51
+ "raw_amount_to_decimal",
52
+ "to_usd_amount",
53
+ "canonicalize_jcs",
54
+ "sha256_hex",
55
+ "hash_jcs",
56
+ "clamp_policy",
57
+ "scan_outbound_secrets",
58
+ "is_asset_allowed",
59
+ "compute_payment_fingerprint",
60
+ "compute_quote_digest",
61
+ "create_salted_receipt_v2",
62
+ "verify_salted_receipt_v2",
63
+ "validate_mandate_chain",
64
+ "SqliteSpendLedger",
65
+ "FideRailClient",
66
+ "parse_x402_challenge",
67
+ ]