@@ -475,42 +475,42 @@ impl Ord for ClaimableHTLC {
475
475
pub trait Verification {
476
476
/// Constructs an HMAC to include in [`OffersContext`] for the data along with the given
477
477
/// [`Nonce`].
478
- fn hmac_for_offer_payment (
478
+ fn hmac_data (
479
479
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
480
480
) -> Hmac<Sha256>;
481
481
482
482
/// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`].
483
- fn verify_for_offer_payment (
483
+ fn verify_data (
484
484
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
485
485
) -> Result<(), ()>;
486
486
}
487
487
488
488
impl Verification for PaymentHash {
489
489
/// Constructs an HMAC to include in [`OffersContext::InboundPayment`] for the payment hash
490
490
/// along with the given [`Nonce`].
491
- fn hmac_for_offer_payment (
491
+ fn hmac_data (
492
492
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
493
493
) -> Hmac<Sha256> {
494
494
signer::hmac_for_payment_hash(*self, nonce, expanded_key)
495
495
}
496
496
497
497
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
498
498
/// [`OffersContext::InboundPayment`].
499
- fn verify_for_offer_payment (
499
+ fn verify_data (
500
500
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
501
501
) -> Result<(), ()> {
502
502
signer::verify_payment_hash(*self, hmac, nonce, expanded_key)
503
503
}
504
504
}
505
505
506
506
impl Verification for UnauthenticatedReceiveTlvs {
507
- fn hmac_for_offer_payment (
507
+ fn hmac_data (
508
508
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
509
509
) -> Hmac<Sha256> {
510
510
signer::hmac_for_payment_tlvs(self, nonce, expanded_key)
511
511
}
512
512
513
- fn verify_for_offer_payment (
513
+ fn verify_data (
514
514
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
515
515
) -> Result<(), ()> {
516
516
signer::verify_payment_tlvs(self, hmac, nonce, expanded_key)
@@ -550,15 +550,15 @@ impl PaymentId {
550
550
impl Verification for PaymentId {
551
551
/// Constructs an HMAC to include in [`OffersContext::OutboundPayment`] for the payment id
552
552
/// along with the given [`Nonce`].
553
- fn hmac_for_offer_payment (
553
+ fn hmac_data (
554
554
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
555
555
) -> Hmac<Sha256> {
556
556
signer::hmac_for_offer_payment_id(*self, nonce, expanded_key)
557
557
}
558
558
559
559
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
560
560
/// [`OffersContext::OutboundPayment`].
561
- fn verify_for_offer_payment (
561
+ fn verify_data (
562
562
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
563
563
) -> Result<(), ()> {
564
564
signer::verify_offer_payment_id(*self, hmac, nonce, expanded_key)
@@ -10560,7 +10560,7 @@ where
10560
10560
};
10561
10561
let invoice_request = builder.build_and_sign()?;
10562
10562
10563
- let hmac = payment_id.hmac_for_offer_payment (nonce, expanded_key);
10563
+ let hmac = payment_id.hmac_data (nonce, expanded_key);
10564
10564
let context = MessageContext::Offers(
10565
10565
OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }
10566
10566
);
@@ -10664,7 +10664,7 @@ where
10664
10664
let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?;
10665
10665
10666
10666
let nonce = Nonce::from_entropy_source(entropy);
10667
- let hmac = payment_hash.hmac_for_offer_payment (nonce, expanded_key);
10667
+ let hmac = payment_hash.hmac_data (nonce, expanded_key);
10668
10668
let context = MessageContext::Offers(OffersContext::InboundPayment {
10669
10669
payment_hash: invoice.payment_hash(), nonce, hmac
10670
10670
});
@@ -12444,7 +12444,7 @@ where
12444
12444
.release_invoice_requests_awaiting_invoice()
12445
12445
{
12446
12446
let RetryableInvoiceRequest { invoice_request, nonce, .. } = retryable_invoice_request;
12447
- let hmac = payment_id.hmac_for_offer_payment (nonce, &self.inbound_payment_key);
12447
+ let hmac = payment_id.hmac_data (nonce, &self.inbound_payment_key);
12448
12448
let context = MessageContext::Offers(OffersContext::OutboundPayment {
12449
12449
payment_id,
12450
12450
nonce,
@@ -12627,7 +12627,7 @@ where
12627
12627
match response {
12628
12628
Ok(invoice) => {
12629
12629
let nonce = Nonce::from_entropy_source(&*self.entropy_source);
12630
- let hmac = payment_hash.hmac_for_offer_payment (nonce, expanded_key);
12630
+ let hmac = payment_hash.hmac_data (nonce, expanded_key);
12631
12631
let context = MessageContext::Offers(OffersContext::InboundPayment { payment_hash, nonce, hmac });
12632
12632
Some((OffersMessage::Invoice(invoice), responder.respond_with_reply_path(context)))
12633
12633
},
@@ -12664,7 +12664,7 @@ where
12664
12664
OffersMessage::StaticInvoice(invoice) => {
12665
12665
let payment_id = match context {
12666
12666
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
12667
- if payment_id.verify_for_offer_payment (hmac, nonce, expanded_key).is_err() {
12667
+ if payment_id.verify_data (hmac, nonce, expanded_key).is_err() {
12668
12668
return None
12669
12669
}
12670
12670
payment_id
@@ -12677,7 +12677,7 @@ where
12677
12677
OffersMessage::InvoiceError(invoice_error) => {
12678
12678
let payment_hash = match context {
12679
12679
Some(OffersContext::InboundPayment { payment_hash, nonce, hmac }) => {
12680
- match payment_hash.verify_for_offer_payment (hmac, nonce, expanded_key) {
12680
+ match payment_hash.verify_data (hmac, nonce, expanded_key) {
12681
12681
Ok(_) => Some(payment_hash),
12682
12682
Err(_) => None,
12683
12683
}
@@ -12690,7 +12690,7 @@ where
12690
12690
12691
12691
match context {
12692
12692
Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
12693
- if let Ok(()) = payment_id.verify_for_offer_payment (hmac, nonce, expanded_key) {
12693
+ if let Ok(()) = payment_id.verify_data (hmac, nonce, expanded_key) {
12694
12694
self.abandon_payment_with_reason(
12695
12695
payment_id, PaymentFailureReason::InvoiceRequestRejected,
12696
12696
);
0 commit comments