peel

fun peel(privateKey: PrivateKey, associatedData: ByteVector, packet: OnionRoutingPacket, packetLength: Int): Either<FailureMessage, DecryptedPacket>

Decrypt the incoming packet, extract the per-hop payload and build the packet for the next node.

Return

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.

Parameters

privateKey

this node's private key.

associatedData

associated data.

packet

packet received by this node.

packetLength

length of the onion-encrypted payload (1300 for payment onions, 400 for trampoline onions).