Skip to content

docs(auth): specify big-endian byte order for timestamp in HMAC input - #43

Closed
VasilevNStas wants to merge 0 commit into
APN-Network:masterfrom
VasilevNStas:11-docs/hmac-byte-order
Closed

docs(auth): specify big-endian byte order for timestamp in HMAC input#43
VasilevNStas wants to merge 0 commit into
APN-Network:masterfrom
VasilevNStas:11-docs/hmac-byte-order

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Description

Specifies the byte order for timestamp serialization in the HMAC input for Auth.hmac. No wire changes.

Problem

The hmac comment states the tag is computed over (client_id || timestamp), where timestamp is a uint32. Proto3 varint encoding applies only to the wire format; the HMAC input is a raw byte string assembled outside any wire format. Without an explicit byte order, Go (big-endian convention) and Swift/Kotlin (little-endian) implementations produce different HMAC inputs for the same (client_id, timestamp) pair, causing silent authentication failures.

Fix

Added one sentence: "The timestamp is serialised as 4 bytes in big-endian (network byte order) before concatenation."

Closes #11

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@davvd plz review

@davvd

davvd commented Jul 4, 2026

Copy link
Copy Markdown
Member

@VasilevNStas we have merge conflicts here, please resolve them and we'll merge

@VasilevNStas
VasilevNStas force-pushed the 11-docs/hmac-byte-order branch from d177df8 to d5298ce Compare July 4, 2026 18:02
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@davvd conflicts resolved.

@davvd

davvd commented Jul 25, 2026

Copy link
Copy Markdown
Member

@VasilevNStas conflict here

@VasilevNStas
VasilevNStas force-pushed the 11-docs/hmac-byte-order branch from d5298ce to 97c46d5 Compare July 25, 2026 06:53
@VasilevNStas
VasilevNStas deleted the 11-docs/hmac-byte-order branch July 25, 2026 06:53
@VasilevNStas

VasilevNStas commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@davvd
I closed this PR because PR #58 (#58) already covers the same HMAC big-endian documentation, but with the correct byte count — since PR #58 changes `timestamp` from `uint32` (4 bytes) to `uint64` (8 bytes), the serialization is now 8 bytes in big-endian. Keeping PR #43 open would have required updating 4→8, which is already done in PR #58

The change in PR #58 is the same as what PR #43 intended: documenting that the timestamp in HMAC input is serialised as fixed-width big-endian. PR #58 just has the updated byte count for the new uint64 wire format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth.hmac omits byte-order for timestamp serialization, causing HMAC mismatch across implementations

2 participants