service

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler(svr *server.Server, cfg Config) error

func Register

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

Register registers the handler instance with a gRPC server.

Types

type APIsConfig

type APIsConfig struct {
	GRPC server.Config `yaml:"grpc" json:"grpc"`
}

Config represent application configuration

func (*APIsConfig) Validate

func (c *APIsConfig) Validate() error

type CertificateSigner

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

type ClientsConfig added in v2.4.0

type ClientsConfig struct {
	OpenTelemetryCollector otelClient.Config `yaml:"openTelemetryCollector" json:"openTelemetryCollector"`
}

func (*ClientsConfig) Validate added in v2.4.0

func (c *ClientsConfig) Validate() error

type Config

type Config struct {
	Log     log.Config    `yaml:"log" json:"log"`
	APIs    APIsConfig    `yaml:"apis" json:"apis"`
	Signer  SignerConfig  `yaml:"signer" json:"signer"`
	Clients ClientsConfig `yaml:"clients" json:"clients"`
}

func (Config) String

func (c Config) String() string

String return string representation of Config

func (*Config) Validate

func (c *Config) Validate() error

type RequestHandler

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

RequestHandler handles incoming requests.

func NewRequestHandler

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

NewRequestHandler factory for new RequestHandler.

func NewRequestHandlerFromConfig

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

func (*RequestHandler) SignCertificate

func (*RequestHandler) SignIdentityCertificate

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

type Service

type Service struct {
	*server.Server
}

func New

func New(ctx context.Context, config Config, logger log.Logger) (*Service, error)

type SignerConfig

type SignerConfig struct {
	KeyFile   string        `yaml:"keyFile" json:"keyFile" description:"file name of CA private key in PEM format"`
	CertFile  string        `yaml:"certFile" json:"certFile" description:"file name of CA certificate in PEM format"`
	ValidFrom string        `yaml:"validFrom" json:"validFrom" description:"format https://github.com/karrick/tparse"`
	ExpiresIn time.Duration `yaml:"expiresIn" json:"expiresIn"`
	HubID     string        `yaml:"hubID" json:"hubId"`
}

func (*SignerConfig) Validate

func (c *SignerConfig) Validate() error

Jump to

Keyboard shortcuts

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