feat: shared token support #39

Merged
decentral1se merged 1 commits from shared-token into main 2026-11-17 12:17:00 +00:00
Owner

Description

https://codeberg.org/cblgh/jasmine-teehaus/issues/1#issuecomment-27878458

This is a bit messy due to https://github.com/n0-computer/iroh-ffi/issues/307.

Checklist

  • I/we have not used so-called 'AI' to create the proposed changes.
# Description https://codeberg.org/cblgh/jasmine-teehaus/issues/1#issuecomment-27878458 This is a bit messy due to https://github.com/n0-computer/iroh-ffi/issues/307. ## Checklist - [x] I/we have not used so-called 'AI' to create the proposed changes.
decentral1se added 1 commit 2026-11-17 12:13:56 +00:00
feat: shared token support
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
3bb9f4b489
decentral1se merged commit 09c22f8df1 into main 2026-11-17 12:17:00 +00:00
cblgh deleted branch shared-token 2026-11-17 13:12:35 +00:00
Collaborator

🔥 nice with the issue also!

fwiw i wonder if you could also do a hacky thing using the query params support my.relay.com?token=THETOKENYOUSET

obv for bindings and other libraries like iroh-go the less hacky (i.e. not relying on the above) the better :)

edit: yep just tried appending ?token=<secret> and it works (i.e. no longer hangs forever)!

🔥 nice with the issue also! fwiw i wonder if you could also do a hacky thing using the [query params support](https://github.com/n0-computer/iroh/tree/main/iroh-relay#shared-token-local-no-external-service) `my.relay.com?token=THETOKENYOUSET` obv for bindings and other libraries like iroh-go the less hacky (i.e. not relying on the above) the better :) edit: yep just tried appending `?token=<secret>` and it works (i.e. no longer hangs forever)!
Collaborator

@decentral1se here's the hacky shit i did in iroh-tracker just now (haven't started using the WithXYZ niceties there yet)

func GetCommunityOpts(alpn []byte) iroh.EndpointOptions {
    preset := iroh.PresetN0DisableRelay()
    address := jt.GetAddresses(jt.GetRelays(jt.MAJOR_V1))[0]

    token := os.Getenv("JT_TOKEN")
    if token == "" {
        fmt.Println("missing JT_TOKEN")
        os.Exit(1)
    }
    relay, err := iroh.RelayModeCustomFromUrls([]string{fmt.Sprintf("%s?token=%s", address, token)})
    if err != nil {
        panic(err)
    }
    opts := iroh.EndpointOptions{
        Preset:    &preset,
        Alpns:     &[][]byte{alpn},
        RelayMode: &relay,
    }
    return opts
}
@decentral1se here's the hacky shit i did in iroh-tracker just now (haven't started using the `WithXYZ` niceties there yet) ```golang func GetCommunityOpts(alpn []byte) iroh.EndpointOptions { preset := iroh.PresetN0DisableRelay() address := jt.GetAddresses(jt.GetRelays(jt.MAJOR_V1))[0] token := os.Getenv("JT_TOKEN") if token == "" { fmt.Println("missing JT_TOKEN") os.Exit(1) } relay, err := iroh.RelayModeCustomFromUrls([]string{fmt.Sprintf("%s?token=%s", address, token)}) if err != nil { panic(err) } opts := iroh.EndpointOptions{ Preset: &preset, Alpns: &[][]byte{alpn}, RelayMode: &relay, } return opts } ```
Sign in to join this conversation.