Do not try to validate nip05 domains less than 4 characters long

This commit is contained in:
Mike Dilger 2023-01-14 11:01:13 +13:00
parent 191c7a792d
commit 56f458f119

View File

@ -133,6 +133,10 @@ fn parse_dns_id(dns_id: &str) -> Result<(String, String), Error> {
} else {
let domain = parts.pop().unwrap();
let user = parts.pop().unwrap();
if domain.len() < 4 {
// smallest non-TLD domain is like 't.co'
return Err(Error::InvalidDnsId);
}
Ok((user.to_string(), domain.to_string()))
}
}