From 2c2dd54028e469b06df35cc2957afef117f89213 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Wed, 19 Jul 2023 12:34:26 +0200 Subject: [PATCH] updated sdk documentation with surb example --- documentation/docs/src/sdk/rust.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/documentation/docs/src/sdk/rust.md b/documentation/docs/src/sdk/rust.md index 9e60d40efd..68004b7576 100644 --- a/documentation/docs/src/sdk/rust.md +++ b/documentation/docs/src/sdk/rust.md @@ -56,14 +56,19 @@ If you're integrating mixnet functionality into an existing app and want to inte ### Anonymous replies with SURBs Both functions used to send messages through the mixnet (`send_str` and `send_bytes`) send a pre-determined number of SURBs along with their messages by default. -The number of SURBs is set [here](https://github.com/nymtech/nym/blob/release/{{platform_release_version}}/sdk/rust/nym-sdk/src/mixnet/client.rs#L35): +The number of SURBs is set [here](https://github.com/nymtech/nym/blob/release/{{platform_release_version}}/sdk/rust/nym-sdk/src/mixnet/client.rs#L34): ```rust,noplayground -{{#include ../../../../sdk/rust/nym-sdk/src/mixnet/client.rs:30}} +{{#include ../../../../sdk/rust/nym-sdk/src/mixnet/client.rs:34}} ``` You can read more about how SURBs function under the hood [here](../architecture/traffic-flow.md#private-replies-using-surbs). +In order to reply to an incoming message using SURBs, you can construct a `recipient` from the `sender_tag` sent along with the message you wish to reply to: + +```rust,noplayground +{{#include ../../../../sdk/rust/nym-sdk/examples/surb-reply.rs}} +``` ### Importing and using a custom network topology If you want to send traffic through a sub-set of nodes (for instance, ones you control, or a small test setup) when developing, debugging, or peforming research, you will need to import these nodes as a custom network topology, instead of grabbing it from the [`Mainnet Nym-API`](https://validator.nymtech.net/api/swagger/index.html) (`examples/custom_topology_provider.rs`).