https://github.com/nazmulidris/hello_ockam
https://github.com/nazmulidris/hello_ockam
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nazmulidris/hello_ockam
- Owner: nazmulidris
- Created: 2023-07-15T19:58:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T04:23:57.000Z (about 2 years ago)
- Last Synced: 2024-10-14T10:16:46.565Z (12 months ago)
- Language: Rust
- Size: 2.32 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hello_ockam
Table of contents
- [Differences between this repo & docs.ockam.io/Reference/Programming Libraries/Rust](#differences-between-this-repo--docsockamioreferenceprogramming-librariesrust)
- [Following Rust API guides below](#following-rust-api-guides-below)
- [Run the examples](#run-the-examples)## Differences between this repo & [docs.ockam.io/Reference/Programming Libraries/Rust](https://docs.ockam.io/reference/libraries/rust)
This repo is just an experiment to see if I can improve on the examples using colored
output, more helpful stdout messages, and more concise code.1. All the code examples have colorized output so that it is clear to see which node is outputting
what to `stdout`. Lots of helpful text has been added to inform the developer about
what the program is doing.
- Here's an example of secure channels example:

- Here's another example of routing over multiple hops:

2. Instead of having multiple source files for certain examples (eg:
[secure channels](https://github.com/nazmulidris/hello_ockam/blob/main/examples/05-secure-channel-over-two-transport-hops-responder.rs)),
all the examples are self contained in a single source file using `tokio::spawn` to run multiple
nodes concurrently, and shut down the entire example cleanly.
3. The exception to using `tokio:spawn` is the credential exchange example which has 3
source files (didn't work w/ `tokio:spawn` for some reason).

Here's the command to run this:
```sh
gnome-terminal -x sh -c "cargo run --example 06-credential-exchange-issuer"
gnome-terminal -x sh -c "cargo run --example 06-credential-exchange-server"
cargo run --example 06-credential-exchange-client
```
4. All short variable names are replaced w/ longer more readable ones.## Following Rust API guides below
1. [Rust API](https://docs.ockam.io/reference/libraries/rust)
2. [Nodes and Workers](https://docs.ockam.io/reference/libraries/rust/routing)
3. [Routing and transports](https://docs.ockam.io/reference/libraries/rust/routing)
4. [Identities and Vaults](https://docs.ockam.io/reference/libraries/rust/vaults-and-identities)
5. [Secure Channels](https://docs.ockam.io/reference/libraries/rust/secure-channels)
6. [Credentials and Authorities](https://docs.ockam.io/reference/libraries/rust/credentials)## Run the examples
```sh
OCKAM_LOG=none cargo run --example 01-node
``````sh
OCKAM_LOG=none cargo run --example 02-worker
``````sh
OCKAM_LOG=none cargo run --example 03-routing
``````sh
OCKAM_LOG=none cargo run --example 03-routing-many-hops
``````sh
OCKAM_LOG=none cargo run --example 04-routing-over-transport
``````sh
OCKAM_LOG=none cargo run --example 04-routing-over-two-transport-hops
``````sh
OCKAM_LOG=none cargo run --example 05-identity
``````sh
OCKAM_LOG=none cargo run --example 05-secure-channel-over-two-transport-hops-responder
``````sh
gnome-terminal -x sh -c "OCKAM_LOG=none cargo run --example 06-credential-exchange-issuer"
gnome-terminal -x sh -c "OCKAM_LOG=none cargo run --example 06-credential-exchange-server"
OCKAM_LOG=none cargo run --example 06-credential-exchange-client
```# Diagrams in
1. 01-node.rs: https://asciiflow.com/#/share/eJyrVspLzE1VssorzcnRUcpJrEwtUrJSqo5RqohRsrK0NNSJUaoEsozMLYGsktSKEiAnRunRlD1UQTExeUBSQcEvPyVVwVABBcClqWoTNoAkTZ7h6EYoOKakFKUWF1shLMBQop5YUKCO4gZMhzSQiFCNwOtV6gSqUq1SLQAC/z9O
2. 02-worker.rs: https://asciiflow.com/#/share/eJyrVspLzE1VssorzcnRUcpJrEwtUrJSqo5RqohRsrK0NNSJUaoEsozMLYGsktSKEiAnRunRlJ5HUxooRhNiYvIeTWlSUPDLT0lVMFRAAUAJsPQcati0BGYTNgCzqQnEJMNjE9CMaFJwTEkpSi0utkJYgKFEPbGgQB3FDWhKpoDNXkOUE6ZtAjNmoBgBNRTNDmzenbaHOI9uocC7qckZ+alF6gS8SxJC9y7umCXDcCzWxSjVKtUCAO/Vn64=)
3. 03-routing.rs: https://asciiflow.com/#/share/eJyrVspLzE1VslIyMFbSUcpJrEwtAnKqY5QqYpSsLC0NdWKUKoEsIwsDIKsktaIEyIlRejRlD1VQTEwekFRQ8MtPSVUwVEABj6Y0QaSpahM2gCT9aErPoykNJKIJaEY0KTimpBSlFhdbIbyCoUQ9saBAHcW3aEqmgM3eQ5QTpu0CM2agGAHmoPkTu3enEWfLlC0UeDcjv6AgtchQnSre3UQX7+6hwLupyRn5qUXqOJVMIT2ZoXsXb0LGK02dHKVUq1QLACw0OTI
4. 03-routing-many-hops.rs: https://asciiflow.com/#/share/eJyrVspLzE1VslIyMNY1UtJRykmsTC0CcqtjlCpilKwsLQ11YpQqgSwjCwMgqyS1ogTIiVF6NGUPtVBMTB6QVFDwy09JVTBUQAVweWrbhhUgyT%2Ba0vNoSgOJaAK6GU0KjikpRanFxVZwG5ow1agnFhSoI7sCQ80UsPF7iHLFtF1gxgxUM8AcNL%2Fi8PM04uyZsoUiP2fkFxSkFhnq6RmrQ9RUGFPg50108vMeivycmpyRn1qkjlvNFNLTHIaf8adr%2FPJUy2VKtUq1AL84Qzs%3D)
5. 04-routing-over-transport.rs: https://asciiflow.com/#/share/eJytVD1ugzAUvor1FpYMqI0UwVb1Ah06WqoQWC1SaiPjIVEUqUIZO2SwaIaOPUHVqeI0nKQG4iYmTksAywhb7%2Bd73%2FserIAGzwR8cKcwgXmwJFxdVhgWGHzPu55gWKrT1cxTJ0EWQl0wlPK1lC%2BD9xZjWsqMsog8xDQWcSAYR%2FulDLX5fQykjwYJWZdGytAAXlsjTXYTRZykqW%2Bg1M8QEEvzqpxOkCROm5IGa9qrikkYjchJeys%2FWScs6t0BOv%2FU550GGVskVUqbjn5dJGPejZH8MmTU%2FSt6b3MY7m%2FvkOABVRJwsa%2FVFpd%2FWz3NZCGjlIQCCYamrutWLm8ba755nApCY%2FqIGG1828lkX6l2A9pUjc9pm85JeiR%2BaySKY9F7MzFZHRhdND6%2FbpqRnc7hyyxs%2F4fOwQ4JnxjhTq%2FgoTP9N8A5wz%2BB48iHYQ3rHwrvgOs%3D)