Skip to content

Class BSV::Auth::PeerSession

Inherits: Object

Represents the state of an authentication session with a peer.

Sessions are indexed by session_nonce (our nonce for the session), which is the primary key in {SessionManager}. The peer_identity_key is a secondary index used to look up sessions by peer.

@example Creating a session

session = PeerSession.new(session_nonce: nonce)
session.peer_identity_key = 'abc123...'
session.peer_nonce = 'xyz...'

Attributes

certificates_required [RW]

  • @return [Boolean] whether certificates are required from this peer

certificates_validated [RW]

  • @return [Boolean] whether required certificates have been validated

is_authenticated [RW]

  • @return [Boolean] whether mutual authentication is complete

last_update [RW]

  • @return [Integer] Unix timestamp (milliseconds) of last update

peer_identity_key [RW]

  • @return [String, nil] the peer's identity key (public key hex)

peer_nonce [RW]

  • @return [String, nil] the nonce we received from the peer (base64)

session_nonce [R]

  • @return [String] our nonce for this session (base64) — primary key

Public Instance Methods

authenticated?()

  • @return [Boolean]

initialize(session_nonce:)

  • @param session_nonce [String] our nonce for this session (base64)
  • @return [PeerSession] a new instance of PeerSession