refactor: structured body (array|object, never string) for canonicalization
Message bodies are always arrays of strings (text lines) or objects (structured data like PUBKEY). Never raw strings. This enables: - Multiline messages without escape sequences - Deterministic JSON canonicalization (RFC 8785 JCS) for signing - Structured data where needed Update all schemas: body fields use array type with string items. Update message.json envelope: body is oneOf[array, object], id is UUID. Update README: message envelope table, examples, and canonicalization docs. Update schema/README.md: field types, examples with array bodies.
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "Server-assigned message ID, monotonically increasing. Present on all server-originated messages."
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "Server-assigned message UUID. Present on all server-originated messages."
|
||||
},
|
||||
"command": {
|
||||
"type": "string",
|
||||
@@ -28,8 +29,19 @@
|
||||
"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)."
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Array of strings (one per line for text messages)."
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"description": "Structured data (e.g. PUBKEY key material).",
|
||||
"additionalProperties": true
|
||||
}
|
||||
],
|
||||
"description": "Message body. MUST be an array or object, never a raw string. Arrays represent lines of text; objects carry structured data. This enables deterministic canonicalization (RFC 8785 JCS) for signing."
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
@@ -38,7 +50,21 @@
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"description": "Extensible metadata (signatures, rich content hints, etc.). Not present in original IRC.",
|
||||
"description": "Extensible metadata. Used for signatures (meta.sig, meta.alg), hashes (meta.hash), and client extensions.",
|
||||
"properties": {
|
||||
"sig": {
|
||||
"type": "string",
|
||||
"description": "Base64-encoded cryptographic signature over the canonical message form."
|
||||
},
|
||||
"alg": {
|
||||
"type": "string",
|
||||
"description": "Signature algorithm (e.g. 'ed25519')."
|
||||
},
|
||||
"hash": {
|
||||
"type": "string",
|
||||
"description": "Hash of the canonical message form (e.g. 'sha256:base64...')."
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user