← nopea.tech
ScaneaConsenteaMaskeaBundlesPricing
Secrets & PII

Block a call outright if it contains a secret

secrets({ mode: "block" }) throws instead of masking -- for pipelines where a leaked key means the call should never go out at all.

← All recipes
import { Maskea, secrets } from "@nopeatech/maskea";
import OpenAI from "openai";

const openai = new OpenAI();

const maskea = new Maskea().use(
  secrets({ mode: "block" })
);

const chat = maskea.wrap(
  openai.chat.completions.create.bind(openai.chat.completions)
);

// Throws before any network call is made if the prompt contains
// something that looks like an API key, JWT, or bearer token.

Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.

More in Secrets & PII

Only scan for the PII types you actually handle →