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
466 lines
13 KiB
Protocol Buffer
466 lines
13 KiB
Protocol Buffer
syntax = "proto3";
|
|
package lnex;
|
|
|
|
// ─── HANDSHAKE ──────────────────────────────────────────────────────────────
|
|
|
|
message Hello {
|
|
string lnex_version = 1;
|
|
bytes server_pubkey = 2;
|
|
bytes challenge_nonce = 3;
|
|
string node_name = 4;
|
|
// LNEx v3: the ephemeral X25519 exchange was replaced by TLS 1.3.
|
|
reserved 5;
|
|
reserved "server_eph_pubkey";
|
|
bool private_mode = 6;
|
|
// Ed25519 over "VNOX-LNEx-v3-server-hello\0" || tls_exporter || Hello(signature empty).
|
|
bytes server_signature = 7;
|
|
}
|
|
|
|
message Auth {
|
|
bytes client_pubkey = 1;
|
|
string nickname = 2;
|
|
string lnex_version = 3;
|
|
// Ed25519 over the client-auth transcript bound to the TLS exporter (see docs/02-protocol/tls.md).
|
|
bytes signature = 4;
|
|
reserved 5;
|
|
reserved "client_eph_pubkey";
|
|
}
|
|
|
|
message Session {
|
|
string session_id = 1;
|
|
string token = 2;
|
|
int64 expires_at = 3;
|
|
}
|
|
|
|
// ─── KEEPALIVE ──────────────────────────────────────────────────────────────
|
|
|
|
message Ping { int64 timestamp = 1; }
|
|
message Pong { int64 timestamp = 1; }
|
|
|
|
// ─── ERROR / DISCONNECT ─────────────────────────────────────────────────────
|
|
|
|
message Error { uint32 code = 1; string message = 2; }
|
|
message Disconnect { string reason = 1; }
|
|
|
|
// ─── CHANNELS ───────────────────────────────────────────────────────────────
|
|
|
|
message JoinChannel { string channel_id = 1; }
|
|
message LeaveChannel { string channel_id = 1; }
|
|
|
|
message ChannelState {
|
|
string channel_id = 1;
|
|
string channel_name = 2;
|
|
string kind = 3;
|
|
repeated MemberInfo members = 4;
|
|
string voice_endpoint = 5;
|
|
optional string guild_id = 6;
|
|
}
|
|
|
|
message MemberInfo {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
bool in_voice = 3;
|
|
}
|
|
|
|
message ChannelCreate {
|
|
string channel_id = 1;
|
|
string channel_name = 2;
|
|
string kind = 3;
|
|
optional string guild_id = 4;
|
|
}
|
|
|
|
message ChannelDelete { string channel_id = 1; }
|
|
|
|
message ChannelEdit {
|
|
string channel_id = 1;
|
|
string channel_name = 2;
|
|
}
|
|
|
|
message ChannelList {
|
|
repeated ChannelListItem channels = 1;
|
|
optional string guild_id = 2;
|
|
}
|
|
|
|
message ChannelListItem {
|
|
string channel_id = 1;
|
|
string channel_name = 2;
|
|
string kind = 3;
|
|
optional string guild_id = 4;
|
|
}
|
|
|
|
message UserJoin { string channel_id = 1; string user_id = 2; string nickname = 3; }
|
|
message UserLeave { string channel_id = 1; string user_id = 2; }
|
|
|
|
// ─── CHAT ────────────────────────────────────────────────────────────────────
|
|
|
|
message ChatMessage {
|
|
string message_id = 1;
|
|
string channel_id = 2;
|
|
string sender_id = 3;
|
|
string content = 4;
|
|
int64 timestamp = 5;
|
|
bool edited = 6;
|
|
optional string reply_to = 7;
|
|
}
|
|
|
|
message ChatHistory {
|
|
string channel_id = 1;
|
|
repeated ChatMessage messages = 2;
|
|
}
|
|
|
|
message ReactionPayload {
|
|
string message_id = 1;
|
|
string channel_id = 2;
|
|
string emoji = 3;
|
|
string user_id = 4;
|
|
}
|
|
|
|
message MessageEdit {
|
|
string message_id = 1;
|
|
string channel_id = 2;
|
|
string content = 3;
|
|
}
|
|
|
|
message MessageDelete {
|
|
string message_id = 1;
|
|
string channel_id = 2;
|
|
}
|
|
|
|
// ─── VOICE ──────────────────────────────────────────────────────────────────
|
|
|
|
message VoiceState {
|
|
string user_id = 1;
|
|
string channel_id = 2;
|
|
string state = 3;
|
|
}
|
|
|
|
// ─── GUILDS ─────────────────────────────────────────────────────────────────
|
|
|
|
message GuildCreate { string name = 1; }
|
|
|
|
message GuildInfo {
|
|
string id = 1;
|
|
string owner_id = 2;
|
|
string name = 3;
|
|
int64 member_count = 4;
|
|
int64 created_at = 5;
|
|
}
|
|
|
|
message GuildDelete { string guild_id = 1; }
|
|
message GuildList { repeated GuildInfo guilds = 1; }
|
|
|
|
message GuildMemberJoin { string guild_id = 1; }
|
|
message GuildMemberLeave { string guild_id = 1; string user_id = 2; }
|
|
message GuildMemberKick { string guild_id = 1; string user_id = 2; }
|
|
|
|
message RoleCreate {
|
|
string guild_id = 1;
|
|
string name = 2;
|
|
optional string color = 3;
|
|
optional uint64 permissions = 4;
|
|
string id = 5;
|
|
}
|
|
|
|
message RoleDelete {
|
|
string guild_id = 1;
|
|
string role_id = 2;
|
|
}
|
|
|
|
message InviteCreate {
|
|
string guild_id = 1;
|
|
optional int64 max_uses = 2;
|
|
optional int64 expires_in_seconds = 3;
|
|
}
|
|
|
|
message InviteInfo {
|
|
string id = 1;
|
|
string guild_id = 2;
|
|
string guild_name = 3;
|
|
string code = 4;
|
|
string creator_id = 5;
|
|
optional int64 max_uses = 6;
|
|
int64 uses = 7;
|
|
optional int64 expires_at = 8;
|
|
int64 created_at = 9;
|
|
}
|
|
|
|
message InviteAccept {
|
|
string code = 1;
|
|
string guild_id = 2;
|
|
string guild_name = 3;
|
|
}
|
|
|
|
message InviteDelete {
|
|
string guild_id = 1;
|
|
string invite_id = 2;
|
|
}
|
|
|
|
message GuildAuditLogFetch {
|
|
string guild_id = 1;
|
|
int64 limit = 2;
|
|
}
|
|
|
|
message AuditLogEntry {
|
|
string id = 1;
|
|
string guild_id = 2;
|
|
string actor_id = 3;
|
|
string action = 4;
|
|
optional string target_id = 5;
|
|
optional string target_type = 6;
|
|
optional string reason = 7;
|
|
int64 created_at = 8;
|
|
}
|
|
|
|
message GuildAuditLog {
|
|
string guild_id = 1;
|
|
repeated AuditLogEntry entries = 2;
|
|
}
|
|
|
|
message GuildMemberListFetch { string guild_id = 1; }
|
|
|
|
message GuildMemberInfo {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
int64 joined_at = 3;
|
|
string role_color = 4;
|
|
string role_name = 5;
|
|
bool is_owner = 6;
|
|
}
|
|
|
|
message GuildMemberList {
|
|
string guild_id = 1;
|
|
repeated GuildMemberInfo members = 2;
|
|
}
|
|
|
|
message RoleAssign {
|
|
string guild_id = 1;
|
|
string user_id = 2;
|
|
string role_id = 3;
|
|
}
|
|
|
|
message GuildRoleListFetch { string guild_id = 1; }
|
|
|
|
message GuildRoleInfo {
|
|
string id = 1;
|
|
string guild_id = 2;
|
|
string name = 3;
|
|
string color = 4;
|
|
uint64 permissions = 5;
|
|
int32 position = 6;
|
|
}
|
|
|
|
message GuildRoleList {
|
|
string guild_id = 1;
|
|
repeated GuildRoleInfo roles = 2;
|
|
}
|
|
|
|
// ─── DIRECT MESSAGES ────────────────────────────────────────────────────────
|
|
|
|
message DmStart {
|
|
string target_user_id = 1;
|
|
}
|
|
|
|
message DmStartResponse {
|
|
string dm_id = 1;
|
|
string other_user_id = 2;
|
|
string other_nickname = 3;
|
|
repeated DmMessage messages = 4;
|
|
uint32 unread_count = 5;
|
|
}
|
|
|
|
message DmMessage {
|
|
string dm_id = 1;
|
|
string sender_id = 2;
|
|
string content = 3;
|
|
int64 timestamp = 4;
|
|
}
|
|
|
|
message DmHistory {
|
|
string dm_id = 1;
|
|
repeated DmMessage messages = 2;
|
|
optional string search_query = 3;
|
|
optional int64 limit = 4;
|
|
}
|
|
|
|
message DmReadAck {
|
|
string dm_id = 1;
|
|
}
|
|
|
|
// ─── FRIENDS ────────────────────────────────────────────────────────────────
|
|
|
|
message FriendRequest { string to_user_id = 1; }
|
|
message FriendAccept { string from_user_id = 1; }
|
|
message FriendDecline { string from_user_id = 1; }
|
|
message FriendRemove { string user_id = 1; }
|
|
|
|
message FriendInfo {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
string status = 3;
|
|
int64 since = 4;
|
|
}
|
|
|
|
message FriendList { repeated FriendInfo friends = 1; }
|
|
|
|
message BlockUser { string user_id = 1; }
|
|
message UnblockUser { string user_id = 1; }
|
|
message BlockList { repeated string blocked = 1; }
|
|
|
|
message FriendEvent {
|
|
string event = 1;
|
|
string user_id = 2;
|
|
optional string nickname = 3;
|
|
}
|
|
|
|
// ─── PRESENCE ──────────────────────────────────────────────────────────────
|
|
|
|
message PresenceUpdate {
|
|
string status = 1;
|
|
optional string activity_type = 2;
|
|
optional string activity_text = 3;
|
|
}
|
|
|
|
message PresenceInfo {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
string status = 3;
|
|
optional string activity_type = 4;
|
|
optional string activity_text = 5;
|
|
}
|
|
|
|
message PresenceSync { repeated PresenceInfo presences = 1; }
|
|
|
|
message PresenceEvent {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
string status = 3;
|
|
optional string activity_type = 4;
|
|
optional string activity_text = 5;
|
|
}
|
|
|
|
// ─── READ RECEIPT & TYPING ─────────────────────────────────────────────────
|
|
|
|
message ReadReceipt {
|
|
string channel_id = 1;
|
|
string last_read_message_id = 2;
|
|
string user_id = 3;
|
|
}
|
|
|
|
message TypingStart {
|
|
string channel_id = 1;
|
|
}
|
|
|
|
// ─── AD-HOC RESPONSE / BROADCAST TYPES ──────────────────────────────────────
|
|
|
|
message ReadReceiptBroadcast {
|
|
string channel_id = 1;
|
|
string user_id = 2;
|
|
string last_read_message_id = 3;
|
|
}
|
|
|
|
message UserRoleUpdate {
|
|
string user_id = 1;
|
|
string guild_id = 2;
|
|
string color = 3;
|
|
}
|
|
|
|
message TypingBroadcast {
|
|
string user_id = 1;
|
|
string nickname = 2;
|
|
string channel_id = 3;
|
|
}
|
|
|
|
message SimpleResponse {
|
|
bool ok = 1;
|
|
optional string user_id = 2;
|
|
optional string role_id = 3;
|
|
}
|
|
|
|
// ─── E2EE for Direct Messages ────────────────────────────────────────────────
|
|
|
|
message E2eeDmKeyExchange {
|
|
string dm_id = 1;
|
|
bytes e2ee_public_key = 2;
|
|
}
|
|
|
|
message E2eeDmKeyExchangeAck {
|
|
string dm_id = 1;
|
|
}
|
|
|
|
message E2eeDmMessage {
|
|
string dm_id = 1;
|
|
string sender_id = 2;
|
|
bytes ciphertext = 3;
|
|
int64 timestamp = 4;
|
|
}
|
|
|
|
message E2eeDmHistory {
|
|
string dm_id = 1;
|
|
repeated E2eeDmMessage messages = 2;
|
|
optional int64 limit = 3;
|
|
}
|
|
|
|
// Channel-scoped webhook management: authenticated LNEx only. Secrets returned once.
|
|
message WebhookRequest {
|
|
string id = 1;
|
|
string channel_id = 2;
|
|
string name = 3;
|
|
string direction = 4; // incoming | outgoing
|
|
string provider = 5; // generic | github (incoming only)
|
|
string endpoint = 6; // outgoing HTTPS URL
|
|
string request_id = 7;
|
|
}
|
|
message WebhookInfo {
|
|
string id = 1;
|
|
string channel_id = 2;
|
|
string name = 3;
|
|
string direction = 4;
|
|
string provider = 5;
|
|
string endpoint = 6;
|
|
int64 created_at = 7;
|
|
bool revoked = 8;
|
|
string suspended_reason = 9;
|
|
}
|
|
message WebhookResult { WebhookInfo hook = 1; string secret = 2; string request_id = 3; }
|
|
message WebhookListResult { repeated WebhookInfo hooks = 1; string request_id = 2; }
|
|
message WebhookErrorResult { string request_id = 1; uint32 code = 2; string message = 3; }
|
|
|
|
// Authenticated signalling only; media uses DTLS/SRTP peer connections.
|
|
message MediaControl {
|
|
uint32 action = 1; // START1 STOP2 WATCH3 UNWATCH4 OFFER5 ANSWER6 ICE7
|
|
string channel_id = 2;
|
|
string share_id = 3;
|
|
string target_session_id = 4;
|
|
string body = 5;
|
|
uint32 mline_index = 6;
|
|
bool application_audio = 7;
|
|
bool microphone = 8;
|
|
}
|
|
message MediaEvent {
|
|
uint32 action = 1;
|
|
string channel_id = 2;
|
|
string share_id = 3;
|
|
string target_session_id = 4;
|
|
string body = 5;
|
|
uint32 mline_index = 6;
|
|
bool application_audio = 7;
|
|
bool microphone = 8;
|
|
string sender_session_id = 9;
|
|
string publisher_user_id = 10;
|
|
}
|
|
|
|
// Fresh credentials delivered only over the authenticated encrypted control session.
|
|
message VoiceSession {
|
|
bytes route_id = 1;
|
|
bytes c2s_key = 2;
|
|
bytes s2c_key = 3;
|
|
string channel_id = 4;
|
|
}
|
|
message VoiceFrame {
|
|
uint32 voice_seq = 1;
|
|
uint32 timestamp = 2;
|
|
string channel_id = 3;
|
|
string sender_session_id = 4;
|
|
bytes opus = 5;
|
|
string sender_user_id = 6;
|
|
}
|