Skip to content

Commit

Permalink
sphinx: add DecryptBlindedData method to Router
Browse files Browse the repository at this point in the history
In this commit, a DecryptBlindedData method is added to Router which
makes use of the Router's onion key in order to unblind blinded data.
  • Loading branch information
ellemouton committed Dec 20, 2022
1 parent bbc8dcf commit eb768d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sphinx.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,14 @@ func (r *Router) ReconstructOnionPacket(onionPkt *OnionPacket, assocData []byte,
return processOnionPacket(onionPkt, &sharedSecret, assocData)
}

// DecryptBlindedData uses the router's private key to decrypt data encrypted by
// the creator of the blinded route.
func (r *Router) DecryptBlindedData(ephemPub *btcec.PublicKey,
encryptedData []byte) ([]byte, error) {

return DecryptBlindedData(r.onionKey, ephemPub, encryptedData)
}

// unwrapPacket wraps a layer of the passed onion packet using the specified
// shared secret and associated data. The associated data will be used to check
// the HMAC at each hop to ensure the same data is passed along with the onion
Expand Down

0 comments on commit eb768d0

Please sign in to comment.