service

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 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 AddHandler

func AddHandler(svr *kitNetGrpc.Server, cfg SignerConfig) error

func Register

func Register(server *grpc.Server, handler *RequestHandler)

Register registers the handler instance with a gRPC server.

Types

type CertificateSigner

type CertificateSigner interface {
	//csr is encoded by PEM and returns PEM
	Sign(ctx context.Context, csr []byte) ([]byte, error)
}

type RequestHandler

type RequestHandler struct {
	ValidFrom   func() time.Time
	ValidFor    time.Duration
	Certificate []*x509.Certificate
	PrivateKey  crypto.PrivateKey
}

RequestHandler handles incoming requests.

func NewRequestHandler

func NewRequestHandler(
	ValidFrom func() time.Time,
	ValidFor time.Duration,
	Certificate []*x509.Certificate,
	PrivateKey crypto.PrivateKey) *RequestHandler

NewRequestHandler factory for new RequestHandler.

func NewRequestHandlerFromConfig

func NewRequestHandlerFromConfig(cfg SignerConfig) (*RequestHandler, error)

func (*RequestHandler) SignCertificate

func (*RequestHandler) SignIdentityCertificate

func (r *RequestHandler) SignIdentityCertificate(ctx context.Context, req *pb.SignCertificateRequest) (*pb.SignCertificateResponse, error)

type SignerConfig

type SignerConfig struct {
	Certificate   string           `envconfig:"CERTIFICATE"`
	PrivateKey    string           `envconfig:"PRIVATE_KEY"`
	ValidFrom     ValidFromDecoder `envconfig:"VALID_FROM" default:"now"`
	ValidDuration time.Duration    `envconfig:"VALID_DURATION" default:"87600h"`
}

type ValidFromDecoder

type ValidFromDecoder func() time.Time

func (*ValidFromDecoder) Decode

func (d *ValidFromDecoder) Decode(value string) error

Jump to

Keyboard shortcuts

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