From 0be3f3159e2440d5638b5efa8df454ba507a007d Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Wed, 9 Oct 2024 16:35:23 +0200 Subject: [PATCH] tweaks --- .../docs/pages/developers/rust/mixnet.mdx | 8 +------ .../developers/rust/mixnet/message-types.md | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/documentation/docs/pages/developers/rust/mixnet.mdx b/documentation/docs/pages/developers/rust/mixnet.mdx index 396bd3563d..a6e6621413 100644 --- a/documentation/docs/pages/developers/rust/mixnet.mdx +++ b/documentation/docs/pages/developers/rust/mixnet.mdx @@ -1,11 +1,5 @@ -import { Callout } from 'nextra/components' - # Mixnet Module This module exposes the logic of creating and interacting with clients and Mixnet messages. This is recommended for those wanting to either start playing around with the Mixnet and how it works, or build connection logic. - - -For developers wanting something more 'plug and play' we recommend the [`TcpProxy` module](./tcpproxy). - - +> For developers wanting something more 'plug and play' we recommend the [`TcpProxy` module](./tcpproxy). diff --git a/documentation/docs/pages/developers/rust/mixnet/message-types.md b/documentation/docs/pages/developers/rust/mixnet/message-types.md index 0e4e046829..0e48190f3e 100644 --- a/documentation/docs/pages/developers/rust/mixnet/message-types.md +++ b/documentation/docs/pages/developers/rust/mixnet/message-types.md @@ -1,4 +1,20 @@ # Message Types -There are two methods for sending messages through the mixnet using your client: -* `send_plain_message()` is the most simple: pass the recipient address and the message you wish to send as a string (this was previously `send_str()`). This is a nicer-to-use wrapper around `send_message()` which -* `send_message()` allows you to also define the amount of SURBs to send along with your message (which is sent as bytes). + +There are several functions used to send outgoing messages through the Mixnet, each with a different level of customisation: + +- `send(&self, message: InputMessage) -> Result<()>` +Sends a `InputMessage` to the mixnet. This is the most low-level sending function, for full customization. Called by `send_message()`. + +- `send_message(&self, address: Recipient, message: M, surbs: IncludedSurbs) -> Result<()>` +Sends bytes to the supplied Nym address. There is the option to specify the number of reply-SURBs to include. Called by `send_plain_message()`. + +- `send_plain_message(&self, address: Recipient, message: M) -> Result<()>` +Sends data to the supplied Nym address with the default surb behaviour. + +> Note we specify *outgoing* messages above: this is because the SDK assumes that replies will be anonymous via [SURBs]() TODO LINK. + +Replies rely on the creation of an `AnonymousSenderTag` by parsing and storing the `sender_tag` from incoming messages, and using this to reply, instead of the `Receipient` type used by the functions outlined above: + +`send_reply(&self, recipient_tag: AnonymousSenderTag, message: M) -> Result<()>` will send the reply message to the supplied anonymous recipient. + +> You can find all of the function definitions [here](https://github.com/nymtech/nym/blob/master/sdk/rust/nym-sdk/src/mixnet/traits.rs).