syntax = "proto3"; /* There are four types of messages that palm can send. 1. Unencrypted reflection. This is unencrypted communication between a relay and a client. 2. Encrypted reflection. This is encrypted communication between a relay and a client. 3. Unencrypted tunnel. This is unencrypted communication between a client and a client, through a relay. Note that it is encrypted both ways via encrypted reflection. 4. Encrypted tunnel. This is doubly-encrypted communcation between a client and a client, through a relay. The following convention is used: C2R Client to Relay - Reflection R2C Relay to Client - Reflection I2R Initiating Client to Receiving Client - Tunneled R2I Receiving Client to Initiating Client - Tunneled */ /////// UNENCRYPTED REFLECTION /////// // Sent by client at start of connection message PalmC2RHandshakeStart { bytes ClientPublicKey = 1; // 32-byte X25519 public key bytes SessionIV = 2; // 12-byte randomized IV generated by the client bytes Check = 3; // 32-byte randomized value used to check encryption } // Sent by relay in response to PalmC2RHandshakeStart message PalmR2CHandshakeFinish { bytes ServerPublicKey = 1; // 32-byte X25519 public key bytes Check = 2; // The same 32-byte value provided in PalmC2SHandshakeStart, used to tie this response to the original session } /////// ENCRYPTED REFLECTED MESSAGES /////// // Sent by client after receiving PalmR2CHandshakeFinish. // Used by the client to request a room on the server. message PalmC2RRelayRequest { bytes Check = 1; // The same 32-byte value used in initial reflected handshake, ties this to the session. string ChannelID = 2; // The string channel ID this client is requested to be routed to. } // Represents the states a room/channel can be in. enum PalmRoomStatus { NotReady = 0; // Waiting for a peer to join Ready = 1; // A peer has joined, and the relay is ready to relay the connection InUse = 2; // This channel is already in use and cannot be used currently } // Send at *any time* by the server to indicate the current status of the server. // Must also be sent in response to PalmC2RRelayRequest to indicate the current status of the room. // If the other peer is disconnected, PalmR2CChannelStatus will be sent again with Status = NotReady; // The client must handle this correctly. message PalmR2CChannelStatus { bytes Check = 1; // The same 32-byte value used in previous packets, ties this packet to the session. string ChannelID = 2; // The channel that the client requested. PalmRoomStatus Status = 3; // The current status of the room. }