redact

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package redact provides common helpers for masking sensitive values in log output. It is internal because the redaction policy is not part of Fiber's public API.

Index

Constants

View Source
const (
	// MinLength is the inclusive lower bound on input length for which the
	// redacted form keeps a leading clear-text prefix. Values shorter than
	// this are fully masked. Eight bytes is enough that a 4-byte prefix
	// never reveals more than half of a typical opaque token.
	MinLength = 8
	// PrefixLength is the number of leading bytes kept when the input is at
	// least MinLength long.
	PrefixLength = 4
	// Mask is appended after the visible prefix (or returned alone when the
	// input is too short to keep a prefix).
	Mask = "****"
)

Variables

This section is empty.

Functions

func Prefix

func Prefix(value string) string

Prefix returns a redacted form of value. Empty input is returned unchanged. Inputs shorter than MinLength are fully masked. Inputs at least MinLength long return the leading PrefixLength bytes followed by Mask. Operations are byte-wise; callers must not feed user-controlled UTF-8 they intend to truncate by rune boundaries.

Types

This section is empty.

Jump to

Keyboard shortcuts

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