secret

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 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 wraps sensitive strings to prevent accidental logging or serialization.

Index

Constants

This section is empty.

Variables

View Source
var ErrSecretNotFound = errors.New("secret not found in environment or /run/secrets/")

Functions

This section is empty.

Types

type String

type String string

String wraps a sensitive value. Use Unwrap() to access the actual value.

func Resolve

func Resolve(ctx context.Context, key string) (String, error)

Resolve looks for the secret value in a context-aware manner.

func (String) MarshalJSON

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

MarshalJSON prevents secrets from leaking in API responses.

func (String) String

func (s String) String() string

String implements fmt.Stringer — never reveals the value in logs.

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(b []byte) error

UnmarshalJSON allows secrets to be loaded from config files / payloads.

func (String) Unwrap

func (s String) Unwrap() string

Jump to

Keyboard shortcuts

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