We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d092917 commit b23925fCopy full SHA for b23925f
src/headers/lnurl_auth_jwt.rs
@@ -172,8 +172,11 @@ fn linking_key_path(hashing_key: &PrivateKey, domain_name: &str) -> Result<Deriv
172
let mut engine = HmacEngine::<sha256::Hash>::new(&hashing_key.inner[..]);
173
engine.input(domain_name.as_bytes());
174
let result = Hmac::<sha256::Hash>::from_engine(engine).to_byte_array();
175
- let children = (0..4)
176
- .map(|i| u32::from_be_bytes(result[(i * 4)..((i + 1) * 4)].try_into().unwrap()))
+ // unwrap safety: We take 4-byte chunks, so TryInto for [u8; 4] never fails.
+ let children = result
177
+ .chunks_exact(4)
178
+ .take(4)
179
+ .map(|i| u32::from_be_bytes(i.try_into().unwrap()))
180
.map(ChildNumber::from);
181
Ok(DerivationPath::from_iter(children))
182
}
0 commit comments