secret

package
v0.17.0-beta06 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: AGPL-3.0 Imports: 3 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[T any] struct {
	// contains filtered or unexported fields
}

Secret define a wrapper of T to prevent unwanted exposure of a secret (in logs for example).

func New

func New[T any](secret T) Secret[T]

New wrapps the given secret in Secret type and returns it.

func (Secret[T]) ExposeSecret

func (s Secret[T]) ExposeSecret() T

ExposeSecret returns the underlying secret. It is best practice to never store the secret and expose it only when needed.

func (Secret[T]) MarshalJSON added in v0.15.0

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

MarshalJSON implements json.Marshaler.

func (*Secret[T]) Scan

func (s *Secret[T]) Scan(src any) error

Scan implements sql.Scanner.

func (Secret[T]) String

func (s Secret[T]) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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