Skip to content
This repository was archived by the owner on May 2, 2026. It is now read-only.

fix(pair): wrap AuthNodeInfo in Message envelope before sending#12

Merged
filinvadim merged 1 commit intomainfrom
claude/compress-nodeauthinfo-CWZ4u
Apr 26, 2026
Merged

fix(pair): wrap AuthNodeInfo in Message envelope before sending#12
filinvadim merged 1 commit intomainfrom
claude/compress-nodeauthinfo-CWZ4u

Conversation

@filinvadim
Copy link
Copy Markdown
Member

Summary

The server's auth middleware unmarshals every external stream payload as the canonical Message envelope (body / message_id / node_id / path / timestamp / version / signature) before routing to the handler. WarpnetClient.pair() was sending the AuthNodeInfo JSON unwrapped, so the middleware refused the stream:

ERRO middleware: auth: unmarshaling data: /private/post/admin/pair/0.0.0
{"user_id":"01KPC4AP7FDEHD8CPTYZAKKDBK","token":"…","psk":"…",
 "node_id":"…","addresses":[…],"bootstrap_peers":[…],"network":"testnet"} <nil>

Change

Mirror what request() already does for every other call:

  • Build a WarpnetEnvelope around the raw AuthNodeInfo JSON, set path = PRIVATE_POST_PAIR, sign the body via the existing signer.sign(...).
  • Marshal the envelope JSON and ship that on the wire instead of the raw body.

The body field inside the envelope is the original AuthNodeInfo JSON the QR carried, so the pair handler's serverAuthInfo.Token == clientInfo.Token comparison still matches byte-for-byte.

Note

Pure Kotlin transport-module change; no Go change, so warpnet.aar does not need to be rebuilt for this fix.

Test plan

  • Re-pair against the local fat node — the pair stream should return {"code":0,"message":"Accepted"} and warpdroid should persist the identity.

https://claude.ai/code/session_011638L4REv78jEVUjQsniPz


Generated by Claude Code

The server's auth middleware unmarshals every external stream payload as
the canonical Message envelope (body / message_id / node_id / path /
timestamp / version / signature) before routing to the handler.
WarpnetClient.pair() was sending the AuthNodeInfo JSON unwrapped, so the
middleware refused the stream:

    middleware: auth: unmarshaling data: /private/post/admin/pair/0.0.0
    {"user_id":"...","token":"...","psk":"...",...} <nil>

Mirror request(): build a WarpnetEnvelope around the raw AuthNodeInfo
JSON, sign the body, and send the envelope JSON. The body inside the
envelope is the original AuthNodeInfo JSON the QR carried, so the pair
handler's token comparison against serverAuthInfo.Token still matches
byte-for-byte.
@filinvadim filinvadim merged commit eb1ea8f into main Apr 26, 2026
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants