Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
02dac92
feat(web): add Iroh trust broker
azooz2003-bit Jul 10, 2026
cfdf4ec
Merge remote-tracking branch 'origin/main' into feat-iroh-trust-broke…
azooz2003-bit Jul 10, 2026
755b07c
feat(iroh): add relay minter and offline attestations
azooz2003-bit Jul 10, 2026
d5bfaed
Merge remote-tracking branch 'origin/main' into feat-iroh-trust-broke…
azooz2003-bit Jul 10, 2026
8925707
test(iroh): cover trust-state linearization gaps
azooz2003-bit Jul 10, 2026
3f29140
fix(iroh): linearize trust authorization
azooz2003-bit Jul 10, 2026
fbe0e05
test(iroh): expose second-pass trust gaps
azooz2003-bit Jul 10, 2026
3ee21c0
fix(iroh): close credential races and drain retention
azooz2003-bit Jul 10, 2026
b33f3b1
fix(iroh-minter): support bounded hmac rotation
azooz2003-bit Jul 10, 2026
2e411df
Merge remote-tracking branch 'origin/main' into feat-iroh-trust-broke…
azooz2003-bit Jul 10, 2026
b552fc6
fix(iroh): accept JSON media type parameters
azooz2003-bit Jul 10, 2026
c1ad99b
test(iroh): cover abandoned relay reservations
azooz2003-bit Jul 10, 2026
be7801a
fix(iroh): expire abandoned relay reservations
azooz2003-bit Jul 10, 2026
f4c5841
test(iroh): cover LAN rendezvous consistency
azooz2003-bit Jul 10, 2026
c9661e4
fix(iroh): serialize LAN discovery with revocation
azooz2003-bit Jul 10, 2026
98e30f9
Merge remote-tracking branch 'origin/main' into feat-iroh-trust-broke…
azooz2003-bit Jul 10, 2026
f0b95cc
test(iroh): cover canonical trust errors
azooz2003-bit Jul 10, 2026
f1a0f59
fix(iroh): harden trust broker boundaries
azooz2003-bit Jul 10, 2026
8d315a4
Merge remote-tracking branch 'origin/main' into feat-iroh-trust-broke…
azooz2003-bit Jul 10, 2026
9e9597a
test(iroh): hide database failure details
azooz2003-bit Jul 10, 2026
a287b44
fix(iroh): defer reservation constraint validation
azooz2003-bit Jul 10, 2026
f2c7ed3
test(iroh): lock registration identity and relay bootstrap
azooz2003-bit Jul 10, 2026
d186c18
fix(iroh): preserve registration trust identity
azooz2003-bit Jul 10, 2026
4b6d3b0
test(iroh): prevent server path-hint disclosure
azooz2003-bit Jul 10, 2026
f03b4bf
fix(iroh): keep private paths off server surfaces
azooz2003-bit Jul 10, 2026
7d90dbb
test(iroh): cover firewall dependency failures
azooz2003-bit Jul 10, 2026
cccb468
fix(iroh): bound firewall availability checks
azooz2003-bit Jul 10, 2026
37f827c
test(iroh): cap stalled firewall work
azooz2003-bit Jul 10, 2026
ce1c3e5
fix(iroh): cap stalled firewall work
azooz2003-bit Jul 10, 2026
1f5bd31
test(iroh): require firewall timeout recovery
azooz2003-bit Jul 10, 2026
f339a40
fix(iroh): abort stalled firewall checks
azooz2003-bit Jul 10, 2026
881d854
test(iroh): require retry-safe binding revocation
azooz2003-bit Jul 10, 2026
20864b4
fix(iroh): make binding revocation retry-safe
azooz2003-bit Jul 10, 2026
47dc1a1
test(iroh): require local-only HTTP minter opt-in
azooz2003-bit Jul 10, 2026
7d0a204
feat(iroh): add loopback relay minter runner
azooz2003-bit Jul 10, 2026
6987fdd
feat(iroh): gate local relay minter HTTP
azooz2003-bit Jul 10, 2026
4ec2c57
fix(iroh): normalize local minter opt-in
azooz2003-bit Jul 10, 2026
ecad500
iroh: point the broker relay fleet at the 7 self-hosted relay.cmux.de…
lawrencecchen Jul 12, 2026
b7975bd
Merge pull request #7949 from manaflow-ai/iroh-broker-fleet
lawrencecchen Jul 13, 2026
563da0a
Merge current main into Iroh trust broker
lawrencecchen Jul 13, 2026
2bcacee
test(iroh): allow self-hosted broker without legacy minter
Jul 13, 2026
695de0c
fix(iroh): make hosted relay minter optional
Jul 13, 2026
13a30e3
test(iroh): cover public firewall host fallback
Jul 13, 2026
ac4decb
fix(iroh): use public host for firewall checks
Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/iroh-relay-minter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Iroh relay minter

