secret

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Secret

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

Secret wraps sensitive string values like passwords to prevent accidental exposure in logs, debug output, or error messages. The underlying value is kept private and masked when formatted or printed.

func New

func New(value string) Secret

New creates a new Secret from a string value.

func (Secret) GoString

func (s Secret) GoString() string

GoString returns a masked representation for Go's %#v format. This prevents exposure when using fmt.Printf with the %#v verb.

func (Secret) MarshalJSON

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

MarshalJSON serializes the secret as a plain JSON string. The actual value is preserved during serialization for API communication.

func (Secret) String

func (s Secret) String() string

String returns a masked representation of the secret. This prevents accidental exposure in logs and debug output.

func (*Secret) UnmarshalJSON

func (s *Secret) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a JSON string into the secret.

func (Secret) Value

func (s Secret) Value() string

Value returns the underlying secret value as a string.

Jump to

Keyboard shortcuts

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