MCPcopy Create free account
hub / github.com/ElementsProject/lightning / get_hmac_hex

Method get_hmac_hex

plugins/lsps-plugin/src/proto/lsps2.rs:308–323  ·  view source on GitHub ↗
(&self, secret: &[u8])

Source from the content-addressed store, hash-verified

306
307impl PolicyOpeningFeeParams {
308 pub fn get_hmac_hex(&self, secret: &[u8]) -> String {
309 let mut hmac = HmacEngine::<sha256::Hash>::new(&secret);
310 hmac.input(&self.min_fee_msat.msat().to_be_bytes());
311 hmac.input(&self.proportional.ppm().to_be_bytes());
312 hmac.input(self.valid_until.to_rfc3339().as_bytes());
313 hmac.input(&self.min_lifetime.to_be_bytes());
314 hmac.input(&self.max_client_to_self_delay.to_be_bytes());
315 hmac.input(&self.min_payment_size_msat.msat().to_be_bytes());
316 hmac.input(&self.max_payment_size_msat.msat().to_be_bytes());
317 let promise = Hmac::from_engine(hmac)
318 .to_byte_array()
319 .iter()
320 .map(|b| format!("{:02x}", b))
321 .collect();
322 promise
323 }
324
325 pub fn with_promise(&self, secret: &[u8; 32]) -> OpeningFeeParams {
326 OpeningFeeParams {

Calls 3

ppmMethod · 0.80
mapMethod · 0.80
msatMethod · 0.45

Tested by 1

test_successful_get_infoFunction · 0.64