on:
pull_request:
paths:
- "services/iroh-relay-minter/**"
- "tests/fixtures/iroh/relay-minter-request-v1.json"
- ".github/workflows/iroh-relay-minter.yml"
push:
branches: [main]
paths:
- "services/iroh-relay-minter/**"
- "tests/fixtures/iroh/relay-minter-request-v1.json"
- ".github/workflows/iroh-relay-minter.yml"

concurrency:
group: iroh-relay-minter-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
runs-on: ${{ vars.LINUX_RUNNER || 'blacksmith-4vcpu-ubuntu-2404' }}
timeout-minutes: 40
defaults:
run:
working-directory: services/iroh-relay-minter
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Install pinned Rust toolchain
run: rustup toolchain install 1.91.0 --profile minimal --component clippy,rustfmt

- name: Check formatting
run: cargo fmt --check

- name: Lint
run: cargo clippy --all-targets --locked -- -D warnings

- name: Test
run: cargo test --locked

- name: Build production function
run: cargo build --release --locked
155 changes: 155 additions & 0 deletions docs/iroh-offline-pairing-v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Iroh offline same-account pairing v1

Offline QR pairing is authorized by two backend-signed endpoint attestations.
Possession of the QR payload is never sufficient.

## Online preparation

Authenticated clients fetch `GET /api/devices/iroh`. Its
`grant_verification_keys` field is a version 1 public Ed25519 key set containing
the current key and, during rotation, one previous key. The response never
contains a private key, account ID, email, or team ID.

An authenticated client requests an attestation for its active binding with:

```http
POST /api/devices/iroh/endpoint-attestations
Content-Type: application/json

{"bindingId":"<binding UUID>"}
```

The response contains `attestation_version`, `attestation`, `expires_at`, and
the same public verification-key set. The attestation lifetime is 24 hours.
Revoked bindings and bindings owned by another account return `binding_not_found`.

The web deployment requires these server-only values:

- `CMUX_IROH_ACCOUNT_SUBJECT_SECRET_B64`: 32 random bytes in standard base64.
- `CMUX_IROH_GRANT_SIGNING_KEY_P8`: an Ed25519 PKCS#8 private key in PEM form.
- `CMUX_IROH_GRANT_SIGNING_KID`: the current key ID.
- `CMUX_IROH_GRANT_VERIFICATION_KEYS_JSON`: the version 1 current plus optional
previous public-key set shown by the API.

Generate signing material with:

```sh
openssl genpkey -algorithm ED25519 -out iroh-grant-current.pem
openssl pkey -in iroh-grant-current.pem -pubout -outform DER | openssl base64 -A
openssl rand -base64 32
```

Never put the private key or account-subject secret in a client-visible Vercel
variable. Rotate signing keys in three deployments:

1. Keep the old signer and `current_kid`, then add the next public key as the
second verification key.
2. After clients have fetched that key set, switch the signer and `current_kid`
to the new key while retaining the old public key as the second key.
3. At least seven days after the signer switch, remove the old public key. Seven
days is the maximum online pair-grant lifetime.

The service rejects a deployment whose private signer does not match
`current_kid`. Roll back signer, KID, and verification-key JSON as one unit. A
forced account-subject-secret rotation invalidates cached offline attestations,
so clients must refresh before pairing.

## Signed attestation

The attestation is a compact JWS signed with Ed25519. The protected header has
exactly these fields:

```json
{"alg":"EdDSA","typ":"cmux-endpoint-attestation-v1+jwt","kid":"<current key ID>"}
```

The payload has exactly these fields:

