Crates.io | shs_async |
lib.rs | shs_async |
version | 0.3.0 |
source | src |
created_at | 2019-03-06 04:02:12.952182 |
updated_at | 2019-05-03 03:12:02.57796 |
description | Secret-handshake protocol (async) |
homepage | |
repository | https://github.com/sunrise-choir/shs_async |
max_upload_size | |
id | 119049 |
size | 49,057 |
Async secret-handshake protocol (for Secure Scuttlebutt (SSB)).
#![feature(async_await, await_macro, futures_api)]
use shs_async::*;
let stream = some_asyncread_asyncwrite_stream();
let net_id = NetworkId::SSB_MAIN_NET;
let (pk, sk) = server::generate_longterm_keypair();
let outcome = await!(server(stream, net_id, pk, sk));
// `outcome` is:
// pub struct HandshakeOutcome {
// pub c2s_key: ClientToServerKey,
// pub s2c_key: ServerToClientKey,
// pub c2s_noncegen: ClientToServerNonceGen,
// pub s2c_noncegen: ServerToClientNonceGen,
// }
let outcome = await!(client(stream, net_id, pk, sk, server_pk));