Repository navigation
feat(bridge): prove the token with an HMAC challenge instead of sending it - #31
Merged
Merged
Conversation
…ng it Protocol version 1: hello carries a fresh nonce, the net service answers with its nonce and its proof, the bridge verifies it before sending its own proof. Proofs are HMAC-SHA-256 over a context string, the role and both nonces, compared in constant time. Frames carry at most 1024 bytes until welcome.
This was referenced Oct 28, 2026
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
The bridge no longer sends the per-launch token in
hello. Protocol version 1 (anyplaynet/network ADR 0039,spec/bridge-protocol.md#authentication): the bridge sends a fresh 32-byte nonce, the net service answers with its own nonce and its proof, the bridge verifies that proof before it answers with its own, and the net service then sends welcome or reject. Proofs are HMAC-SHA-256 keyed with the token overAnyPlay bridge v1, a role byte and both nonces, compared in constant time. Handshake frames are limited to 1024 bytes of payload. SHA-256 and HMAC are a header (NetBridgeAuth.hpp), nonces come from BCryptGenRandom or/dev/urandom.A bridge that cannot get random numbers, or that meets a service that cannot prove the token, closes the connection and sends nothing. An old net service rejects the new hello and an old bridge gets a reject naming both versions from the new service; the launcher ships both together.
The network side is anyplaynet/network#125; it merges only after this builds green on Windows.
Tested
Not tested on a game. The tests:
net_bridge_auth_vectors(SHA-256 and RFC 4231 vectors, the spec's proof vectors, same bytes as the Rust side),net_bridge_auth_impostor(a fake service that proves with another token never gets an auth frame; the token is in no frame the bridge sends), and the existing FakeNetService tests now run the full handshake.tools/check_conventions.pypasses locally; sources syntax-checked with g++. CI builds are the first full build.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)