#handshake #scuttlebutt #ssb

nightly shs_async

Secret-handshake protocol (async)

3 releases (breaking)

0.3.0 May 3, 2019
0.2.0 Apr 4, 2019
0.1.0 Mar 6, 2019

#16 in #scuttlebutt

AGPL-3.0

16KB
232 lines

shs_async

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));

Dependencies

~19MB
~101K SLoC