secrets

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 3 modules, 2 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNotTextFileError

func NewNotTextFileError(path string) error

Types

type DetectedSecret

type DetectedSecret struct {
	// Type is the type of the detector that detected the secret
	Type string
	// Key is the key of the detected secret.
	// Key can be empty if a secret was detected without one.
	Key string
	// Value is the value of the detected secret
	Value string
}

DetectedSecret represents a secret detected by the engine.

type Detector

type Detector interface {
	// Scan scans secrets from the given string.
	// Input structure is unexpected, and may contain multiple secrets.
	Scan(in string) ([]DetectedSecret, error)
	// ScanMap scans secrets from the given key-value pairs.
	ScanMap(keyValueMap map[string]string) ([]DetectedSecret, error)
	// SecretType returns a human-readable string that describes the type of secret that is detected by this Detector.
	// This string should be returned as DetectedSecret.Type when detecting a secret.
	SecretType() string
}

type DetectorFactory

type DetectorFactory interface {
	Register(name string, initMethod func(config ...string) Detector) error
	Create(names []string, detectorConfigs map[string][]string) (detectors []Detector, missing []string)
}

func GetDetectorFactory

func GetDetectorFactory() DetectorFactory

type NotTextFileError

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

func (*NotTextFileError) Error

func (err *NotTextFileError) Error() string

type Scanner

type Scanner interface {
	ScanFile(path string) ([]DetectedSecret, error)
	ScanFileReader(in io.Reader, path string, size int64) ([]DetectedSecret, error)
	ScanWithFormat(in io.Reader, format dataformat.DataFormat) ([]DetectedSecret, error)
	ScanStringWithFormat(inStr string, format dataformat.DataFormat) ([]DetectedSecret, error)
	ScanReader(in io.Reader) ([]DetectedSecret, error)
	Scan(in string) ([]DetectedSecret, error)
}

type Transformer

type Transformer interface {
	Transform(in string) (map[string]string, bool)
	SupportedFormats() []dataformat.DataFormat
	SupportFiles() bool
}

type TransformerFactory

type TransformerFactory interface {
	Register(name string, initMethod func() Transformer) error
	Create(names []string) (transformers []Transformer, missing []string)
}

func GetTransformerFactory

func GetTransformerFactory() TransformerFactory

Jump to

Keyboard shortcuts

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