api

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResponseCodeOK sent when OTP is successfully pass all checks.
	ResponseCodeOK = "OK"

	// ResponseCodeBadOTP sent when OTP does not pass validity checks.
	ResponseCodeBadOTP = "BAD_OTP"

	// ResponseCodeReplayedOTP sent when OTP in request is already seen before.
	ResponseCodeReplayedOTP = "REPLAYED_OTP"

	// ResponseCodeDelayedOTP is sent when OTP timestamp is delayed.
	ResponseCodeDelayedOTP = "DELAYED_OTP"

	// ResponseCodeBadSignature is sent when HMAC signature is invalid.
	ResponseCodeBadSignature = "BAD_SIGNATURE"

	// ResponseCodeMissingParameter is sent when request missing some mandatory params.
	ResponseCodeMissingParameter = "MISSING_PARAMETER"

	// ResponseCodeNoSuchClient is sent when client is not found.
	ResponseCodeNoSuchClient = "NO_SUCH_CLIENT"

	// ResponseCodeOperationNotAllowed is sent when check operation is not allowed.
	ResponseCodeOperationNotAllowed = "OPERATION_NOT_ALLOWED"

	// ResponseCodeBackendError is sent when backend has errors.
	ResponseCodeBackendError = "BACKEND_ERROR"

	// ResponseCodeNotEnoughAnswers is sent where there is no quorum on check servers.
	ResponseCodeNotEnoughAnswers = "NOT_ENOUGH_ANSWERS"

	// ResponseCodeReplayedRequest is sent when request is replayed.
	ResponseCodeReplayedRequest = "REPLAYED_REQUEST"
)

Variables

View Source
var Module = module.Module{
	{Constructor: newAPIService, Options: []dig.ProvideOption{dig.Group("services")}},
}

Module api constructor nolint:gochecknoglobals

Functions

func Defaults

func Defaults(ctx *cli.Context, v *viper.Viper) error

Defaults for storage service.

Types

type Service

type Service struct {
	Users common.OTPUsers
	// contains filtered or unexported fields
}

Service represents API service.

func (*Service) Name

func (s *Service) Name() string

Name of the API service.

func (*Service) Printf

func (s *Service) Printf(format string, args ...interface{})

Printf function for HTTP debug log.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start API service.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context)

Stop API service.

func (*Service) Watchdog

func (s *Service) Watchdog(ctx context.Context)

Watchdog for systemd keepalive responses.

type TestResponseParams

type TestResponseParams struct {
	Result string
}

TestResponseParams used for report test result.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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