fuzz_secret.rs 502 B

123456789101112131415161718
  1. #![no_main]
  2. use std::str::FromStr;
  3. use libfuzzer_sys::fuzz_target;
  4. use cashu::nuts::nut10::Secret as Nut10Secret;
  5. use cashu::secret::Secret;
  6. fuzz_target!(|data: &str| {
  7. // Fuzz the NUT-10 secret JSON parsing (complex structured data)
  8. let _: Result<Nut10Secret, _> = serde_json::from_str(data);
  9. // Also try the conversion path: raw secret -> nut10 secret
  10. if let Ok(secret) = Secret::from_str(data) {
  11. let _: Result<Nut10Secret, _> = Nut10Secret::try_from(&secret);
  12. }
  13. });