Sphinx
- Source:
- Sphinx.scala
Type members
Classlikes
A properly decrypted failure from a node in the route.
A properly decrypted failure from a node in the route.
- Value parameters:
- failureMessage
friendly failure message.
- originNode
public key of the node that generated the failure.
- Source:
- Sphinx.scala
Decrypting an onion packet yields a payload for the current node and the encrypted packet for the next node.
Decrypting an onion packet yields a payload for the current node and the encrypted packet for the next node.
- Value parameters:
- nextPacket
packet for the next node.
- payload
decrypted payload for this node.
- sharedSecret
shared secret for the sending node, which we will need to return failure messages.
- Source:
- Sphinx.scala
A encrypted onion packet with all the associated shared secrets.
A encrypted onion packet with all the associated shared secrets.
- Value parameters:
- packet
encrypted onion packet.
- sharedSecrets
shared secrets (one per node in the route). Known (and needed) only if you're creating the packet. Empty if you're just forwarding the packet to the next node.
- Source:
- Sphinx.scala
Route blinding is a lightweight technique to provide recipient anonymity by blinding an arbitrary amount of hops at the end of an onion path. It can be used for payments or onion messages.
Route blinding is a lightweight technique to provide recipient anonymity by blinding an arbitrary amount of hops at the end of an onion path. It can be used for payments or onion messages.
- Source:
- Sphinx.scala
Value members
Concrete methods
Create an encrypted onion packet that contains payloads for all nodes in the list.
Create an encrypted onion packet that contains payloads for all nodes in the list.
- Value parameters:
- associatedData
associated data.
- packetPayloadLength
length of the packet's encrypted onion payload (e.g. 1300 for standard payment onions).
- payloads
payloads (one per node).
- publicKeys
node public keys (one per node).
- sessionKey
session key.
- Returns:
An onion packet with all shared secrets. The onion packet can be sent to the first node in the list, and the shared secrets (one per node) can be used to parse returned failure messages if needed.
- Source:
- Sphinx.scala
Generate a deterministic filler to prevent intermediate nodes from knowing their position in the route. See https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#filler-generation
Generate a deterministic filler to prevent intermediate nodes from knowing their position in the route. See https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#filler-generation
- Value parameters:
- keyType
type of key used (depends on the onion we're building).
- packetPayloadLength
length of the packet's encrypted onion payload (e.g. 1300 for standard payment onions).
- payloads
payloads for all the hops.
- sharedSecrets
shared secrets for all the hops.
- Returns:
filler bytes.
- Source:
- Sphinx.scala
When an invalid onion is received, its hash should be included in the failure message.
When an invalid onion is received, its hash should be included in the failure message.
- Source:
- Sphinx.scala
Peek at the first bytes of the per-hop payload to extract its length.
Peek at the first bytes of the per-hop payload to extract its length.
- Source:
- Sphinx.scala
Decrypt the incoming packet, extract the per-hop payload and build the packet for the next node.
Decrypt the incoming packet, extract the per-hop payload and build the packet for the next node.
- Value parameters:
- associatedData
associated data.
- packet
packet received by this node.
- privateKey
this node's private key.
- Returns:
a DecryptedPacket(payload, packet, shared secret) object where:
- payload is the per-hop payload for this node.
- packet is the next packet, to be forwarded using the info that is given in the payload.
- shared secret is the secret we share with the node that sent the packet. We need it to propagate failure messages upstream. or a BadOnion error containing the hash of the invalid onion.
- Source:
- Sphinx.scala
Wrap the given packet in an additional layer of onion encryption, adding an encrypted payload for a specific node.
Wrap the given packet in an additional layer of onion encryption, adding an encrypted payload for a specific node.
Packets are constructed in reverse order:
- you first create the packet for the final recipient
- then you call wrap(...) until you've built the final onion packet that will be sent to the first node in the route
- Value parameters:
- associatedData
associated data.
- ephemeralPublicKey
ephemeral key shared with the target node.
- onionPayloadFiller
optional onion payload filler, needed only when you're constructing the last packet.
- packet
current packet or random bytes if the packet hasn't been initialized.
- payload
per-hop payload for the target node.
- sharedSecret
shared secret with this hop.
- Returns:
the next packet.
- Source:
- Sphinx.scala
Concrete fields
Supported packet version. Note that since this value is outside of the onion encrypted payload, intermediate nodes may or may not use this value when forwarding the packet to the next node.
Supported packet version. Note that since this value is outside of the onion encrypted payload, intermediate nodes may or may not use this value when forwarding the packet to the next node.
- Source:
- Sphinx.scala