@@ -456,11 +456,11 @@ pub trait Verification {
456456 /// [`Nonce`].
457457 fn hmac_for_offer_payment(
458458 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
459- ) -> Hmac<Sha256> ;
459+ ) -> [u8; 32] ;
460460
461461 /// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`].
462462 fn verify_for_offer_payment(
463- &self, hmac: Hmac<Sha256> , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
463+ &self, hmac: [u8; 32] , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
464464 ) -> Result<(), ()>;
465465}
466466
@@ -469,29 +469,31 @@ impl Verification for PaymentHash {
469469 /// along with the given [`Nonce`].
470470 fn hmac_for_offer_payment(
471471 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
472- ) -> Hmac<Sha256> {
473- signer::hmac_for_payment_hash(*self, nonce, expanded_key)
472+ ) -> [u8; 32] {
473+ signer::hmac_for_payment_hash(*self, nonce, expanded_key).to_byte_array()
474474 }
475475
476476 /// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
477477 /// [`OffersContext::InboundPayment`].
478478 fn verify_for_offer_payment(
479- &self, hmac: Hmac<Sha256> , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
479+ &self, hmac: [u8; 32] , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
480480 ) -> Result<(), ()> {
481+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
481482 signer::verify_payment_hash(*self, hmac, nonce, expanded_key)
482483 }
483484}
484485
485486impl Verification for UnauthenticatedReceiveTlvs {
486487 fn hmac_for_offer_payment(
487488 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
488- ) -> Hmac<Sha256> {
489- signer::hmac_for_payment_tlvs(self, nonce, expanded_key)
489+ ) -> [u8; 32] {
490+ signer::hmac_for_payment_tlvs(self, nonce, expanded_key).to_byte_array()
490491 }
491492
492493 fn verify_for_offer_payment(
493- &self, hmac: Hmac<Sha256> , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
494+ &self, hmac: [u8; 32] , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
494495 ) -> Result<(), ()> {
496+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
495497 signer::verify_payment_tlvs(self, hmac, nonce, expanded_key)
496498 }
497499}
@@ -512,16 +514,17 @@ impl PaymentId {
512514 #[cfg(async_payments)]
513515 pub fn hmac_for_async_payment(
514516 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
515- ) -> Hmac<Sha256> {
516- signer::hmac_for_async_payment_id(*self, nonce, expanded_key)
517+ ) -> [u8; 32] {
518+ signer::hmac_for_async_payment_id(*self, nonce, expanded_key).to_byte_array()
517519 }
518520
519521 /// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
520522 /// [`AsyncPaymentsContext::OutboundPayment`].
521523 #[cfg(async_payments)]
522524 pub fn verify_for_async_payment(
523- &self, hmac: Hmac<Sha256> , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
525+ &self, hmac: [u8; 32] , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
524526 ) -> Result<(), ()> {
527+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
525528 signer::verify_async_payment_id(*self, hmac, nonce, expanded_key)
526529 }
527530}
@@ -531,15 +534,16 @@ impl Verification for PaymentId {
531534 /// along with the given [`Nonce`].
532535 fn hmac_for_offer_payment(
533536 &self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
534- ) -> Hmac<Sha256> {
535- signer::hmac_for_offer_payment_id(*self, nonce, expanded_key)
537+ ) -> [u8; 32] {
538+ signer::hmac_for_offer_payment_id(*self, nonce, expanded_key).to_byte_array()
536539 }
537540
538541 /// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
539542 /// [`OffersContext::OutboundPayment`].
540543 fn verify_for_offer_payment(
541- &self, hmac: Hmac<Sha256> , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
544+ &self, hmac: [u8; 32] , nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
542545 ) -> Result<(), ()> {
546+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
543547 signer::verify_offer_payment_id(*self, hmac, nonce, expanded_key)
544548 }
545549}
0 commit comments