/ onionmessage / interfaces.go
interfaces.go
1 package onionmessage 2 3 import ( 4 "github.com/btcsuite/btcd/btcec/v2" 5 sphinx "github.com/lightningnetwork/lightning-onion" 6 "github.com/lightningnetwork/lnd/lnwire" 7 ) 8 9 // OnionRouter wraps the sphinx router operations needed for onion message 10 // processing. 11 type OnionRouter interface { 12 // ProcessOnionPacket processes an onion packet and returns the 13 // processed result. 14 ProcessOnionPacket(pkt *sphinx.OnionPacket, assocData []byte, 15 incomingCltv uint32, 16 opts ...sphinx.ProcessOnionOpt) (*sphinx.ProcessedPacket, error) 17 18 // DecryptBlindedHopData decrypts the encrypted hop data using the 19 // given path key. 20 DecryptBlindedHopData(pathKey *btcec.PublicKey, 21 encData []byte) ([]byte, error) 22 23 // NextEphemeral derives the next ephemeral key from the current path 24 // key. 25 NextEphemeral( 26 currentPathKey *btcec.PublicKey) (*btcec.PublicKey, error) 27 } 28 29 // OnionMessageUpdateDispatcher dispatches onion message updates to 30 // subscribers. 31 type OnionMessageUpdateDispatcher interface { 32 // SendUpdate sends an onion message update to all subscribers. 33 SendUpdate(update any) error 34 } 35 36 // PeerMessageSender sends onion messages to peers identified by public key. 37 type PeerMessageSender interface { 38 // SendToPeer sends an onion message to the peer identified by the 39 // given compressed public key. 40 SendToPeer(pubKey [33]byte, msg *lnwire.OnionMessage) error 41 }