```json
{
"version": 1,
"jti": "<UUID>",
"sub": "<32-byte unpadded base64url account subject>",
"bindingId": "<UUID>",
"deviceId": "<UUID>",
"endpointId": "<64 lowercase hex characters>",
"identityGeneration": 1,
"platform": "ios",
"iat": 1783627200,
"nbf": 1783627195,
"exp": 1783713600,
"alpn": "cmux/mobile/1",
"scope": "cmux.offline-pair.same-account"
}
```

`sub` is HMAC-SHA256 over the private backend account identifier with a
dedicated server secret and a versioned domain separator. It lets two devices
compare account membership without disclosing the underlying identifier. It is
stable for that account until the subject secret rotates. A peer that collects
copied attestations can therefore correlate them as belonging to the same
account during their 24-hour validity. Session-scoping `sub` would require both
devices to contact the backend for the same session, which would remove the
offline property. The one-use local invitation below limits authorization
replay, but does not remove this pseudonymous correlation. The final privacy
review must re-evaluate this tradeoff before release.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

## Offline authorization

The Mac creates a five-minute local pairing session inside its endpoint actor.
It generates a random UUID `session_id` and 32 random bytes `proof`. The QR
contains this exact authorization object plus the Mac attestation:

```json
{
"version": 1,
"session_id": "<UUID>",
"proof": "<32-byte unpadded base64url>",
"expires_at": 1783627500,
"acceptor_attestation": "<compact JWS>"
}
```

The Mac stores only the proof hash, exact local binding/device/EndpointID/
identity-generation tuple, expiry, and an unconsumed marker. Route hints may be
included elsewhere in the QR, but never enter the proof transcript. The iOS
initiator presents the QR authorization and its own cached attestation after
the authenticated Iroh connection is established. The Mac performs all checks
and the consume transition in one actor-isolated operation:

1. Verify canonical JWS encoding and Ed25519 signature with a cached current or
previous public key.
2. Require the fixed version, type, ALPN, scope, and a currently valid lifetime.
3. Bind every device, binding, EndpointID, identity generation, and platform
claim to the expected local state and the authenticated Iroh peer EndpointID.
4. Require an iOS initiator, a Mac acceptor, distinct bindings, devices, and
EndpointIDs, and equal 32-byte account subjects.
5. Require the signed online pair-grant direction everywhere: iOS initiator and
Mac acceptor.
6. Require the exact unexpired local `session_id`, constant-time proof-hash
match, exact local acceptor tuple, and `consumed_at == nil`.
7. Apply local revocation and pairing-disabled state, then set `consumed_at`
before returning the accepted admission.

A missing attestation, one attestation used for both peers, a subject mismatch,
an expired token, an EndpointID substitution, a wrong proof, or a replayed
session fails closed. A failed proof or attestation check does not consume the
session. A successful session is consumed even if later application setup
fails, so retry requires a new QR. Network addresses inside a QR remain
untrusted route hints and do not participate in authorization.

Offline verification cannot observe a revocation made after the last refresh.
The 24-hour expiry bounds that window. A client without a fresh attestation must
go online before first-time pairing.

## Release gate

The TypeScript reference verifier and backend behavior tests enforce this
contract, including one-use consumption and staged key rotation. Shipping
offline QR pairing remains blocked until the Swift client has equivalent actor
tests that prove QR possession alone fails, both attestations are required, the
live Iroh EndpointIDs are bound, concurrent replay has one winner, and current
plus previous key rotation works. Release also requires a privacy decision on
the documented 24-hour pseudonymous account-correlation window. Production and
staging must use distinct account-subject secrets and Ed25519 signing key sets,
so an attestation from one environment cannot verify in another.
5 changes: 5 additions & 0 deletions services/iroh-relay-minter/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configure these only on the isolated relay-minter Vercel project.
IROH_SERVICES_API_SECRET=
CMUX_IROH_MINT_HMAC_SECRET_B64=
# Optional, minter-only overlap key during a bounded HMAC rotation.
CMUX_IROH_MINT_HMAC_PREVIOUS_SECRET_B64=
4 changes: 4 additions & 0 deletions services/iroh-relay-minter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target/
/.vercel/
/.env*
!/.env.example
Loading
Loading