Stand-alone CLI to verify Ed25519-signed JSON reports from RugGuard (pay-per-call pre-trade safety layer for agentic crypto trading).
Project description
rugguard-verify
Stand-alone CLI to verify Ed25519-signed JSON reports from RugGuard — the pay-per-call pre-trade safety layer for agentic crypto trading.
What this is
RugGuard responses on /v1/scan, /v1/scan/deep, /v1/explain, and /v1/pretrade/check carry an Ed25519 signature over the canonicalized response body. This package lets you verify that signature offline, against a public key fetched from /v1/pubkey (or a key file you pin yourself).
Two dependencies (cryptography, requests). No payment, no MCP, no SDK. ~200 lines of code. Designed for:
- Agents that need to prove to a third party what RugGuard said at the moment of trade.
- Auditors / compliance verifying a year-old report without trusting RugGuard's servers at the time of verification.
- Integration kits wrapping a verify step around every cached RugGuard response.
Install
pip install rugguard-verify
Usage
Verify a signed report
# 1) Save a signed response (any RugGuard signed endpoint)
curl -s https://rugguard.redfleet.fr/v1/scan/base/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 > scan.json
# 2) Verify it
rugguard-verify --report scan.json
# OK
# fingerprint: ab12cd34ef567890
# scan_id: 9c2f3e1a-1234-4abc-8def-1234567890ab
Pin a local pubkey file (no network fetch)
# Save the current pubkey once
curl -s https://rugguard.redfleet.fr/v1/pubkey | jq -r .pubkey_base64 > rugguard.pub
# Verify offline against it
rugguard-verify --report scan.json --pubkey-file rugguard.pub
Read from stdin
cat scan.json | rugguard-verify --report -
Verify a different deployment
rugguard-verify --report scan.json --pubkey-url https://staging.example/v1/pubkey
Exit codes
| Code | Meaning |
|---|---|
0 |
Signature valid |
1 |
Signature invalid — tampered body, fingerprint mismatch, or unsigned report |
2 |
Usage error — bad arguments, network failure on pubkey fetch |
Library API
For programmatic use (e.g. inside an integration kit or a custodian's audit pipeline):
import json
from rugguard_verify import fetch_pubkey, verify_signed_report
with open("scan.json") as f:
report = json.load(f)
pubkey_body = fetch_pubkey("https://rugguard.redfleet.fr/v1/pubkey")
result = verify_signed_report(report, pubkey_body["pubkey_base64"])
if result.valid:
print(f"OK — signed by {result.pubkey_fingerprint}")
else:
print(f"INVALID: {result.reason}")
How signing works
RugGuard's signing path canonicalizes the response body deterministically:
- Keys sorted alphabetically
- No whitespace between tokens (
separators=(",", ":")) ensure_ascii=False(unicode bytes round-trip)signatureandkey_fingerprintfields stripped before hashing
Then Ed25519-signs over those bytes. The verifier re-canonicalizes the wire body using the same rules and Ed25519PublicKey.verify against the signature.
Key rotation: RugGuard rotates its signing key annually (or immediately on suspicion of compromise). Historical fingerprints are published at /trust.html so reports signed under retired keys can still be verified.
Limits
- Number canonicalization — not full RFC 8785. For the JSON shapes RugGuard emits (ints, bounded-precision floats, ISO datetimes), the Python-emitted bytes are stable. A different language re-serializing a parsed report may produce different float strings; the safe path is to verify the bytes as received.
- Single-key model — no cross-signing, no transparency log on-chain. The pinned pubkey from
/v1/pubkey(or your local--pubkey-file) is the trust root. - Verifying past reports after rotation — fetch the historical pubkey from
/trust.htmland pass via--pubkey-file. The fingerprint mismatch error message guides you.
License
MIT. See LICENSE.
See also
- RugGuard — the pre-trade safety API
- /v1/pubkey — current signing key
- /trust.html — methodology, security, key rotation log
- /openapi.json — full API spec
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 rugguard_verify-0.1.0.tar.gz.
File metadata
- Download URL: rugguard_verify-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c373b99eaecafe9ba643b4e552a556876494e5c51473245a8dc3fba45a42c71b
|
|
| MD5 |
f7fd2d26558aa5257a67299746e2dc63
|
|
| BLAKE2b-256 |
7c0174b2f4a4e071afc3cc965c2dff9b74ce62e968205754968018449bdc91be
|
Provenance
The following attestation bundles were made for rugguard_verify-0.1.0.tar.gz:
Publisher:
publish.yml on dbe006/rugguard-verify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rugguard_verify-0.1.0.tar.gz -
Subject digest:
c373b99eaecafe9ba643b4e552a556876494e5c51473245a8dc3fba45a42c71b - Sigstore transparency entry: 1560782160
- Sigstore integration time:
-
Permalink:
dbe006/rugguard-verify@5132bb46303c6012fa00910829ecf7e34a99398e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dbe006
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5132bb46303c6012fa00910829ecf7e34a99398e -
Trigger Event:
release
-
Statement type:
File details
Details for the file rugguard_verify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rugguard_verify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.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 |
cf2375076f48a014cec9db1e44087b23a0956a9ff513dcd3ccc7385d50b4c09b
|
|
| MD5 |
d675db41e73284bb88b7cedcedf5ac32
|
|
| BLAKE2b-256 |
cd8046e3d567f22d9c9f6a6020c67a8a7cdeab69b81bb7f9ebc4db6f9c7898bd
|
Provenance
The following attestation bundles were made for rugguard_verify-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on dbe006/rugguard-verify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rugguard_verify-0.1.0-py3-none-any.whl -
Subject digest:
cf2375076f48a014cec9db1e44087b23a0956a9ff513dcd3ccc7385d50b4c09b - Sigstore transparency entry: 1560782283
- Sigstore integration time:
-
Permalink:
dbe006/rugguard-verify@5132bb46303c6012fa00910829ecf7e34a99398e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dbe006
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5132bb46303c6012fa00910829ecf7e34a99398e -
Trigger Event:
release
-
Statement type: