# MaskingSettings

**Kind**: interface | **Module**: [Insights](https://docs.interop.io/browser/reference/javascript/insights/index.md)

**Source**: https://docs.interop.io/browser/reference/javascript/insights/maskingsettings/index.html

How masked attribute values (`attributeSettings` entries with `mode: "mask"`) are keyed. A
masked value is HMAC-SHA-256 of the value under a secret: the same value masks to the same
string under the same secret, and nobody without the secret can hash their way back to it.
The mode says where the secret comes from - and so, across what the masked values stay
consistent.

## Properties

- **`logMaskingSecret`** (`boolean`, optional) default: `false`
  Whether `maskSecret` - the effective one, a generated one included - is logged with the
  settings on startup. Redacted by default: the secret is what keeps masked values private.
  Turn on to see a generated one, e.g. to resolve masked values by hand.
- **`mappingURL`** (`string`, optional)
  If set, every value masked for the first time (in the process, under the effective
  secret) is reported to this URL with a JSON `POST` - `{ "source": "<the value>",
  "masked": "<the masked value>" }` - so that a mapping service can resolve masked values
  back for whoever is entitled to. The request is fire-and-forget: the telemetry does not
  wait for it, and a failure is silent (the pair is reported again by the next process).
  Only the content type header is sent - the `headers` of the exporters are not - so the
  endpoint has to accept the request as is (`keepalive`, in a browser). A metric attribute
  hashed by `reduceModality` alone (an entry without a `mode`) is not a masked value, and
  is not reported. Two values that mask to the same string - a mask cut short by
  `reduceModality` - are reported as the two pairs they are. The request instrumentations
  do not trace these requests, as they do not trace the exports to the collector URLs
  (`ignoreTelemetryURLs`).

  The endpoint receives the original values: it is the re-identification table of the
  masked telemetry, and undoes the masking for whoever can read it - protect it accordingly
  (HTTPS, access control, retention).
- **`maskingMode`** (`"instance" | "process" | "stable"`, optional) default: `"stable" when `maskSecret` is set, "instance" otherwise`
  `"instance"`: masked values are consistent across the processes of one io.Insights
  instance - an io.Connect session - and differ between instances. The key is the
  `maskSecret` of the session: io.Connect Desktop generates one per session and hands it
  to the gateway and to the applications it starts, in their settings.

  `"process"`: a random secret per process - masked values are consistent within the process
  only, and cannot be reproduced.

  `"stable"`: `maskSecret` - masked values are consistent everywhere and forever, wherever
  the same secret is configured (from an environment variable, for instance).

  Without a `maskSecret`, `"instance"` and `"stable"` behave as `"process"`: masking is
  never keyed with something that could be reproduced.
- **`maskSecret`** (`string`, optional)
  The secret masked values are hashed with - of the `"stable"` and the `"instance"` modes.
  Once the library is built, the effective secret the mode resolved to.
