Skip to content

Commit

Permalink
export GenerateSharedSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
joostjager committed Jan 17, 2023
1 parent 9260f57 commit 568d591
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ func blindBaseElement(blindingFactor btcec.ModNScalar) *btcec.PublicKey {
type sharedSecretGenerator interface {
// generateSharedSecret given a public key, generates a shared secret
// using private data of the underlying sharedSecretGenerator.
generateSharedSecret(dhKey *btcec.PublicKey) (Hash256, error)
GenerateSharedSecret(dhKey *btcec.PublicKey) (Hash256, error)
}

// generateSharedSecret generates the shared secret by given ephemeral key.
func (r *Router) generateSharedSecret(dhKey *btcec.PublicKey) (Hash256, error) {
func (r *Router) GenerateSharedSecret(dhKey *btcec.PublicKey) (Hash256, error) {
var sharedSecret Hash256

// Ensure that the public key is on our curve.
Expand Down
6 changes: 3 additions & 3 deletions sphinx.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func (r *Router) ProcessOnionPacket(onionPkt *OnionPacket,
assocData []byte, incomingCltv uint32) (*ProcessedPacket, error) {

// Compute the shared secret for this onion packet.
sharedSecret, err := r.generateSharedSecret(onionPkt.EphemeralKey)
sharedSecret, err := r.GenerateSharedSecret(onionPkt.EphemeralKey)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -568,7 +568,7 @@ func (r *Router) ReconstructOnionPacket(onionPkt *OnionPacket,
assocData []byte) (*ProcessedPacket, error) {

// Compute the shared secret for this onion packet.
sharedSecret, err := r.generateSharedSecret(onionPkt.EphemeralKey)
sharedSecret, err := r.GenerateSharedSecret(onionPkt.EphemeralKey)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -731,7 +731,7 @@ func (t *Tx) ProcessOnionPacket(seqNum uint16, onionPkt *OnionPacket,
assocData []byte, incomingCltv uint32) error {

// Compute the shared secret for this onion packet.
sharedSecret, err := t.router.generateSharedSecret(
sharedSecret, err := t.router.GenerateSharedSecret(
onionPkt.EphemeralKey,
)
if err != nil {
Expand Down

0 comments on commit 568d591

Please sign in to comment.