@@ -475,42 +475,42 @@ impl Ord for ClaimableHTLC {
475475pub trait Verification {
476476 /// Constructs an HMAC to include in [`OffersContext`] for the data along with the given
477477 /// [`Nonce`].
478- fn hmac_for_offer_payment (
478+ fn hmac_data (
479479 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
480480 ) -> Hmac<Sha256>;
481481
482482 /// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`].
483- fn verify_for_offer_payment (
483+ fn verify_data (
484484 &self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
485485 ) -> Result<(), ()>;
486486}
487487
488488impl Verification for PaymentHash {
489489 /// Constructs an HMAC to include in [`OffersContext::InboundPayment`] for the payment hash
490490 /// along with the given [`Nonce`].
491- fn hmac_for_offer_payment (
491+ fn hmac_data (
492492 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
493493 ) -> Hmac<Sha256> {
494494 signer::hmac_for_payment_hash(*self, nonce, expanded_key)
495495 }
496496
497497 /// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
498498 /// [`OffersContext::InboundPayment`].
499- fn verify_for_offer_payment (
499+ fn verify_data (
500500 &self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
501501 ) -> Result<(), ()> {
502502 signer::verify_payment_hash(*self, hmac, nonce, expanded_key)
503503 }
504504}
505505
506506impl Verification for UnauthenticatedReceiveTlvs {
507- fn hmac_for_offer_payment (
507+ fn hmac_data (
508508 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
509509 ) -> Hmac<Sha256> {
510510 signer::hmac_for_payment_tlvs(self, nonce, expanded_key)
511511 }
512512
513- fn verify_for_offer_payment (
513+ fn verify_data (
514514 &self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
515515 ) -> Result<(), ()> {
516516 signer::verify_payment_tlvs(self, hmac, nonce, expanded_key)
@@ -550,15 +550,15 @@ impl PaymentId {
550550impl Verification for PaymentId {
551551 /// Constructs an HMAC to include in [`OffersContext::OutboundPayment`] for the payment id
552552 /// along with the given [`Nonce`].
553- fn hmac_for_offer_payment (
553+ fn hmac_data (
554554 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
555555 ) -> Hmac<Sha256> {
556556 signer::hmac_for_offer_payment_id(*self, nonce, expanded_key)
557557 }
558558
559559 /// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
560560 /// [`OffersContext::OutboundPayment`].
561- fn verify_for_offer_payment (
561+ fn verify_data (
562562 &self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
563563 ) -> Result<(), ()> {
564564 signer::verify_offer_payment_id(*self, hmac, nonce, expanded_key)
@@ -10535,7 +10535,7 @@ where
1053510535 };
1053610536 let invoice_request = builder.build_and_sign()?;
1053710537
10538- let hmac = payment_id.hmac_for_offer_payment (nonce, expanded_key);
10538+ let hmac = payment_id.hmac_data (nonce, expanded_key);
1053910539 let context = MessageContext::Offers(
1054010540 OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }
1054110541 );
@@ -10639,7 +10639,7 @@ where
1063910639 let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?;
1064010640
1064110641 let nonce = Nonce::from_entropy_source(entropy);
10642- let hmac = payment_hash.hmac_for_offer_payment (nonce, expanded_key);
10642+ let hmac = payment_hash.hmac_data (nonce, expanded_key);
1064310643 let context = MessageContext::Offers(OffersContext::InboundPayment {
1064410644 payment_hash: invoice.payment_hash(), nonce, hmac
1064510645 });
@@ -12419,7 +12419,7 @@ where
1241912419 .release_invoice_requests_awaiting_invoice()
1242012420 {
1242112421 let RetryableInvoiceRequest { invoice_request, nonce, .. } = retryable_invoice_request;
12422- let hmac = payment_id.hmac_for_offer_payment (nonce, &self.inbound_payment_key);
12422+ let hmac = payment_id.hmac_data (nonce, &self.inbound_payment_key);
1242312423 let context = MessageContext::Offers(OffersContext::OutboundPayment {
1242412424 payment_id,
1242512425 nonce,
@@ -12602,7 +12602,7 @@ where
1260212602 match response {
1260312603 Ok(invoice) => {
1260412604 let nonce = Nonce::from_entropy_source(&*self.entropy_source);
12605- let hmac = payment_hash.hmac_for_offer_payment (nonce, expanded_key);
12605+ let hmac = payment_hash.hmac_data (nonce, expanded_key);
1260612606 let context = MessageContext::Offers(OffersContext::InboundPayment { payment_hash, nonce, hmac });
1260712607 Some((OffersMessage::Invoice(invoice), responder.respond_with_reply_path(context)))
1260812608 },
@@ -12639,7 +12639,7 @@ where
1263912639 OffersMessage::StaticInvoice(invoice) => {
1264012640 let payment_id = match context {
1264112641 Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
12642- if payment_id.verify_for_offer_payment (hmac, nonce, expanded_key).is_err() {
12642+ if payment_id.verify_data (hmac, nonce, expanded_key).is_err() {
1264312643 return None
1264412644 }
1264512645 payment_id
@@ -12652,7 +12652,7 @@ where
1265212652 OffersMessage::InvoiceError(invoice_error) => {
1265312653 let payment_hash = match context {
1265412654 Some(OffersContext::InboundPayment { payment_hash, nonce, hmac }) => {
12655- match payment_hash.verify_for_offer_payment (hmac, nonce, expanded_key) {
12655+ match payment_hash.verify_data (hmac, nonce, expanded_key) {
1265612656 Ok(_) => Some(payment_hash),
1265712657 Err(_) => None,
1265812658 }
@@ -12665,7 +12665,7 @@ where
1266512665
1266612666 match context {
1266712667 Some(OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }) => {
12668- if let Ok(()) = payment_id.verify_for_offer_payment (hmac, nonce, expanded_key) {
12668+ if let Ok(()) = payment_id.verify_data (hmac, nonce, expanded_key) {
1266912669 self.abandon_payment_with_reason(
1267012670 payment_id, PaymentFailureReason::InvoiceRequestRejected,
1267112671 );
0 commit comments