Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs: clarify tunnel upgrade keeps valid pairings

Steven Enamakel2917cdb3f0b0
diff --git a/crates/openhuman-core/src/security/devices/README.md b/crates/openhuman-core/src/security/devices/README.md
index a0353c880a..7034a2da88 100644
--- a/crates/openhuman-core/src/security/devices/README.md
+++ b/crates/openhuman-core/src/security/devices/README.md
@@ -113,7 +113,7 @@ revives a device another process revoked. With no backend configured (the deskto
## Notes / gotchas
-- **Handshake frame format** (`bus::handle_tunnel_frame`): `0x03 || client_handshake_eph_pub(32) || nonce(24) || ciphertext+tag`. The device seals its static public key and session ephemeral public key under a key derived with HKDF-SHA256 from the handshake ephemeral-to-core-static DH, salted by `client_handshake_eph_pub || core_static_pub`. The 33-byte marker and public-key header is authenticated as associated data. The core replies with `0x04 || nonce(24) || ciphertext+tag`; its key comes from the static DH salted by the client session ephemeral public key, and its associated data is `0x04 || client_session_eph_pub`. The reply carries the server session ephemeral public key. Raw-DH `0x01` handshakes and plaintext public keys are rejected; older clients must upgrade and re-pair.
+- **Handshake frame format** (`bus::handle_tunnel_frame`): `0x03 || client_handshake_eph_pub(32) || nonce(24) || ciphertext+tag`. The device seals its static public key and session ephemeral public key under a key derived with HKDF-SHA256 from the handshake ephemeral-to-core-static DH, salted by `client_handshake_eph_pub || core_static_pub`. The 33-byte marker and public-key header is authenticated as associated data. The core replies with `0x04 || nonce(24) || ciphertext+tag`; its key comes from the static DH salted by the client session ephemeral public key, and its associated data is `0x04 || client_session_eph_pub`. The reply carries the server session ephemeral public key. Raw-DH `0x01` handshakes and plaintext public keys are rejected; older clients must upgrade before reconnecting. An upgraded client can reuse its pairing profile and device key while the channel and credential remain valid.
- **`TunnelCipher` frame format** (`crypto`): `0x02 || nonce(24) || ciphertext+tag`. Session keys derive from the static and session ephemeral DH values with separate client-to-server and server-to-client HKDF labels. Each frame has a random nonce; the receiver tracks a 128-entry replay window. Wrap the cipher in a `Mutex`/`RwLock` at the call site (`open` takes `&mut self`).
- The `label` persisted on pairing currently falls back to the `channel_id` (the pending session stores no real label field; `PairingSession.channel_id` is used as the label source).
- `devices_revoke` only tears down local + in-memory state. There is **no backend revoke endpoint yet** (TODO referencing PR #709 follow-up); the backend channel is left to expire via the pairing-token TTL.
diff --git a/crates/openhuman-core/src/security/devices/crypto.rs b/crates/openhuman-core/src/security/devices/crypto.rs
index b0eb5b75fe..b3cc3306d2 100644
--- a/crates/openhuman-core/src/security/devices/crypto.rs
+++ b/crates/openhuman-core/src/security/devices/crypto.rs
@@ -4,8 +4,8 @@
//! Wire format (frame v2): `version(1=0x02) || nonce(24) || ciphertext+tag`.
//! Frames produced with the previous `version=0x01` shape (single shared key,
//! same key in both directions, no KDF) are no longer accepted; peers MUST
-//! re-pair after upgrade. The iOS client is marked in-progress / non-shipping
-//! in CLAUDE.md, so the forced re-pair is acceptable.
+//! upgrade before reconnecting. An upgraded client may reuse a valid pairing
+//! profile and device key.
//!
//! Session key derivation (`derive_session_keys`):
//! ```text
@@ -287,7 +287,7 @@ impl TunnelCipher {
///
/// Frames with `version = 0x01` (the pre-upgrade single-key shape) are
/// rejected with an explicit `UnsupportedFrameVersion` message so peers
- /// see a clear "re-pair required" signal instead of a generic AEAD
+ /// see a clear "client upgrade required" signal instead of a generic AEAD
/// failure.
pub fn open(&mut self, frame: &[u8]) -> Result<Vec<u8>, String> {
if frame.is_empty() {
@@ -296,7 +296,7 @@ impl TunnelCipher {
if frame[0] == LEGACY_FRAME_VERSION_V1 {
return Err(
"[devices/crypto] UnsupportedFrameVersion: legacy v1 frame rejected — \
- peer must re-pair to upgrade to v2 directional subkeys"
+ peer must upgrade to v2 directional subkeys before reconnecting"
.into(),
);
}