service

package
v0.0.0-...-9e6195f Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

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