scuttlebutt-handshake / org.apache.tuweni.scuttlebutt.handshake / SecureScuttlebuttHandshakeServer

SecureScuttlebuttHandshakeServer

class SecureScuttlebuttHandshakeServer (source)

Class responsible for performing a Secure Scuttlebutt handshake with a remote peer, as defined in the Secure Scuttlebutt protocol guide

Please note that only handshakes over the Ed25519 curve are supported.

This class manages the state of one handshake. It should not be reused across handshakes. If the handshake fails, a HandshakeException will be thrown.

Functions

create

static fun create(ourKeyPair: KeyPair, networkIdentifier: Bytes32): SecureScuttlebuttHandshakeServer

Creates a new handshake server able to reply to the request of one client

createAcceptMessage

fun createAcceptMessage(): Bytes

Produces a message to accept the handshake with the client

createHello

fun createHello(): Bytes

Creates a hello message to be sent to the other party, comprised of our ephemeral public key and an authenticator against our network identifier.

createStream

fun createStream(): SecureScuttlebuttStreamServer

Creates a stream to allow communication with the other peer after the handshake has completed

readHello

fun readHello(message: Bytes): Unit

Validates the initial message's MAC with our network identifier, and returns the peer ephemeral public key.

readIdentityMessage

fun readIdentityMessage(message: Bytes): Unit

Reads the message containing the identity of the client, verifying it matches our shared secrets.