integrity

package module
v0.0.0-...-831c211 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const HashesFileName = ""

HashesFileName is a name of a file containing file hashes that require checking.

Variables

View Source
var ErrNotConfigured = errors.New("integrity check is not configured")

ErrNotConfigured is reported when integrity check is not configured in the command context.

Functions

func GetCheckFunction

func GetCheckFunction(ctx IntegrityCtx) (
	func(data []byte, hashes map[string][]byte, sign []byte) error, error,
)

GetCheckFunction returns a function that checks a map of hashes and a signature of a data.

func GetSignFunction

func GetSignFunction(privateKeyPath string) (
	func(data []byte) (map[string][]byte, []byte, error), error,
)

GetSignFunction returns a function that creates a map of hashes and a signature for a data for the private key in the path.

func RegisterIntegrityCheckFlag

func RegisterIntegrityCheckFlag(flagset *pflag.FlagSet, dst *string)

RegisterIntegrityCheckFlag is a noop function that is intended to add root flag enabling integrity checks.

func RegisterIntegrityCheckPeriodFlag

func RegisterIntegrityCheckPeriodFlag(flagset *pflag.FlagSet, dst *int)

RegisterIntegrityCheckPeriodFlag is a noop function that is intended to add flag specifying how often should integrity checks run in watchdog.

func RegisterWithIntegrityFlag

func RegisterWithIntegrityFlag(flagset *pflag.FlagSet, dst *string)

RegisterWithIntegrityFlag is a noop function that is intended to add flags to `tt pack` command.

Types

type IntegrityCtx

type IntegrityCtx struct {
	// Repository is a repository used to check integrity of files.
	Repository Repository
}

IntegrityCtx is context required for integrity checks.

func InitializeIntegrityCheck

func InitializeIntegrityCheck(publicKeyPath, configDir string) (IntegrityCtx, error)

InitializeIntegrityCheck is a noop setup of integrity checking.

type Repository

type Repository interface {
	// Read makes sure the file is not modified and reads it.
	Read(path string) (io.ReadCloser, error)
	// ValidateAll checks that all the files stored in the repository
	// were not modified.
	ValidateAll() error
}

Repository provides utilities for working with files and ensuring that they were not compromised.

type Signer

type Signer interface {
	// Sign generates data to sign a package.
	Sign(basePath string, appNames []string) error
}

Signer implements high-level API for package signing.

func NewSigner

func NewSigner(path string) (Signer, error)

NewSigner constructs a noop Signer.

Jump to

Keyboard shortcuts

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