Help us shape the future of Go! Take the 2026 Go Developer Survey

redact

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package redact removes secrets from text before it is persisted (SPEC-ADDITIONS §18.4): the sleep consolidation cycle harvests arc history and stages guiding text that can carry credentials, so every staged string passes through here first. Detection is offloaded to betterleaks' maintained ruleset — this package is only the thin wrapper that replaces each detected secret with a placeholder.

Index

Constants

View Source
const Placeholder = "[REDACTED]"

Placeholder replaces a detected secret in redacted text.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redactor

type Redactor struct {
	// contains filtered or unexported fields
}

Redactor detects and removes secrets using betterleaks' embedded default ruleset. Build one with New and reuse it; Redact holds no per-call state.

func New

func New() (*Redactor, error)

New builds a Redactor over betterleaks' default ruleset. The detector is constructed once (it compiles the embedded rules); reuse the Redactor.

func (*Redactor) Redact

func (r *Redactor) Redact(text string) string

Redact replaces every detected secret in text with Placeholder, returning text unchanged when nothing is detected. It replaces the matched secret value, so the surrounding context (e.g. the key name) is preserved for a reader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL