let (k1, k2, _) = hkdf_extract_expand!($salt, $ikm);
(k1, k2)
}};
- ($salt: expr, $ikm: expr, 5) => {{
+ ($salt: expr, $ikm: expr, 6) => {{
let (k1, k2, prk) = hkdf_extract_expand!($salt, $ikm);
let mut hmac = HmacEngine::<Sha256>::new(&prk[..]);
hmac.input(&[5; 1]);
let k5 = Hmac::from_engine(hmac).to_byte_array();
- (k1, k2, k3, k4, k5)
+ let mut hmac = HmacEngine::<Sha256>::new(&prk[..]);
+ hmac.input(&k5);
+ hmac.input(&[6; 1]);
+ let k6 = Hmac::from_engine(hmac).to_byte_array();
+
+ (k1, k2, k3, k4, k5, k6)
}};
}
hkdf_extract_expand!(salt, ikm, 2)
}
-pub fn hkdf_extract_expand_5x(
+pub fn hkdf_extract_expand_6x(
salt: &[u8], ikm: &[u8],
-) -> ([u8; 32], [u8; 32], [u8; 32], [u8; 32], [u8; 32]) {
- hkdf_extract_expand!(salt, ikm, 5)
+) -> ([u8; 32], [u8; 32], [u8; 32], [u8; 32], [u8; 32], [u8; 32]) {
+ hkdf_extract_expand!(salt, ikm, 6)
}
#[inline]
use bitcoin::hashes::sha256::Hash as Sha256;
use crate::crypto::chacha20::ChaCha20;
-use crate::crypto::utils::hkdf_extract_expand_5x;
+use crate::crypto::utils::hkdf_extract_expand_6x;
use crate::ln::msgs;
use crate::ln::msgs::MAX_VALUE_MSAT;
use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
offers_base_key: [u8; 32],
/// The key used to encrypt message metadata for BOLT 12 Offers.
offers_encryption_key: [u8; 32],
+ /// The key used to authenticate spontaneous payments' metadata as previously registered with LDK
+ /// for inclusion in a blinded path.
+ spontaneous_pmt_key: [u8; 32],
}
impl ExpandedKey {
user_pmt_hash_key,
offers_base_key,
offers_encryption_key,
- ) = hkdf_extract_expand_5x(b"LDK Inbound Payment Key Expansion", &key_material.0);
+ spontaneous_pmt_key,
+ ) = hkdf_extract_expand_6x(b"LDK Inbound Payment Key Expansion", &key_material.0);
Self {
metadata_key,
ldk_pmt_hash_key,
user_pmt_hash_key,
offers_base_key,
offers_encryption_key,
+ spontaneous_pmt_key,
}
}