Class: BSV::Auth::PeerSession
- Inherits:
-
Object
- Object
- BSV::Auth::PeerSession
- Defined in:
- lib/bsv/auth/peer_session.rb
Overview
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.
Instance Attribute Summary collapse
-
#certificates_required ⇒ Boolean
Whether certificates are required from this peer.
-
#certificates_validated ⇒ Boolean
Whether required certificates have been validated.
-
#is_authenticated ⇒ Boolean
Whether mutual authentication is complete.
-
#last_update ⇒ Integer
Unix timestamp (milliseconds) of last update.
-
#peer_identity_key ⇒ String?
The peer’s identity key (public key hex).
-
#peer_nonce ⇒ String?
The nonce we received from the peer (base64).
-
#session_nonce ⇒ String
readonly
Our nonce for this session (base64) — primary key.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(session_nonce:) ⇒ PeerSession
constructor
A new instance of PeerSession.
Constructor Details
#initialize(session_nonce:) ⇒ PeerSession
Returns a new instance of PeerSession.
38 39 40 41 42 43 44 45 46 |
# File 'lib/bsv/auth/peer_session.rb', line 38 def initialize(session_nonce:) @session_nonce = session_nonce @peer_identity_key = nil @peer_nonce = nil @is_authenticated = false @last_update = current_time_ms @certificates_required = false @certificates_validated = true end |
Instance Attribute Details
#certificates_required ⇒ Boolean
Returns whether certificates are required from this peer.
32 33 34 |
# File 'lib/bsv/auth/peer_session.rb', line 32 def certificates_required @certificates_required end |
#certificates_validated ⇒ Boolean
Returns whether required certificates have been validated.
35 36 37 |
# File 'lib/bsv/auth/peer_session.rb', line 35 def certificates_validated @certificates_validated end |
#is_authenticated ⇒ Boolean
Returns whether mutual authentication is complete.
26 27 28 |
# File 'lib/bsv/auth/peer_session.rb', line 26 def is_authenticated @is_authenticated end |
#last_update ⇒ Integer
Returns Unix timestamp (milliseconds) of last update.
29 30 31 |
# File 'lib/bsv/auth/peer_session.rb', line 29 def last_update @last_update end |
#peer_identity_key ⇒ String?
Returns the peer’s identity key (public key hex).
20 21 22 |
# File 'lib/bsv/auth/peer_session.rb', line 20 def peer_identity_key @peer_identity_key end |
#peer_nonce ⇒ String?
Returns the nonce we received from the peer (base64).
23 24 25 |
# File 'lib/bsv/auth/peer_session.rb', line 23 def peer_nonce @peer_nonce end |
#session_nonce ⇒ String (readonly)
Returns our nonce for this session (base64) — primary key.
17 18 19 |
# File 'lib/bsv/auth/peer_session.rb', line 17 def session_nonce @session_nonce end |
Instance Method Details
#authenticated? ⇒ Boolean
49 50 51 |
# File 'lib/bsv/auth/peer_session.rb', line 49 def authenticated? @is_authenticated end |