Skip to content

docs(add-a-relay): show relay config in all five languages - #86

Open
okdistribute wants to merge 5 commits into
mainfrom
rae/use-relay-langs
Open

docs(add-a-relay): show relay config in all five languages#86
okdistribute wants to merge 5 commits into
mainfrom
rae/use-relay-langs

Conversation

@okdistribute

@okdistribute okdistribute commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What

snippets/relay-preset-config.mdx (rendered on /add-a-relay) was Rust-only. It's now a five-language CodeGroup — Rust, Python, Swift, Kotlin, JavaScript — with every example authenticated via the iroh-services preset.

Why authenticated everywhere

Dedicated relays reject an endpoint that doesn't present a relay-scoped access token. A RelayMode.customFromUrls(...) example sets no token, so it would look right and fail to connect.

JavaScript is shaped differently

In JS a preset is a function applied to an EndpointBuilder, not a value passed to bind() — and Endpoint.bind() always applies the n0 preset. So that tab uses Endpoint.builder(), with a one-line note explaining why it differs from the others.

Free-tier line

The closing line said this was a Rust-only trick, which it was. iroh-ffi#284 makes the bindings fall back to the n0 relays like Rust, so omitting the relay URLs is now the free-project path in every language — one sentence, no second preset to explain.

Blocked on

n0-computer/iroh-ffi#284 adds preset_iroh_services to the Python, Swift, Kotlin, and JavaScript bindings. Don't merge this before that ships in an iroh-ffi release — until then those four snippets document an API users can't install. The Rust snippet is unchanged and correct today.

Verification

Every non-Rust signature was checked against generated bindings rather than written from memory — uniffi bindgen run for Python/Swift/Kotlin, napi build for the JS index.d.ts, plus the Rust, Python, and JS tests in iroh-ffi#284.

🤖 Generated with Claude Code

okdistribute and others added 3 commits July 27, 2026 13:05
The relay setup snippet was Rust-only. Add Python, Swift, and Kotlin, all
going through the iroh-services preset so every example is authenticated —
dedicated relays reject an endpoint without a relay-scoped access token.

Also correct the free-project note: it told you to omit relay URLs, which
the bindings reject. That path is Rust-only.

Depends on iroh-ffi#284, which adds preset_iroh_services to the bindings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
JavaScript applies presets as functions on an EndpointBuilder rather than
passing them to bind(), so the tab uses Endpoint.builder() and a short note
explains why.

Also renames secretKey to endpointSecretKey to match iroh-ffi#284, and folds
the "don't set the key outside the preset" warning into one sentence covering
both EndpointOptions and EndpointBuilder.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Passing an API key to iroh_services::preset() without relays is a Rust-only
path, and pointing at it from a page about dedicated relays reads as a
workaround. The n0 preset is the free-project answer in every language.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@okdistribute okdistribute changed the title docs(add-a-relay): show relay config in all four languages docs(add-a-relay): show relay config in all five languages Jul 27, 2026
Now that the bindings match Rust and fall back to the n0 relays, omitting the
relay URLs is the free-project path in every language — simpler than pointing
at a different preset, and it keeps the API key in play.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant