secrets

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

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