docs(add-a-relay): show relay config in all five languages - #86
Open
okdistribute wants to merge 5 commits into
Open
docs(add-a-relay): show relay config in all five languages#86okdistribute wants to merge 5 commits into
okdistribute wants to merge 5 commits into
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
snippets/relay-preset-config.mdx(rendered on /add-a-relay) was Rust-only. It's now a five-languageCodeGroup— 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 tobind()— andEndpoint.bind()always applies the n0 preset. So that tab usesEndpoint.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_servicesto 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 buildfor the JSindex.d.ts, plus the Rust, Python, and JS tests in iroh-ffi#284.🤖 Generated with Claude Code