% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/redaction.R
\name{redaction_strategy}
\alias{redaction_strategy}
\title{Configure redaction behavior}
\usage{
redaction_strategy(
  operator = c("replace", "mask", "hash", "drop", "keep"),
  replacement = "[REDACTED]",
  mask = "*",
  hash_algo = "sha256",
  hash_prefix = 12L
)
}
\arguments{
\item{operator}{One of \code{"replace"}, \code{"mask"}, \code{"hash"}, \code{"drop"}, or
\code{"keep"}.}

\item{replacement}{Replacement text used by \code{operator = "replace"}.}

\item{mask}{Single-character mask used by \code{operator = "mask"}.}

\item{hash_algo}{Digest algorithm passed to \code{\link[digest:digest]{digest::digest()}} for
\code{operator = "hash"}.}

\item{hash_prefix}{Number of digest characters to keep in hash labels.}
}
\value{
A \code{shieldr_redaction_strategy} object.
}
\description{
\code{redaction_strategy()} controls how scanner spans are rewritten in
\code{text_clean}. The default strategy preserves the original package behavior:
every matched span is replaced by \verb{[REDACTED]}.
}
\details{
Redaction only applies to findings that include \code{start} and \code{end} character
offsets. Regex rules and some semantic reviewer schemas can provide spans.
Function rules and synthetic findings can still change score and action, but
they do not rewrite text unless they include span metadata.

Supported operators:
\itemize{
\item \code{"replace"}: replace the span with \code{replacement}.
\item \code{"mask"}: replace each character in the span with \code{mask}.
\item \code{"hash"}: replace the span with a short deterministic digest label.
\item \code{"drop"}: remove the span.
\item \code{"keep"}: leave the span unchanged while still returning findings.
}

Hash redaction is deterministic for the same matched string and algorithm,
which can help link repeated values without storing the original secret.
It is not anonymization and should still be treated as sensitive metadata.
}
\examples{
scan_prompt(
  "Email neel@example.com",
  redaction = redaction_strategy("mask", mask = "*")
)

scan_prompt(
  "Email neel@example.com",
  redaction = redaction_strategy("hash")
)
}
