|
| 1 | +RFC 9421 interoperability field test |
| 2 | +==================================== |
| 3 | + |
| 4 | +A Fedify-based server for testing RFC 9421 HTTP Message Signatures |
| 5 | +interoperability with Bonfire, Mastodon, and other fediverse implementations. |
| 6 | + |
| 7 | + |
| 8 | +Prerequisites |
| 9 | +------------- |
| 10 | + |
| 11 | + - [Deno] installed |
| 12 | + - Run `mise run install` (or `pnpm install`) from the repo root |
| 13 | + - A public tunnel for testing (e.g., `fedify tunnel`) |
| 14 | + |
| 15 | +[Deno]: https://deno.com/ |
| 16 | + |
| 17 | + |
| 18 | +Quick start |
| 19 | +----------- |
| 20 | + |
| 21 | +### 1. start the server |
| 22 | + |
| 23 | +~~~~ sh |
| 24 | +# Default (RFC 9421 first knock + Accept-Signature challenge): |
| 25 | +deno run -A main.ts |
| 26 | + |
| 27 | +# With nonce replay protection: |
| 28 | +CHALLENGE_NONCE=1 deno run -A main.ts |
| 29 | + |
| 30 | +# Without challenge (plain signature verification only): |
| 31 | +CHALLENGE_ENABLED=0 deno run -A main.ts |
| 32 | +~~~~ |
| 33 | + |
| 34 | +### 2. expose publicly with `fedify tunnel` |
| 35 | + |
| 36 | +In a separate terminal, from the repo root: |
| 37 | + |
| 38 | +~~~~ sh |
| 39 | +deno task cli tunnel 8000 |
| 40 | +~~~~ |
| 41 | + |
| 42 | +Note the public URL (e.g., `https://xxxxx.tunnel.example`). |
| 43 | + |
| 44 | +### 3. send test activities |
| 45 | + |
| 46 | +Open your browser or use curl. Both GET (query params) and POST (JSON body) |
| 47 | +are supported: |
| 48 | + |
| 49 | +~~~~ sh |
| 50 | +# Follow a remote actor (GET): |
| 51 | +curl 'https://xxxxx.tunnel.example/send/follow?handle=@user@bonfire.example' |
| 52 | + |
| 53 | +# Follow a remote actor (POST): |
| 54 | +curl -X POST -H 'Content-Type: application/json' \ |
| 55 | + -d '{"handle":"@user@bonfire.example"}' \ |
| 56 | + https://xxxxx.tunnel.example/send/follow |
| 57 | + |
| 58 | +# Send a note: |
| 59 | +curl 'https://xxxxx.tunnel.example/send/note?handle=@user@bonfire.example&content=Hello!' |
| 60 | + |
| 61 | +# Unfollow: |
| 62 | +curl 'https://xxxxx.tunnel.example/send/unfollow?handle=@user@bonfire.example' |
| 63 | +~~~~ |
| 64 | + |
| 65 | + |
| 66 | +Configuration |
| 67 | +------------- |
| 68 | + |
| 69 | +All configuration is via environment variables: |
| 70 | + |
| 71 | +| Variable | Default | Description | |
| 72 | +| ------------------- | ---------- | ----------------------------------------------------------------------- | |
| 73 | +| `PORT` | `8000` | Server listen port | |
| 74 | +| `FIRST_KNOCK` | `rfc9421` | Initial signature spec (`rfc9421` or `draft-cavage-http-signatures-12`) | |
| 75 | +| `CHALLENGE_ENABLED` | (enabled) | Set to `0` to disable `Accept-Signature` on `401` | |
| 76 | +| `CHALLENGE_NONCE` | (disabled) | Set to `1` to include one-time nonce | |
| 77 | +| `NONCE_TTL` | `300` | Nonce time-to-live in seconds | |
| 78 | + |
| 79 | + |
| 80 | +Endpoints |
| 81 | +--------- |
| 82 | + |
| 83 | +### Monitoring |
| 84 | + |
| 85 | + - `GET /` — Server info and endpoint list |
| 86 | + - `GET /log` — Received activities (newest first) |
| 87 | + - `GET /followers-list` — Current followers |
| 88 | + |
| 89 | +### Sending activities (outbound) |
| 90 | + |
| 91 | +All send endpoints accept GET (query params) or POST (JSON body). |
| 92 | + |
| 93 | + - `/send/follow` — Send a Follow activity |
| 94 | + - `handle` (required): remote actor handle |
| 95 | + - `/send/note` — Send a Create(Note) activity |
| 96 | + - `handle` (required): remote actor handle |
| 97 | + - `content` (optional): note text |
| 98 | + - `/send/unfollow` — Send an Undo(Follow) activity |
| 99 | + - `handle` (required): remote actor handle |
| 100 | + |
| 101 | + |
| 102 | +Test scenarios |
| 103 | +-------------- |
| 104 | + |
| 105 | +### Scenario A: Fedify -> bonfire (outbound) |
| 106 | + |
| 107 | +1. Start the server and expose via tunnel. |
| 108 | +2. Use `/send/follow` and `/send/note` to send activities to a Bonfire actor. |
| 109 | +3. Check Bonfire server logs for RFC 9421 signature verification. |
| 110 | + |
| 111 | +### Scenario B: Bonfire -> Fedify (inbound with challenge) |
| 112 | + |
| 113 | +1. Start the server with `CHALLENGE_ENABLED=1`. |
| 114 | +2. Have Bonfire send a `Follow` to `@test@<your-domain>`. |
| 115 | +3. Verify Fedify returns `401` with `Accept-Signature` header. |
| 116 | +4. Verify Bonfire retries with a compatible signature and succeeds. |
| 117 | +5. Repeat with `CHALLENGE_NONCE=1` for replay protection testing. |
| 118 | + |
| 119 | +### Scenario C: Fedify -> Mastodon (outbound) |
| 120 | + |
| 121 | +1. Start the server and expose via tunnel. |
| 122 | +2. Use `/send/follow` targeting a Mastodon actor. |
| 123 | +3. Monitor logs for double-knock behavior and 5xx workaround. |
| 124 | + |
| 125 | +### Scenario D: Mastodon -> Fedify (inbound) |
| 126 | + |
| 127 | +1. Start the server (optionally with challenge enabled). |
| 128 | +2. From a Mastodon account, follow `@test@<your-domain>`. |
| 129 | +3. Check the `/log` endpoint and server logs. |
0 commit comments