secret

package
v0.50.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package secret makes accidental formatting/serialization of credentials safe. It does not promise memory erasure or protect values explicitly revealed by application code for use with an external client.

Index

Constants

View Source
const Redacted = "[REDACTED]"

Variables

This section is empty.

Functions

This section is empty.

Types

type String

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

String holds a sensitive string. Only Reveal returns the original value.

func New

func New(value string) String

New wraps a string as a secret.

func (String) GoString

func (s String) GoString() string

GoString returns the redaction marker.

func (String) IsZero

func (s String) IsZero() bool

IsZero reports whether the underlying secret is empty.

func (String) LogValue

func (s String) LogValue() slog.Value

LogValue returns the redaction marker for logging.

func (String) MarshalJSON

func (s String) MarshalJSON() ([]byte, error)

MarshalJSON encodes the redaction marker as JSON.

func (String) MarshalText

func (s String) MarshalText() ([]byte, error)

MarshalText encodes the redaction marker as text.

func (String) Reveal

func (s String) Reveal() string

Reveal returns the underlying unredacted string.

func (String) String

func (s String) String() string

String returns the redaction marker.

func (*String) UnmarshalText

func (s *String) UnmarshalText(data []byte) error

UnmarshalText replaces the secret with the supplied text.

Jump to

Keyboard shortcuts

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