Crate rtj[−][src]
Expand description
rtj aims to provide a generic, robust, and secure framework for users to develop
their own job execution applications. Encryption uses crypto_box
and is compatible with
other implementations of the standard.
Example:
// Full example avaialble in the source repo under /examples/hello.rs
use rtj::{Job, Message};
// Create a struct that implements Job
let hello = Hello { name, age };
// Build a Message from that struct
let msg = Message::new()
.set_payload(&hello)
.set_header(MsgType::Hello, send_pub, &mut rng)?;
// Encrypt the message payload for the recipient.
let encrypted_to_recv = msg.encrypt(recv_secret.public_key(), send_secret)?;
// Decrypt the message payload as the recipient.
let hello_again = encrypted_to_recv.decrypt(recv_secret)?;
// Verify the message type.
if let MsgType::Hello = hello_again.header.msgtype.into() {
// Deserialize the message payload as the correct type
let hello = Hello::decode(&hello_again.payload);
// Execute the runner method on the deserialized type
hello.run()?;
}
Structs
Enums
Custom errors for RTJ crate