summaryrefslogtreecommitdiffstats
path: root/src/transport/mycelium.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/mycelium.rs')
-rw-r--r--src/transport/mycelium.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs
index a5a9458..5df6139 100644
--- a/src/transport/mycelium.rs
+++ b/src/transport/mycelium.rs
@@ -796,6 +796,8 @@ fn bytes_to_keepalive(bytes: &[u8]) -> Result<Keepalive, TransportError> {
pub struct HelloRequestShadow {
#[serde(default)]
epoch: EpochShadow,
+ #[serde(default)]
+ auth: ByteBuf,
}
#[derive(Serialize, Deserialize)]
@@ -806,6 +808,8 @@ pub struct HelloReplyShadow<'a> {
pub peers: Vec<String>,
#[serde(default)]
epoch: EpochShadow,
+ #[serde(default)]
+ auth: ByteBuf,
}
#[derive(Serialize, Deserialize)]
@@ -850,12 +854,14 @@ mod automerge_msg_codec {
pub fn hello_request_to_bytes(msg: &HelloRequest) -> Result<Vec<u8>, rmp_serde::encode::Error> {
rmp_serde::to_vec(&HelloRequestShadow {
epoch: epoch_to_shadow(&msg.epoch),
+ auth: ByteBuf::from(msg.auth.clone()),
})
}
pub fn bytes_to_hello_request(bytes: &[u8]) -> Result<HelloRequest, TransportError> {
let shadow: HelloRequestShadow = rmp_serde::from_slice(bytes)?;
Ok(HelloRequest {
epoch: epoch_from_shadow(shadow.epoch)?,
+ auth: shadow.auth.into_vec(),
})
}
@@ -865,6 +871,7 @@ pub fn hello_reply_to_bytes(msg: &HelloReply) -> Result<Vec<u8>, rmp_serde::enco
swarm_id: Cow::Borrowed(&msg.swarm_id),
peers: msg.peers.clone(), // Vec must be cloned for serialization wrapper matching
epoch: epoch_to_shadow(&msg.epoch),
+ auth: ByteBuf::from(msg.auth.clone()),
};
rmp_serde::to_vec(&shadow)
}
@@ -874,6 +881,7 @@ pub fn bytes_to_hello_reply(bytes: &[u8]) -> Result<HelloReply, TransportError>
swarm_id: shadow.swarm_id.into_owned(),
peers: shadow.peers,
epoch: epoch_from_shadow(shadow.epoch)?,
+ auth: shadow.auth.into_vec(),
})
}