From 6ab0acd8bc04b54ae3ad534ce84c6f38090bbdc9 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 11 Jun 2024 06:00:12 -0700 Subject: [PATCH 1/3] feat: relay attachments --- docs/specs/servers/relay/relay-server-rpc.md | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/specs/servers/relay/relay-server-rpc.md b/docs/specs/servers/relay/relay-server-rpc.md index c2f3d7e4..524349db 100644 --- a/docs/specs/servers/relay/relay-server-rpc.md +++ b/docs/specs/servers/relay/relay-server-rpc.md @@ -10,6 +10,7 @@ The following definitions are shared concepts across all JSON-RPC methods for th - **topic** - (hex string - 32 bytes) a target topic for the message to be subscribed by the receiver. - **message** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. +- **attachments** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. Not included in Verify API attestation. - **ttl** - (uint32 - 4 bytes) a storage duration for the message to be cached server-side in **seconds** (aka time-to-live). - **tag** - (uint32 - 4 bytes) a label that identifies what type of message is sent based on the RPC method used. - **id** - 19 digit unique identifier. We suggest a 13 digit epoch timestamp plus 6 digit entropy @@ -20,17 +21,18 @@ The following definitions are shared concepts across all JSON-RPC methods for th Used when a client publishes a message to a server. -```jsonc +```typescript // Request (client->server) { - "id" : "1", - "jsonrpc": "2.0", - "method": "irn_publish", - "params" : { - "topic" : string, - "message" : string, - "ttl" : seconds, - "tag" : number, + id: string, + jsonrpc": "2.0", + method: "irn_publish", + params: { + topic: string, + message: string, + attachments?: string | null, + ttl: seconds, + tag: number, } } @@ -46,13 +48,14 @@ Used when a client publishes a message to a server. Used when a client publishes multiple messages to a server. -```jsonc +```typescript // PublishedMessage { - "topic" : string, - "message" : string, - "ttl" : seconds, - "tag" : number, + topic: string, + message: string, + attachments?: string | null, + ttl: seconds, + tag: number, } // Request (client->server) @@ -188,6 +191,7 @@ Used when a server sends a subscription message to a client. "data" : { "topic": string, "message": string, + "attachments": string | null, "publishedAt": number, "tag": number } @@ -372,6 +376,7 @@ Body: "status": string, // either "accepted", "queued" or "delivered" "topic": string, "message": string, + "attachments": string | null, "publishedAt": number, "tag": number } From 9ce348e888ef41ef01c6365d7ab9db477014e18c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 11 Jun 2024 06:03:27 -0700 Subject: [PATCH 2/3] Note on backwards-compatibility --- docs/specs/servers/relay/relay-server-rpc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/specs/servers/relay/relay-server-rpc.md b/docs/specs/servers/relay/relay-server-rpc.md index 524349db..10bd9c5f 100644 --- a/docs/specs/servers/relay/relay-server-rpc.md +++ b/docs/specs/servers/relay/relay-server-rpc.md @@ -10,7 +10,7 @@ The following definitions are shared concepts across all JSON-RPC methods for th - **topic** - (hex string - 32 bytes) a target topic for the message to be subscribed by the receiver. - **message** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. -- **attachments** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. Not included in Verify API attestation. +- **attachments** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. Not included in Verify API attestation. This SHOULD be a JSON object to make adding more values easy and backwards-compatible, but its value is defined at the API level. - **ttl** - (uint32 - 4 bytes) a storage duration for the message to be cached server-side in **seconds** (aka time-to-live). - **tag** - (uint32 - 4 bytes) a label that identifies what type of message is sent based on the RPC method used. - **id** - 19 digit unique identifier. We suggest a 13 digit epoch timestamp plus 6 digit entropy From 78d436b7e9524ea35b5b1dcad5e84a0570ae944d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Jul 2024 15:38:35 -0700 Subject: [PATCH 3/3] chore: attachments -> attestation --- docs/specs/servers/relay/relay-server-rpc.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/specs/servers/relay/relay-server-rpc.md b/docs/specs/servers/relay/relay-server-rpc.md index 10bd9c5f..98fa3801 100644 --- a/docs/specs/servers/relay/relay-server-rpc.md +++ b/docs/specs/servers/relay/relay-server-rpc.md @@ -10,7 +10,7 @@ The following definitions are shared concepts across all JSON-RPC methods for th - **topic** - (hex string - 32 bytes) a target topic for the message to be subscribed by the receiver. - **message** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. -- **attachments** - (utf8 string - variable) a plaintext message to be relayed to any subscribers on the topic. Not included in Verify API attestation. This SHOULD be a JSON object to make adding more values easy and backwards-compatible, but its value is defined at the API level. +- **attestation** - (utf8 string - variable) the Verify attestation JWT to be included along with the message. Not included in Verify API attestation. - **ttl** - (uint32 - 4 bytes) a storage duration for the message to be cached server-side in **seconds** (aka time-to-live). - **tag** - (uint32 - 4 bytes) a label that identifies what type of message is sent based on the RPC method used. - **id** - 19 digit unique identifier. We suggest a 13 digit epoch timestamp plus 6 digit entropy @@ -25,12 +25,12 @@ Used when a client publishes a message to a server. // Request (client->server) { id: string, - jsonrpc": "2.0", + jsonrpc: "2.0", method: "irn_publish", params: { topic: string, message: string, - attachments?: string | null, + attestation?: string | null, ttl: seconds, tag: number, } @@ -53,7 +53,7 @@ Used when a client publishes multiple messages to a server. { topic: string, message: string, - attachments?: string | null, + attestation?: string | null, ttl: seconds, tag: number, } @@ -191,7 +191,7 @@ Used when a server sends a subscription message to a client. "data" : { "topic": string, "message": string, - "attachments": string | null, + "attestation": string | null, "publishedAt": number, "tag": number } @@ -376,7 +376,7 @@ Body: "status": string, // either "accepted", "queued" or "delivered" "topic": string, "message": string, - "attachments": string | null, + "attestation": string | null, "publishedAt": number, "tag": number }