# `Reminisce.SecretGuard`
[🔗](https://github.com/NoeticEcho/reminisce-elixir/blob/v0.6.0/lib/reminisce/secret_guard.ex#L4)

The built-in secret guard: refuses a secret at the door.

Every text the library is about to store goes through `scan/1` first —
content, facets, sources, reasons, subjects and keys. A hit refuses the whole
write as `{:error, {:secret, rule_id}}`, writes nothing, and emits
`[:reminisce, :guard, :refused]` telemetry carrying the rule id and **no
text**.

The rules follow the shapes of gitleaks' default rule families: private-key
headers, cloud keys (AWS, GCP, Azure), forge and chat tokens (GitHub, GitLab,
Slack), payment keys (Stripe, Square), JWTs, package-registry tokens, AI
provider keys, and generic `password=` / `token=` assignments carrying a
high-entropy value. Most rules are derived from gitleaks 8.28.0 (MIT);
NOTICE names them and the licence.

**What it cannot do:** a scanner finds shapes, not intent. A secret in a shape
it does not know gets through. The host's `Reminisce.Policy` is the second
line.

# `rule_ids`

The rule ids, for documentation and tests.

# `scan`

```elixir
@spec scan(String.t()) :: :ok | {:secret, atom()}
```

Scans one text. `:ok`, or `{:secret, rule_id}` for the first rule that hits.

# `scan_all`

```elixir
@spec scan_all(term()) :: :ok | {:secret, atom()}
```

Scans every string inside a term (maps, lists, tuples).

---

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