[][src]Module discv5::session

A Session handles the stages of creating and establishing a handshake with a peer.

There are two ways a Session can get initialised.

  • An RPC request to an unknown peer is requested by the application. In this scenario, a RANDOM packet is sent to the unknown peer. This session is created using the new_random() function.
  • A message was received from an unknown peer and we start the Session by sending a WHOAREYOU message.

This module is responsible for generating, deriving and holding keys for sessions for known peers.

Modules

crypto

Implementation for generating session keys in the Discv5 protocol. Currently, Diffie-Hellman key agreement is performed with known public key types. Session keys are then derived using the HKDF (SHA2-256) key derivation function.

ecdh_ident

This implements an identity hash used for the ECDH library.

Structs

Keys
Session

Manages active handshakes and connections between nodes in discv5. There are three main states a session can be in, initializing (WhoAreYouSent or RandomSent), Untrusted (when the socket address of the ENR doesn't match the last_seen_socket) and Established (the session has been successfully established).

Enums

SessionState

The current state of the session. This enum holds the encryption keys for various states.

TrustedState

A State

Constants

WHOAREYOU_STRING