diff options
Diffstat (limited to 'grasp-audit/README.md')
| -rw-r--r-- | grasp-audit/README.md | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/grasp-audit/README.md b/grasp-audit/README.md index 54e1e93..323451c 100644 --- a/grasp-audit/README.md +++ b/grasp-audit/README.md | |||
| @@ -12,28 +12,66 @@ A reusable audit and compliance testing tool for GRASP protocol implementations. | |||
| 12 | 12 | ||
| 13 | ## Quick Start | 13 | ## Quick Start |
| 14 | 14 | ||
| 15 | Run GRASP compliance tests against any GRASP relay: | ||
| 16 | |||
| 17 | ```bash | 15 | ```bash |
| 18 | # Install | 16 | # Install |
| 19 | cd grasp-audit | 17 | cd grasp-audit |
| 20 | cargo install --path . | 18 | cargo install --path . |
| 21 | 19 | ||
| 22 | # Audit a production relay | 20 | # Probe a relay (read-only health check — no keys needed) |
| 23 | grasp-audit audit --relay wss://relay.ngit.dev | 21 | grasp-audit probe --relay wss://relay.ngit.dev |
| 24 | 22 | ||
| 25 | # Or audit a local development relay | 23 | # Full compliance audit |
| 26 | grasp-audit audit --relay ws://localhost:7334 | 24 | grasp-audit audit --relay wss://relay.ngit.dev |
| 27 | ``` | 25 | ``` |
| 28 | 26 | ||
| 29 | ## Usage Examples | 27 | ## Usage Examples |
| 30 | 28 | ||
| 31 | ### As a CLI Tool | 29 | ### Probe (Health Check) |
| 30 | |||
| 31 | A fast, lightweight smoke test that checks whether a relay is healthy. Read-only by default — no keys or write access required. | ||
| 32 | 32 | ||
| 33 | ```bash | 33 | ```bash |
| 34 | # Install | 34 | # Basic health check |
| 35 | cargo install --path . | 35 | grasp-audit probe --relay wss://relay.ngit.dev |
| 36 | |||
| 37 | # Machine-readable JSON (one line per run — pipe-friendly) | ||
| 38 | grasp-audit probe --relay wss://relay.ngit.dev --json | ||
| 39 | |||
| 40 | # Continuous monitoring (re-runs every 10 seconds) | ||
| 41 | grasp-audit probe --relay wss://relay.ngit.dev --watch 10 | ||
| 42 | |||
| 43 | # Pipe JSON output to a log file | ||
| 44 | grasp-audit probe --relay wss://relay.ngit.dev --json --watch 10 >> probe.log | ||
| 36 | 45 | ||
| 46 | # Full write-path check: publish events, git push, verify refs match state | ||
| 47 | # (requires write access; use --nsec for whitelisted relays) | ||
| 48 | grasp-audit probe --relay wss://relay.ngit.dev --create-repo | ||
| 49 | grasp-audit probe --relay wss://relay.ngit.dev --create-repo --nsec nsec1... | ||
| 50 | ``` | ||
| 51 | |||
| 52 | **Probe checks (read-only):** | ||
| 53 | |||
| 54 | | Check | What it verifies | | ||
| 55 | |---|---| | ||
| 56 | | `connect_websocket` | WebSocket connection succeeds | | ||
| 57 | | `nip11_fetch` | NIP-11 relay info document is served (shows software & version) | | ||
| 58 | | `serves_latest_announcement` | At least one kind:30617 repo announcement is served | | ||
| 59 | | `git_fetch_refs` | Git HTTP info/refs endpoint responds | | ||
| 60 | | `git_refs_match_state` | Git refs match the latest kind:30618 state events | | ||
| 61 | |||
| 62 | **Additional checks with `--create-repo`:** | ||
| 63 | |||
| 64 | | Check | What it verifies | | ||
| 65 | |---|---| | ||
| 66 | | `publish_events` | Relay accepts kind:30617 and kind:30618 events | | ||
| 67 | | `git_repo_initialised` | Relay initialises the git repo after events are published | | ||
| 68 | | `git_push` | Git push succeeds | | ||
| 69 | |||
| 70 | **Overall timeout:** The probe enforces an overall deadline of `min(20s, --watch interval)` to prevent overlapping runs. If the deadline fires, completed checks retain their real results; the step that couldn't start is marked failed with a diagnosis (single slow check vs. cumulative slowness); remaining checks are marked skipped. | ||
| 71 | |||
| 72 | ### Audit (Compliance Tests) | ||
| 73 | |||
| 74 | ```bash | ||
| 37 | # Audit a production GRASP relay (shared fixtures - default) | 75 | # Audit a production GRASP relay (shared fixtures - default) |
| 38 | grasp-audit audit --relay wss://relay.ngit.dev | 76 | grasp-audit audit --relay wss://relay.ngit.dev |
| 39 | 77 | ||
| @@ -44,7 +82,7 @@ grasp-audit audit --relay ws://localhost:7334 --spec nip01-smoke | |||
| 44 | grasp-audit audit --relay ws://localhost:7334 --mode isolated --spec push-auth | 82 | grasp-audit audit --relay ws://localhost:7334 --mode isolated --spec push-auth |
| 45 | ``` | 83 | ``` |
| 46 | 84 | ||
| 47 | ### As a Library | 85 | ### As a Library (Audit) |
| 48 | 86 | ||
| 49 | ```rust | 87 | ```rust |
| 50 | use grasp_audit::*; | 88 | use grasp_audit::*; |