[PR #4376] [MERGED] Secure chat: the account's chat key pair, and the command arguments a client signs #5590

Closed
opened 2026-11-03 05:13:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4376
Author: @4404c
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: secure-chat-v2/2-chat-keys


📝 Commits (10+)

  • 06f55b4 Secure chat: the client's signing (RSA private keys, the message chain encoder, the last-seen tracker)
  • 8f843ab Secure chat: the account's chat key pair, and the command arguments a client signs
  • 7e8b9c1 Merge main: SignatureCache::unpack is #4214's
  • 98dfd26 Merge the signing branch and main: the chat keys start where the session now loads
  • 43a2732 Merge remote-tracking branch 'hr/main' into fix/pr-4375
  • 1ba7b1a Merge remote-tracking branch 'hr/main' into fix/pr-4376
  • 65b1d9a Merge branch 'fix/pr-4375' into fix/pr-4376
  • 516327b Port ledger: the key pair rows say what this branch calls
  • 4441194 Merge main into secure-chat-v2/2-chat-keys
  • 8b73bac Merge main: this branch's tests beside #5149's

📊 Changes

11 files changed (+792 additions, -51 deletions)

View changed files

📝 crates/horizon-client-render/src/auth.rs (+284 -0)
📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/lan_chat.rs (+3 -20)
📝 crates/horizon-command/src/lib.rs (+22 -0)
📝 crates/horizon-command/src/network.rs (+45 -0)
📝 crates/horizon-protocol/src/rsa.rs (+153 -15)
📝 crates/horizon-protocol/src/secure_chat.rs (+268 -1)
📝 tools/port_map/client-001.tsv (+7 -7)
📝 tools/port_map/rest-011.tsv (+6 -6)
📝 tools/port_map/rest-021.tsv (+1 -1)
📝 tools/port_map/rest-022.tsv (+1 -1)

📄 Description

🤖 Opened by 4404c's AI agent (Claude Code), not by 4404c themself.

What and why

Second of three PRs for secure chat on Horizon's client (#3520, #3518). Depends on #4375: review this PR's own diff (a PR from a fork targets main, so #4375's changes show here too).

  • auth.rs: the services' certificates endpoint (player / getCertificates in the discovery document), POSTed with the account's access token: the PKCS#8 private key, the X.509 public key, publicKeySignatureV2, expiresAt and refreshedAfter (AccountProfileKeyPairManager.fetchProfileKeyPair). Fetched on a background thread at start and on each join; kept in memory like the token (no profilekeys/ file); renewed past refreshedAfter, checked at most hourly; a failed fetch keeps the old pair.
  • horizon-command: ParseResults::signable_arguments (SignableCommand.of), moved unchanged out of the LAN host's handleSignedChatCommand so a client can run it over a server's tree, with a new test over a server tree.

Nothing sends the key yet: that is the third PR.

Vanilla reference

AccountProfileKeyPairManager (prepareKeyPair, shouldRefreshKeyPair, readOrFetchProfileKeyPair, fetchProfileKeyPair, parsePublicKey), Crypt.rsaStringToKey, SignableCommand.of. Port ledger rows updated; readProfileKeyPair and writeProfileKeyPair stay skip:service, as the pair is never written to disk.

Self-check

This commit alone: 7 files, +364 −28. pr_ready was not run on this branch by itself; run by hand on it: rustfmt ✅, clippy -D warnings on horizon-command, horizon-client-render and horizon-client ✅, their tests ✅ but for the failure below. A pr_ready run on the third PR's branch before main was merged in, which contains this one, is in that PR. After the merge, these were rerun by hand.

Run on Windows, before merging main again at 0d2cb928b. Two failures there are not from this change: test_perf_bench...test_report_without_a_load_average (cmd /C ver in tools/perf_bench.py) and, in horizon-client, title::tests::each_world_preset_writes_its_own_generator (it makes a folder named minecraft:normal, which Windows refuses). Parity not run: it is left to CI.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4376 **Author:** [@4404c](https://github.com/4404c) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `secure-chat-v2/2-chat-keys` --- ### 📝 Commits (10+) - [`06f55b4`](https://github.com/horizon-rust/horizon/commit/06f55b418d00a323d1983c841ce4c74ec9322edf) Secure chat: the client's signing (RSA private keys, the message chain encoder, the last-seen tracker) - [`8f843ab`](https://github.com/horizon-rust/horizon/commit/8f843abb92f44fbe08be6e317fb9c37ed978953d) Secure chat: the account's chat key pair, and the command arguments a client signs - [`7e8b9c1`](https://github.com/horizon-rust/horizon/commit/7e8b9c11548a83f6e7126038e395fef518eb1631) Merge main: SignatureCache::unpack is #4214's - [`98dfd26`](https://github.com/horizon-rust/horizon/commit/98dfd26b6754478e847e2d07cb3cda62ad666129) Merge the signing branch and main: the chat keys start where the session now loads - [`43a2732`](https://github.com/horizon-rust/horizon/commit/43a273225032c8d2efa4b18081e88c4e27cc8e91) Merge remote-tracking branch 'hr/main' into fix/pr-4375 - [`1ba7b1a`](https://github.com/horizon-rust/horizon/commit/1ba7b1a3dc224122f53902c3436fe1e062421428) Merge remote-tracking branch 'hr/main' into fix/pr-4376 - [`65b1d9a`](https://github.com/horizon-rust/horizon/commit/65b1d9a122a12017353418f71e86d7d15a30eb59) Merge branch 'fix/pr-4375' into fix/pr-4376 - [`516327b`](https://github.com/horizon-rust/horizon/commit/516327ba3d56e77f3fdf060a31273a27e0e04e62) Port ledger: the key pair rows say what this branch calls - [`4441194`](https://github.com/horizon-rust/horizon/commit/444119465099f45fb31a752f4f0254f6feda5d9b) Merge main into secure-chat-v2/2-chat-keys - [`8b73bac`](https://github.com/horizon-rust/horizon/commit/8b73bac6cb268e69b34bbddc8b0446d7f214ee8c) Merge main: this branch's tests beside #5149's ### 📊 Changes **11 files changed** (+792 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/auth.rs` (+284 -0) 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan_chat.rs` (+3 -20) 📝 `crates/horizon-command/src/lib.rs` (+22 -0) 📝 `crates/horizon-command/src/network.rs` (+45 -0) 📝 `crates/horizon-protocol/src/rsa.rs` (+153 -15) 📝 `crates/horizon-protocol/src/secure_chat.rs` (+268 -1) 📝 `tools/port_map/client-001.tsv` (+7 -7) 📝 `tools/port_map/rest-011.tsv` (+6 -6) 📝 `tools/port_map/rest-021.tsv` (+1 -1) 📝 `tools/port_map/rest-022.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by 4404c's AI agent (Claude Code), not by 4404c themself. ## What and why Second of three PRs for secure chat on Horizon's client (#3520, #3518). **Depends on #4375**: review [this PR's own diff](https://github.com/4404c/horizon/compare/secure-chat-v2/1-signing...secure-chat-v2/2-chat-keys) (a PR from a fork targets `main`, so #4375's changes show here too). - `auth.rs`: the services' certificates endpoint (`player` / `getCertificates` in the discovery document), POSTed with the account's access token: the PKCS#8 private key, the X.509 public key, `publicKeySignatureV2`, `expiresAt` and `refreshedAfter` (`AccountProfileKeyPairManager.fetchProfileKeyPair`). Fetched on a background thread at start and on each join; kept in memory like the token (no `profilekeys/` file); renewed past `refreshedAfter`, checked at most hourly; a failed fetch keeps the old pair. - `horizon-command`: `ParseResults::signable_arguments` (`SignableCommand.of`), moved unchanged out of the LAN host's `handleSignedChatCommand` so a client can run it over a server's tree, with a new test over a server tree. Nothing sends the key yet: that is the third PR. ## Vanilla reference `AccountProfileKeyPairManager` (`prepareKeyPair`, `shouldRefreshKeyPair`, `readOrFetchProfileKeyPair`, `fetchProfileKeyPair`, `parsePublicKey`), `Crypt.rsaStringToKey`, `SignableCommand.of`. Port ledger rows updated; `readProfileKeyPair` and `writeProfileKeyPair` stay `skip:service`, as the pair is never written to disk. ## Self-check This commit alone: 7 files, +364 −28. `pr_ready` was not run on this branch by itself; run by hand on it: rustfmt ✅, clippy `-D warnings` on horizon-command, horizon-client-render and horizon-client ✅, their tests ✅ but for the failure below. A `pr_ready` run on the third PR's branch before main was merged in, which contains this one, is in that PR. After the merge, these were rerun by hand. Run on Windows, before merging main again at 0d2cb928b. Two failures there are not from this change: `test_perf_bench...test_report_without_a_load_average` (`cmd /C ver` in `tools/perf_bench.py`) and, in horizon-client, `title::tests::each_world_preset_writes_its_own_generator` (it makes a folder named `minecraft:normal`, which Windows refuses). Parity not run: it is left to CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:37 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5590
No description provided.