secret

package
v0.3.3 Latest Latest
Warning

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

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

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