AMEVA Privacy Utilities
Network identifier masking, IP anonymisation, and privacy-preserving telemetry
Internal Shared Module
AMEVA Privacy is an internal shared utility extracted from api/sentinel.js to prevent circular dependencies. It is consumed by amv-sentinel and the uno-km server analytics pipeline. It is not distributed as a standalone npm or PyPI package; import it directly from the ecosystem source.
Overview
The AMEVA Privacy module provides three categories of functionality:
- IP address masking — zeroes the host portion of IPv4 and IPv6 addresses before any storage or logging, ensuring no raw end-user IPs are retained.
- Target type normalisation — maps arbitrary DOM interaction targets to a canonical allowed set (
BUTTON,LINK,CODE,INPUT,NAVIGATION,OTHER) before the event reaches the sentinel risk evaluator. - Telemetry scrubbing — strips personally identifiable fields from analytics events at the edge, before any data leaves the user's browser session.
Exported Functions
| Function | Signature | Returns | Description |
|---|---|---|---|
maskIpAddress |
(ip: string) → string | null |
string | null |
Masks an IPv4 address to A.B.***.*** form, or an IPv6 address by zeroing the suffix after the fourth group. Returns null for invalid or empty input; never throws. |
normaliseTargetType |
(raw: string) → string |
string |
Maps a raw DOM element type string to one of the allowed canonical types. Returns 'OTHER' for any unrecognised value. |
Allowed Target Type Set
| Canonical Value | Mapped From |
|---|---|
BUTTON | Button, submit, reset elements |
LINK | Anchor, area elements with href |
CODE | Code blocks, pre, copy-button interactions |
INPUT | Text input, textarea, select, checkbox |
NAVIGATION | Nav, sidebar, breadcrumb interactions |
OTHER | All unrecognised target types (fallback) |
Usage Example
import { maskIpAddress, normaliseTargetType } from './lib/privacy/network-identifiers.js';
// IP masking — run at the edge before logging
const masked = maskIpAddress(req.headers['x-forwarded-for']);
// IPv4 result: "203.0.***.***"
// IPv6 result: "2001:db8:0:1::"
// Target type normalisation — sanitise analytics events
const targetType = normaliseTargetType(event.target.tagName);
// Returns one of: BUTTON | LINK | CODE | INPUT | NAVIGATION | OTHER
Privacy Compliance Notes
- No raw IP addresses are stored or logged by the AMEVA ecosystem. All IP fields pass through
maskIpAddressbefore reaching any storage layer. - The target type allowlist prevents free-form DOM tag names (which may encode user-specific information) from entering the telemetry pipeline.
- This module contains no network calls, no side effects, and no persistent state. It is safe to import in both browser and Node.js environments.