-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client-side of static invoice server #3618
base: main
Are you sure you want to change the base?
Changes from 1 commit
3d37394
ee171fc
e62b5ec
890ce7d
9e0f2da
b52f1b4
e99e05b
41f0088
b67220b
cd62d3a
5cf3585
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,11 @@ const PAYMENT_TLVS_HMAC_INPUT: &[u8; 16] = &[8; 16]; | |
#[cfg(async_payments)] | ||
const ASYNC_PAYMENTS_HELD_HTLC_HMAC_INPUT: &[u8; 16] = &[9; 16]; | ||
|
||
// HMAC input used in `AsyncPaymentsContext::OfferPaths` to authenticate inbound offer_paths onion | ||
// messages. | ||
#[cfg(async_payments)] | ||
const ASYNC_PAYMENTS_OFFER_PATHS_INPUT: &[u8; 16] = &[10; 16]; | ||
|
||
/// Message metadata which possibly is derived from [`MetadataMaterial`] such that it can be | ||
/// verified. | ||
#[derive(Clone)] | ||
|
@@ -555,3 +560,16 @@ pub(crate) fn verify_held_htlc_available_context( | |
Err(()) | ||
} | ||
} | ||
|
||
#[cfg(async_payments)] | ||
pub(crate) fn hmac_for_offer_paths_context( | ||
nonce: Nonce, expanded_key: &ExpandedKey, | ||
) -> Hmac<Sha256> { | ||
const IV_BYTES: &[u8; IV_LEN] = b"LDK Offer Paths~"; | ||
let mut hmac = expanded_key.hmac_for_offer(); | ||
hmac.input(IV_BYTES); | ||
hmac.input(&nonce.0); | ||
hmac.input(ASYNC_PAYMENTS_OFFER_PATHS_INPUT); | ||
Comment on lines
+573
to
+577
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the nonce/IV was sufficient but I'm not certain. @TheBlueMatt would it be an improvement to commit to the expiry in the hmac? IIUC the path still can't be re-purposed... |
||
|
||
Hmac::from_engine(hmac) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My view on channelmanager is that it manages the channels. Relatively low level operations. I think that async offers live on a higher level, a level above basic channel management. Shouldn't this be reflected in code, by implementing it outside of channel manager?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I believe this will move into
OffersMessageFlow
once #3639 lands!