feat: add IRC-style message protocol JSON schemas (draft 2020-12)
Add JSON Schema definitions for all message types: - Base message envelope (message.schema.json) - C2S: PRIVMSG, NOTICE, JOIN, PART, QUIT, NICK, MODE, TOPIC, KICK, PING, PUBKEY - S2C: named commands + numeric reply codes (001, 002, 322, 353, 366, 372, 375, 376, 401, 403, 433) - S2S: RELAY, LINK, UNLINK, SYNC, PING, PONG - Schema index (schema/README.md) All messages use IRC command names and numeric codes from RFC 1459/2812. Bodies are always objects or arrays (never raw strings) to support deterministic canonicalization (RFC 8785 JCS) and message signing.
This commit is contained in:
46
schema/message.json
Normal file
46
schema/message.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/message.json",
|
||||
"title": "IRC Message Envelope",
|
||||
"description": "Base envelope for all messages. Mirrors IRC wire format (RFC 1459/2812) encoded as JSON over HTTP. The 'command' field carries either an IRC command name (PRIVMSG, JOIN, etc.) or a three-digit numeric reply code (001, 353, 433, etc.).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "Server-assigned message ID, monotonically increasing. Present on all server-originated messages."
|
||||
},
|
||||
"command": {
|
||||
"type": "string",
|
||||
"description": "IRC command name (PRIVMSG, JOIN, NICK, etc.) or three-digit numeric reply code (001, 353, 433, etc.).",
|
||||
"examples": ["PRIVMSG", "JOIN", "001", "353", "433"]
|
||||
},
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "Source — nick for user messages, server name for server messages. Equivalent to IRC prefix."
|
||||
},
|
||||
"to": {
|
||||
"type": "string",
|
||||
"description": "Target — channel (#name) or nick. Equivalent to first IRC parameter for most commands."
|
||||
},
|
||||
"params": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Additional parameters (used primarily by numeric replies). Equivalent to IRC middle parameters."
|
||||
},
|
||||
"body": {
|
||||
"type": "string",
|
||||
"description": "Message body / trailing parameter. Equivalent to IRC trailing parameter (after the colon)."
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "Server-assigned timestamp (ISO 8601). Not present in original IRC; added for HTTP transport."
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"description": "Extensible metadata (signatures, rich content hints, etc.). Not present in original IRC.",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"required": ["command"]
|
||||
}
|
||||
Reference in New Issue
Block a user