factory

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTypeRSA = iota
	KeyTypeECURVE
	KeyTypeED25519
)
View Source
const Version = "0.2.16"

Variables

View Source
var ErrInvalidCertificate = errors.New("invalid certificate")

ErrInvalidCertificate is returned when an invalid certificate is supplied.

Functions

func CertificateIssuerHash added in v0.2.15

func CertificateIssuerHash(certFile string) (string, error)

func CertificateSubjectHash added in v0.2.15

func CertificateSubjectHash(certFile string) (string, error)

func CheckErr added in v0.2.1

func CheckErr(err error)

func CobraAddCommand added in v0.2.1

func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)

func CobraInit added in v0.2.1

func CobraInit(cobraRootCmd CobraCommand)

func ConfigDir added in v0.2.12

func ConfigDir() string

func ConfigEdit added in v0.2.1

func ConfigEdit()

func ConfigInit added in v0.2.1

func ConfigInit(allowClobber bool) string

func ConfigString added in v0.2.1

func ConfigString(header bool) string

func Confirm added in v0.2.1

func Confirm(prompt string) bool

func Expand added in v0.2.1

func Expand(value string) string

func Fatal added in v0.2.1

func Fatal(err error) error

func Fatalf added in v0.2.1

func Fatalf(format string, args ...interface{}) error

func FormatJSON added in v0.2.1

func FormatJSON(v any) string

func FormatYAML added in v0.2.10

func FormatYAML(value any) string

func HexDump added in v0.2.1

func HexDump(data []byte) string

func Init added in v0.2.1

func Init(name, version, configFile string)

func IsDir added in v0.2.1

func IsDir(path string) bool

func IsFile

func IsFile(pathname string) bool

func OptionInt added in v0.2.4

func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)

func OptionKey added in v0.2.1

func OptionKey(cobraCmd CobraCommand, key string) string

func OptionString added in v0.2.1

func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)

func OptionSwitch added in v0.2.1

func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)

func ProgramName added in v0.2.1

func ProgramName() string

func ProgramVersion added in v0.2.1

func ProgramVersion() string

func ReadCertificate added in v0.2.15

func ReadCertificate(certFile string) (*x509.Certificate, error)

func Shutdown added in v0.2.1

func Shutdown()

func TildePath added in v0.2.1

func TildePath(path string) (string, error)

func ViperGet added in v0.2.1

func ViperGet(key string) any

func ViperGetBool added in v0.2.1

func ViperGetBool(key string) bool

func ViperGetInt added in v0.2.1

func ViperGetInt(key string) int

func ViperGetInt64 added in v0.2.1

func ViperGetInt64(key string) int64

func ViperGetString added in v0.2.1

func ViperGetString(key string) string

func ViperGetStringMapString added in v0.2.1

func ViperGetStringMapString(key string) map[string]string

func ViperGetStringSlice added in v0.2.1

func ViperGetStringSlice(key string) []string

func ViperKey added in v0.2.1

func ViperKey(key string) string

func ViperSet added in v0.2.1

func ViperSet(key string, value any)

func ViperSetDefault added in v0.2.1

func ViperSetDefault(key string, value any)

func Warning added in v0.2.1

func Warning(format string, args ...interface{})

Types

type APIClient added in v0.2.1

type APIClient interface {
	Close()
	Get(path string, response interface{}) (string, error)
	Post(path string, request, response interface{}, headers *map[string]string) (string, error)
	Put(path string, request, response interface{}, headers *map[string]string) (string, error)
	Delete(path string, response interface{}) (string, error)
}

func NewAPIClient added in v0.2.1

func NewAPIClient(prefix, url, certFile, keyFile, caFile string, headers *map[string]string) (APIClient, error)

type CertFactory

type CertFactory struct {
	Version            string
	Debug              bool
	Verbose            bool
	Raw                bool
	TTY                bool
	Overwrite          bool
	StepBinary         string
	DefaultDuration    string
	StepTimeoutSeconds int64
	StepArgs           []string
	KeyType            KeyType
	PasswordFile       string
	Issuer             string
	Fingerprint        string
	CaURL              string
	RootCA             string
	ConfigDir          string
	CacheDir           string
}

func NewCertFactory

func NewCertFactory(stepArgs *[]string) (*CertFactory, error)

func (*CertFactory) CertificatePair

func (c *CertFactory) CertificatePair(subjectName, duration, certFile, keyFile string) (string, string, error)

func (*CertFactory) Chain

func (c *CertFactory) Chain(pathname string) (string, error)

func (*CertFactory) Intermediate added in v0.1.9

func (c *CertFactory) Intermediate(pathname string) (string, error)

func (*CertFactory) Root

func (c *CertFactory) Root(pathname string) (string, error)

func (*CertFactory) SetKeyType

func (c *CertFactory) SetKeyType(keyType KeyType)

type CobraCommand added in v0.2.1

type CobraCommand interface {
}

type KeyType

type KeyType int

type KeymasterConfig added in v0.2.10

type KeymasterConfig struct {
	Hostname string
	Port     int
	Path     string
	Subject  string
	Issuer   string
}

type Sendmail added in v0.2.1

type Sendmail interface {
	Send(to, from, subject string, body []byte) error
}

func NewSendmail added in v0.2.1

func NewSendmail(hostname string, port int, username, password, CAFile string) (Sendmail, error)

type StepConfig added in v0.2.6

type StepConfig struct {
	URL         string //json: `"ca_url"`
	Fingerprint string //json: `"fingerprint"`
	Root        string //json: `"root"`
}

type SubjHash added in v0.2.15

type SubjHash [4]byte

SubjHash is the certificate hash with fmt.Stringer interface support.

func IssuerHash added in v0.2.15

func IssuerHash(cert *x509.Certificate) (SubjHash, error)

Issuer takes a *x509.Certificate and returns the openssl 1.0.1+ compatible issuer_hash for the certificate.

func SubjectHash added in v0.2.15

func SubjectHash(cert *x509.Certificate) (SubjHash, error)

Subject takes a *x509.Certificate and returns the openssl 1.0.1+ compatible subject_hash for the certificate.

func (SubjHash) String added in v0.2.15

func (s SubjHash) String() string

Jump to

Keyboard shortcuts

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