Handshake

data class Handshake(val role: Role, val symmetry: Symmetry, val messagePatterns: List<List<Handshake.Token>>, val localStaticKeyPair: Pair<PublicKey, PrivateKey>? = null, val localEphemeralKeyPair: Pair<PublicKey, PrivateKey>? = null, val remoteStaticKey: PublicKey? = null, val remoteEphemeralKey: PublicKey? = null, val trustedStaticKeys: Set<PublicKey> = emptySet()) : MessageType(source)

Encompasses all Noise protocol handshake state required to read and write messages.

Start with initialize, supplying one of the implemented patterns:

Proposals to add more patterns or generate correct patterns dynamically are welcomed.

Constructors

Link copied to clipboard
constructor(role: Role, symmetry: Symmetry, messagePatterns: List<List<Handshake.Token>>, localStaticKeyPair: Pair<PublicKey, PrivateKey>? = null, localEphemeralKeyPair: Pair<PublicKey, PrivateKey>? = null, remoteStaticKey: PublicKey? = null, remoteEphemeralKey: PublicKey? = null, trustedStaticKeys: Set<PublicKey> = emptySet())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Pattern(val name: String, val preSharedMessagePatterns: List<List<Handshake.Token>>, val messagePatterns: List<List<Handshake.Token>>)

A handshake pattern.

Link copied to clipboard

Message pattern token, indicating which keys are sent and which key agreements are performed.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val role: Role
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns a handshake message payload only if this is appropriate given the pattern and state.

Link copied to clipboard
fun writeMessage(payload: Payload): State<out MessageType, Data>?

Returns a handshake message only if this is appropriate given the pattern and state.