From 30fcaf326f8d3fef99e2844007b60e5473a8c24b Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Tue, 26 Sep 2023 11:23:06 +0300 Subject: [PATCH] fix: revert federation filed from proto message to ensure back-compatibility (#160) --- proto/types.proto | 4 +++- src/types/mod.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/proto/types.proto b/proto/types.proto index 33ad60c..8e9cedb 100644 --- a/proto/types.proto +++ b/proto/types.proto @@ -35,7 +35,6 @@ message Ping {} message Pong {} message Envelope { - reserved 11; // uid is auto generated by rmb. string uid = 1; // client specific tags @@ -62,6 +61,9 @@ message Envelope { // schema of the payload of either the request or the resposne message. optional string schema = 10; + // a federation url (domain) + // this filed ignored by relays but left for back compatibilty with old peers + optional string federation = 11; // pyload of the message is interpreted differently based // on the message filed diff --git a/src/types/mod.rs b/src/types/mod.rs index 30f646e..ab26689 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -325,6 +325,10 @@ impl Challengeable for Envelope { write!(hash, "{}", schema)?; } + if let Some(ref federation) = self.federation { + write!(hash, "{}", federation)?; + } + match self.payload { None => {} Some(types::envelope::Payload::Plain(ref data)) => {