AMEVA Privacy Utilities

Network identifier masking, IP anonymisation, and privacy-preserving telemetry

License Runtime Status
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:

  1. 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.
  2. 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.
  3. Telemetry scrubbing — strips personally identifiable fields from analytics events at the edge, before any data leaves the user's browser session.

Exported Functions

FunctionSignatureReturnsDescription
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 ValueMapped From
BUTTONButton, submit, reset elements
LINKAnchor, area elements with href
CODECode blocks, pre, copy-button interactions
INPUTText input, textarea, select, checkbox
NAVIGATIONNav, sidebar, breadcrumb interactions
OTHERAll 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