fix(python): declare off1 address to relay (Internet transport parity with Swift) - #404
Open
kivtxs wants to merge 1 commit into
Open
fix(python): declare off1 address to relay (Internet transport parity with Swift)#404kivtxs wants to merge 1 commit into
kivtxs wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
The Python Internet transport authenticated the WebSocket connection but never
answered the relay's address-routing challenge, so a Python node's off1 address
was never bound on the relay. The relay could therefore not route messages
addressed to that node, which breaks addressed sends and service discovery over
the Internet transport. The Swift transport (AddressDeclarationPolicy +
InternetManager) already performs this handshake, so this was a Python/Swift
parity gap.
On `Authenticated`, when the relay advertises the `address_routing_v1`
capability and includes an `address_challenge`, sign the domain-separated proof
("offline-relay-addr-v1" || u32be(len(account)) || account || challenge) with the
node identity key and reply with `DeclareAddress`, matching the Swift
implementation and the relay's `address_binding::address_proof_payload`. Also log
the relay's `AddressDeclared` / `AddressDeclarationRefused` responses.
Additive and non-destructive: relays that do not advertise the capability or
omit the challenge see no change, and any failure in the new path is caught and
leaves the authenticated session intact (unrouted, as before).
Validated against relay-server: the node's off1 address now binds on connect.
kivtxs
force-pushed
the
fix/python-internet-declare-address
branch
from
August 21, 2026 20:05
2eeca96 to
e9a90d4
Compare
Member
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Problem
The Python Internet transport (
bindings/python/offline_protocol_sdk/internet_manager.py) authenticates the WebSocket connection to the relay ({"type":"Authenticate","token":…}) but never answers the relay's address-routing challenge. As a result a Python node'soff1…address is never bound on the relay, so the relay cannot route messages addressed to it. Addressed sends and Service Discovery over the Internet transport therefore never reach a Python node.The Swift transport already implements this handshake (
bindings/react-native/ios/AddressDeclarationPolicy.swift+InternetManager.swift), so this was a Python/Swift parity gap, not a protocol change.Repro
Bring up
relay-server(it advertises theaddress_routing_v1capability and mints anaddress_challengein itsAuthenticatedframe). Connect a Python node via the Internet transport and connect an RN/Swift node. The Swift node logsBinding address off1… to user …; the Python node authenticates but its address is never bound — confirmed in the relay'sconnection_managerlogs.Fix
On
Authenticated, when the relay advertises theaddress_routing_v1capability and includes anaddress_challenge, sign the domain-separated proof and reply withDeclareAddress:This matches the relay's
address_binding::address_proof_payloadand the SwiftAddressDeclarationPolicybyte-for-byte (domain, big-endian length prefix, standard-padded base64). The relay'sAddressDeclared/AddressDeclarationRefusedresponses are now logged.Why it's safe (additive, non-destructive)
address_routing_v1and sends a non-empty 32-byte challenge and a username is present. Relays without the capability (or that omit the challenge) see byte-identical behavior to today._handle_authenticated/_safe_handle_authenticatedparams are optional with defaults.Validation
Ran a Python node against
relay-serverwith this fix. The relay now logs on connect:i.e. the node's
off1address binds and becomes routable, matching Swift-node behavior. Without the fix, theBinding address …line never appears for a Python node.