tuweni / org.apache.tuweni.scuttlebutt.handshake / SecureScuttlebuttHandshakeClient

SecureScuttlebuttHandshakeClient

class SecureScuttlebuttHandshakeClient (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

Creates a new handshake client to connect to a specific remote peer.

static fun create(ourKeyPair: KeyPair!, networkIdentifier: Bytes32!, serverLongTermPublicKey: PublicKey!): SecureScuttlebuttHandshakeClient!

createHello

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

fun createHello(): Bytes!

createIdentityMessage

Creates a message containing the identity of the client

fun createIdentityMessage(): Bytes!

createStream

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

fun createStream(): SecureScuttlebuttStreamClient!

fromInvite

Create a new handshake client to connect to the server specified in the invite

static fun fromInvite(networkIdentifier: Bytes32!, invite: Invite!): SecureScuttlebuttHandshakeClient!

readAcceptMessage

Reads the handshake acceptance message from the server

fun readAcceptMessage(message: Bytes!): Unit

readHello

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

fun readHello(message: Bytes!): Unit