# `Insider.Redaction.Credentials`
[🔗](https://github.com/hiivemarkets/insider/blob/v0.1.0/lib/insider/redaction/credentials.ex#L1)

Credential masking for values that leave the node.

Development data is anonymized before it reaches a developer machine, but a
development node still holds real provider credentials from its
environment. Every value an observer can read therefore passes this mask,
whatever else its disclosure profile allows:

- a non-empty value under a credential-named key (`password`, `secret`,
  `token`, `api_key`, `authorization`, `cookie`, `private_key`, and similar,
  matched case-insensitively within the key) becomes
  `"[REDACTED:credential_key]"`, whatever its type;
- a secret-shaped span inside a string (an HTTP `Bearer` or `Basic`
  credential, a JWT, a PEM block, a well-known provider key format such as
  `sk_live_…`, the password in a URL, the value of a `password=…` style
  assignment, or a long high-entropy token) becomes `"[REDACTED:<reason>]"`
  and the rest of the string stays readable.

`mask/1` returns one manifest record per masked path and reason, with a
count and never the value.

# `credential_key?`

```elixir
@spec credential_key?(term()) :: boolean()
```

Whether `key` names a credential. Binary and atom keys are checked; any
other term is not a credential name.

# `mask`

```elixir
@spec mask(term()) :: {term(), [map()]}
```

Masks a plain, JSON-compatible value (string-keyed maps, lists, and
scalars) and returns it with its manifest records.

Each record is `%{"action" => "mask", "count", "path", "policy_id",
"reason"}`. `path` uses `key:` and `index:` segments, at most eight. A
marker already present in a string (from masking at capture) is reported
as well. At most 32 records are returned: beyond that, paths are cut short
and counts summed, so every reason stays visible.

# `mask_text`

```elixir
@spec mask_text(String.t()) :: String.t()
```

Replaces every secret-shaped span of `text` with `"[REDACTED:<reason>]"`.

# `policy_id`

```elixir
@spec policy_id() :: String.t()
```

The masking policy id carried by every mask record.

# `reasons`

```elixir
@spec reasons() :: [String.t()]
```

Every reason a mask record or marker can carry.

# `warm`

```elixir
@spec warm() :: :ok
```

Compiles the masking patterns once for this module version, so a later
caller with a time budget does not pay for it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
