New privacyEnabled field to detect redaction based on keyword heuristics

Updated the DomainRecord interface to include detailed comments for clarity and added a new privacyEnabled field to indicate if the registrant's information is privacy-redacted. Enhanced normalization functions for both RDAP and WHOIS to derive the privacy flag based on registrant keywords. Updated tests to verify the correct functionality of privacy detection in both normalization processes. Additionally, the README was updated to reflect the inclusion of the privacy flag in the normalized output.
This commit is contained in:
2025-10-08 21:31:21 -04:00
parent 57209eae39
commit 2c9904e5e8
7 changed files with 146 additions and 26 deletions
+27
View File
@@ -80,3 +80,30 @@ test("normalizeRdap maps registrar, contacts, nameservers, events, dnssec", () =
expect(rec.whoisServer).toBe("whois.example-registrar.test");
expect(rec.source).toBe("rdap");
});
test("normalizeRdap derives privacyEnabled from registrant keywords", () => {
const rdap = {
ldhName: "example.com",
unicodeName: "example.com",
entities: [
{
roles: ["registrant"],
vcardArray: [
"vcard",
[
["fn", {}, "text", "REDACTED FOR PRIVACY"],
["org", {}, "text", "Example Org"],
],
],
},
],
};
const rec = normalizeRdap(
"example.com",
"com",
rdap,
["https://rdap.example/"],
"2025-01-01T00:00:00Z",
);
expect(rec.privacyEnabled).toBe(true);
});