@@ -456,11 +456,11 @@ pub trait Verification {
456
456
/// [`Nonce`].
457
457
fn hmac_for_offer_payment(
458
458
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
459
- ) -> Hmac<Sha256> ;
459
+ ) -> [u8; 32] ;
460
460
461
461
/// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`].
462
462
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,
464
464
) -> Result<(), ()>;
465
465
}
466
466
@@ -469,29 +469,31 @@ impl Verification for PaymentHash {
469
469
/// along with the given [`Nonce`].
470
470
fn hmac_for_offer_payment(
471
471
&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()
474
474
}
475
475
476
476
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
477
477
/// [`OffersContext::InboundPayment`].
478
478
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,
480
480
) -> Result<(), ()> {
481
+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
481
482
signer::verify_payment_hash(*self, hmac, nonce, expanded_key)
482
483
}
483
484
}
484
485
485
486
impl Verification for UnauthenticatedReceiveTlvs {
486
487
fn hmac_for_offer_payment(
487
488
&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()
490
491
}
491
492
492
493
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,
494
495
) -> Result<(), ()> {
496
+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
495
497
signer::verify_payment_tlvs(self, hmac, nonce, expanded_key)
496
498
}
497
499
}
@@ -512,16 +514,17 @@ impl PaymentId {
512
514
#[cfg(async_payments)]
513
515
pub fn hmac_for_async_payment(
514
516
&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()
517
519
}
518
520
519
521
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
520
522
/// [`AsyncPaymentsContext::OutboundPayment`].
521
523
#[cfg(async_payments)]
522
524
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,
524
526
) -> Result<(), ()> {
527
+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
525
528
signer::verify_async_payment_id(*self, hmac, nonce, expanded_key)
526
529
}
527
530
}
@@ -531,15 +534,16 @@ impl Verification for PaymentId {
531
534
/// along with the given [`Nonce`].
532
535
fn hmac_for_offer_payment(
533
536
&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()
536
539
}
537
540
538
541
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
539
542
/// [`OffersContext::OutboundPayment`].
540
543
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,
542
545
) -> Result<(), ()> {
546
+ let hmac = bitcoin::hashes::hmac::Hmac::from_byte_array(hmac);
543
547
signer::verify_offer_payment_id(*self, hmac, nonce, expanded_key)
544
548
}
545
549
}
0 commit comments