redact

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package redact detecta y enmascara secretos (API keys, tokens, claves privadas) antes de que el contenido salga de la máquina vía `nem sync`. Es secure-by-default: el scrubbing corre siempre en la exportación a git.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option configura el Redactor.

func WithPattern

func WithPattern(kind, pattern string) Option

WithPattern agrega un detector propio (kind + regex). Útil para secretos específicos de un usuario/empresa.

func WithoutBuiltins

func WithoutBuiltins() Option

WithoutBuiltins desactiva los detectores por defecto (solo se usan los propios).

type Redactor

type Redactor interface {
	// Redact devuelve el texto saneado y el conteo de secretos encontrados.
	Redact(s string) Result
}

Redactor enmascara secretos en texto.

func New

func New(options ...Option) (Redactor, error)

New crea un Redactor con los detectores por defecto más los configurados.

type Result

type Result struct {
	Text   string
	Counts map[string]int
}

Result es el texto saneado más el conteo de secretos por tipo.

func (Result) Summary

func (r Result) Summary() string

Summary devuelve un resumen ordenado tipo "2 openai-key, 1 aws-key".

func (Result) Total

func (r Result) Total() int

Total devuelve la cantidad total de secretos redactados.

Jump to

Keyboard shortcuts

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