You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to WASM limitations the io feature is disabled in JS auto-generated bindings. We should consider whether to offer an alternative for fetching OHTTP keys in JS bindings, at a minimum just documenting how to fetch keys with the fetch API.
This could be a good first issue because it's well defined for someone who understands HTTP, WebSocket, and TLS clients, but it definitely has some sharp edges. The thing is this issue is implementing a solution that has already been proven in Mutiny ages ago.
The thing is with NodeJS you can probably use the HTTPS client to do CONNECT requests and nest the bootstrap fetch OHTTP keys messages. If NodeJS has the HTTPS client, it may already have a viable TLS client available there to do the nested TLS.
However, in the browser, I'm not sure CONNECT requests are available with the fetch API. Nor is a TLS client API available on any such CONNECT client or shipped made available to JavaScript. So I would include rustls to nest TLS in the example and then if CONNECT can't work I'd use the directory's WebSocket API instead to bootstrap and close this issue.
Hey there!
I realized in the browser environment, when we end up having to use the HTTPS in WS proxy, we don't have access to any CA Trust Store, (I don't think browsers provide a way to access it).
In that case, we'd likely have to bundle a whole trust store with the bindings themselves. We can use Mozilla's CA Bundle, but that would introduce challenges with keeping it updated, etc.
Let me know what you recommend.
P.S. is it necessary to use rustls for userspace TLS over WS? Can't we use something like node-forge and not have to deal with any WASM blobs.
Yes i believe we have to ship rustls, not because we're using wss:// but because we're proxying serialized TLS messages over that connection. Theoretically it may be possible to use node-forge but I think you'll find it much easier, especially for a first integration, to bind to something that wraps rustls in wasm as is explicitly demonstrated here in Mutiny Wallet. I suggest you re-write a ws-tls proxy/tunnel fetch function with rustls and expose that as a js-io-specific fetch function.
Hi @Anunayj, are you still planning to work on this? It now conflicts with master since the JS bindings were split into src/nodejs and src/web in #1513.If you’ve moved on, I’d like to pick up #1250. I’d follow how Python (#1386) and Dart (#1495) did it, which #1362 asks for: a small native fetchOhttpKeys in TypeScript for Node using built-in http CONNECT and tls, instead of reviving io in payjoin-ffi. For the browser I’d document the CONNECT limitation for now and leave the WebSocket/rustls bootstrap for a follow-up.
Thanks @Anunayj, glad you’re picking it back up! I went through the branch and noted a few things that might save you time: It’ll need a rebase. The JS bindings got split into src/nodejs/ and src/web/ in #1513.
I think the WebSocket path is hitting the wrong endpoint. It requests /ohttp-keys, but keys are served at /.well-known/ohttp-gateway.
I didn’t see a status check on either path, so a server error would show up as a decode error.
When CONNECT fails and it falls back to WebSocket, the first error gets lost, which could make debugging harder.
Activity
DanGould commentedon Dec 30, 2025
This could be a good first issue because it's well defined for someone who understands HTTP, WebSocket, and TLS clients, but it definitely has some sharp edges. The thing is this issue is implementing a solution that has already been proven in Mutiny ages ago.
The thing is with NodeJS you can probably use the HTTPS client to do CONNECT requests and nest the bootstrap fetch OHTTP keys messages. If NodeJS has the HTTPS client, it may already have a viable TLS client available there to do the nested TLS.
However, in the browser, I'm not sure CONNECT requests are available with the fetch API. Nor is a TLS client API available on any such CONNECT client or shipped made available to JavaScript. So I would include rustls to nest TLS in the example and then if CONNECT can't work I'd use the directory's WebSocket API instead to bootstrap and close this issue.
Anunayj commentedon Jan 15, 2026
Hey! I think I can try to take a dig at this, this weekend.
spacebear21 commentedon Jan 15, 2026
Cool! The JS bindings are brand new and may be tricky to work with, so please don't hesitate to ask questions here or DM for guidance.
Anunayj commentedon Jan 18, 2026
Hey there!
I realized in the browser environment, when we end up having to use the HTTPS in WS proxy, we don't have access to any CA Trust Store, (I don't think browsers provide a way to access it).
In that case, we'd likely have to bundle a whole trust store with the bindings themselves. We can use Mozilla's CA Bundle, but that would introduce challenges with keeping it updated, etc.
Let me know what you recommend.
P.S. is it necessary to use rustls for userspace TLS over WS? Can't we use something like
node-forgeand not have to deal with any WASM blobs.DanGould commentedon Jan 19, 2026
Yes i believe we have to ship rustls, not because we're using
wss://but because we're proxying serialized TLS messages over that connection. Theoretically it may be possible to usenode-forgebut I think you'll find it much easier, especially for a first integration, to bind to something that wrapsrustlsin wasm as is explicitly demonstrated here in Mutiny Wallet. I suggest you re-write a ws-tls proxy/tunnel fetch function with rustls and expose that as a js-io-specific fetch function.Implement WASM comptaible implementation of io.
mwihoti commentedon Nov 19, 2026
Hi @Anunayj, are you still planning to work on this? It now conflicts with master since the JS bindings were split into src/nodejs and src/web in #1513.If you’ve moved on, I’d like to pick up #1250. I’d follow how Python (#1386) and Dart (#1495) did it, which #1362 asks for: a small native fetchOhttpKeys in TypeScript for Node using built-in http CONNECT and tls, instead of reviving io in payjoin-ffi. For the browser I’d document the CONNECT limitation for now and leave the WebSocket/rustls bootstrap for a follow-up.
Anunayj commentedon Nov 19, 2026
Hey @mwihoti I can pick this up this weekend, let me know if you have any review comments.
mwihoti commentedon Nov 19, 2026
Thanks @Anunayj, glad you’re picking it back up! I went through the branch and noted a few things that might save you time: It’ll need a rebase. The JS bindings got split into src/nodejs/ and src/web/ in #1513.
When CONNECT fails and it falls back to WebSocket, the first error gets lost, which could make debugging harder.
Since Expose native
fetch_ohttp_keysin every supported downstream language #1362 tracks native per-language implementations, it might be worth checking with @spacebear21 which direction they prefer before you rebase.I’d be happy to review again once you push. I’m also keen to learn how the JS bindings work.