Documentation ¶
Overview ¶
Package session provides an onion message type that delivers the two session private keys to be associated with a session, for which the hash of the secrets was used as the payment preimage for starting a session.
Topping up sessions does not require following up with this message as the handler finds the session and adjusts the balance according to the payment.
Index ¶
- Constants
- func Gen() codec.Codec
- func New(hop byte) (x ont.Onion)
- type Session
- func (x *Session) Account(res *sess.Data, sm *sess.Manager, s *sessions.Data, last bool) (skip bool, sd *sessions.Data)
- func (x *Session) Decode(s *splice.Splice) (e error)
- func (x *Session) Encode(s *splice.Splice) (e error)
- func (x *Session) Handle(s *splice.Splice, p ont.Onion, ng ont.Ngin) (e error)
- func (x *Session) Len() int
- func (x *Session) Magic() string
- func (x *Session) PreimageHash() sha256.Hash
- func (x *Session) Unwrap() interface{}
- func (x *Session) Wrap(inner ont.Onion)
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Session ¶
type Session struct { // ID is an identifier only used by the client. ID nonce.ID // Hop is the position in the circuit this session is used, also private to the client. Hop byte // Header and Payload are the crypto.Keys based on the two private keys used for // the session (and hashed into the preimage). Header, Payload *crypto.Keys // Onion is the rest of the message, which usually will be some number more // Session/Crypt layers. ont.Onion }
Session is the delivery of the two client defined private keys that a relay uses to identify and encrypt/decrypt messages related to a session.
func (*Session) Account ¶
func (x *Session) Account(res *sess.Data, sm *sess.Manager, s *sessions.Data, last bool) (skip bool, sd *sessions.Data)
Account for the Session message - in this case, this is the one exception to the rule all messages must have sessions to relay, which is usually what is inside Session Onion fields as well up to the return confirmation layer.
func (*Session) Handle ¶
Handle is the relay logic for an engine handling a Session message.
If the relay finds a pending payment it will forward the next part of the onion, otherwise not. This is the only onion that relaying isn't charged for because it establishes the account.
func (*Session) Magic ¶
Magic is the identifying 4 byte string indicating a Session message follows.
func (*Session) PreimageHash ¶
PreimageHash returns the preimage to use in a LN payment to associate to this session.