redaction

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package redaction provides utilities for redacting sensitive information in logs, error messages, and other outputs to protect privacy and comply with data protection regulations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact(sensitive string) string

Redact redacts sensitive information for logging and output purposes. Shows the first 3 characters when the string has more than 5 characters, otherwise shows asterisks for shorter strings.

Examples:

  • Redact("") → ""
  • Redact("ab") → "**"
  • Redact("abc") → "a****"
  • Redact("johndoe123") → "joh****"

func RedactEmail

func RedactEmail(email string) string

RedactEmail redacts email addresses for logging and output purposes. Shows the first 3 characters of the local part and keeps the full domain visible for debugging purposes.

Examples:

  • RedactEmail("") → ""
  • RedactEmail("a@example.com") → "**@example.com"
  • RedactEmail("john@example.com") → "j****@example.com"
  • RedactEmail("johndoe@company.com") → "joh****@company.com"
  • RedactEmail("invalid-email") → "inv****" (falls back to Redact)

Types

This section is empty.

Jump to

Keyboard shortcuts

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