feat(gateway): TLS 1.3 only control plane and LNEx v3 channel-bound handshake

Replace the X25519/HKDF/ChaCha20 TCP layer with rustls TLS 1.3 (ALPN
vnox-lnex/3). Auto-generate a self-signed certificate keyed by the server
identity or load an operator certificate, publish the SPKI fingerprint,
bind HELLO and AUTH signatures to the TLS exporter, reject plaintext, TLS 1.2
and LNEx v2 peers with an explicit error. BREAKING: protocol v3.

Claude-Session: https://claude.ai/code/session_01GDjxLvBcnJqniFQGUGb1V4
This commit is contained in:
Loki 2026-10-24 22:05:30 +02:00
parent a5b9c324f7
commit 0d2af0ddd6
Signed by: boba
GPG key ID: 253067914055423B
45 changed files with 1322 additions and 806 deletions

View file

@ -4,16 +4,13 @@ use tokio::io::{AsyncRead, AsyncWrite};
use crate::{
domain::session,
net::{io, state::State},
proto::{
GuildInfo, GuildListPayload, PacketId, SessionCrypto, UserRoleUpdatePayload, to_payload,
},
proto::{GuildInfo, GuildListPayload, PacketId, UserRoleUpdatePayload, to_payload},
};
pub async fn handle_guild_list(
stream: &mut (impl AsyncRead + AsyncWrite + Unpin),
seq: &mut u32,
session_id: &str,
crypto: &SessionCrypto,
state: &State,
) -> Result<()> {
let sess = session::get(&state.sessions, session_id)
@ -39,7 +36,7 @@ pub async fn handle_guild_list(
.max_by_key(|r| r.position)
.map(|r| r.color.clone())
.unwrap_or_else(|| "#ffffff".into());
io::send_encrypted(
io::send_frame(
stream,
PacketId::UserRoleUpdate,
seq,
@ -48,17 +45,15 @@ pub async fn handle_guild_list(
guild_id: g.id.clone(),
color,
}),
crypto,
)
.await?;
}
io::send_encrypted(
io::send_frame(
stream,
PacketId::GuildList,
seq,
&to_payload(&GuildListPayload { guilds }),
crypto,
)
.await?;
Ok(())