/** * The scrub: it replaces every identifying value in a captured document with a synthetic stand-in, and replaces the same input with the same stand-in everywhere it * appears. * * Referential consistency is the property that makes a scrubbed bundle still useful. A camera's MAC appears in its own record, in the NVR's device list, and in a * feature-flag map keyed by that MAC; if each occurrence got a fresh pseudonym, the relationships between records would be destroyed and the bundle would stop * describing a system. One replacement memory per bundle keeps every cross-reference intact while none of the real values survive. * * Two rules decide what a string becomes. The key it arrived under decides first, so a device named "192.168.1.5" is pseudonymized as a name rather than as an * address. Failing that, the value's own shape decides, which is what catches identifying values under keys no catalog anticipated - including fields on device classes * this version of the library has never seen, which is exactly the traffic a capture exists to collect. * * Numbers are otherwise left alone, with one exception. A latitude or a longitude carries a site's or a person's position, identity the string rules can never reach, so * a number arriving under a coordinate key becomes zero - the field stays numeric, and it points nowhere a real installation could be. * * Replacements are chosen to stay in their original shape: MACs stay MAC-shaped and locally administered, addresses land in the range reserved for documentation, UUIDs * stay UUID-shaped, and cleared secrets keep their original length. A consumer reading the bundle sees data that still parses and still lines up. * * @module ProtectCliScrub */ type ScrubCategory = "email" | "hash" | "host" | "ip" | "mac" | "name" | "token" | "uuid"; /** * The replacement memory for one scrub run. * * One context scrubs one bundle: every value it has already replaced is remembered, so the same input maps to the same output for as long as the context lives, and * nothing carries over to the next run. Create it with {@link createScrubContext} and pass the same one to every {@link scrub} call that makes up a document. * * @category CLI */ export interface ScrubContext { readonly replacements: Map>; } /** * Create a replacement memory for one bundle. * * @returns A fresh context, remembering nothing. * * @category CLI */ export declare function createScrubContext(): ScrubContext; /** * Scrub a captured value, returning a pseudonymized copy. * * The input is never modified: objects and arrays are rebuilt rather than edited, so a caller may keep using the original. * * Binary values pass through untouched. Bytes are not string territory, and the layer that assembles a bundle is what decides how to carry them. * * @param value - Any JSON-shaped value: a whole document, a record, or a single field. * @param context - The replacement memory. Pass one context through a whole bundle so its cross-references survive. * * @returns The scrubbed copy. * * @category CLI */ export declare function scrub(value: unknown, context: ScrubContext): unknown; export {}; //# sourceMappingURL=scrub.d.ts.map