rest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AliasPath             = "/{" + aliasVarName + "}"
	BasePath              = AliasPath + "/v1"
	AddVCPath             = BasePath + "/add-vc"
	GetSTHPath            = BasePath + "/get-sth"
	GetSTHConsistencyPath = BasePath + "/get-sth-consistency"
	GetProofByHashPath    = BasePath + "/get-proof-by-hash"
	GetEntriesPath        = BasePath + "/get-entries"
	GetIssuersPath        = BasePath + "/get-issuers"
	GetEntryAndProofPath  = BasePath + "/get-entry-and-proof"
	WebfingerPath         = "/.well-known/webfinger"
	HealthCheckPath       = "/healthcheck"
	MetricsPath           = "/metrics"
)

API endpoints.

Variables

View Source
var (

	// BuildVersion contains the version of the VCT build.
	//nolint:gochecknoglobals
	BuildVersion string
)

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	AddVC(io.Writer, io.Reader) error
	GetIssuers(io.Writer, io.Reader) error
	GetSTH(io.Writer, io.Reader) error
	GetSTHConsistency(io.Writer, io.Reader) error
	GetProofByHash(io.Writer, io.Reader) error
	GetEntries(io.Writer, io.Reader) error
	GetEntryAndProof(io.Writer, io.Reader) error
	Webfinger(io.Writer, io.Reader) error
}

Cmd defines command methods.

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse represents REST error message.

type HTTPHandler

type HTTPHandler struct {
	// contains filtered or unexported fields
}

HTTPHandler contains REST API handling details which can be used to build routers for http requests for given path.

func NewHTTPHandler

func NewHTTPHandler(path, method string, handle http.HandlerFunc) *HTTPHandler

NewHTTPHandler returns instance of HTTPHandler which can be used handle http requests.

func (*HTTPHandler) Handle

func (h *HTTPHandler) Handle() http.HandlerFunc

Handle returns http request handle func.

func (*HTTPHandler) Method

func (h *HTTPHandler) Method() string

Method returns http request method type.

func (*HTTPHandler) Path

func (h *HTTPHandler) Path() string

Path returns http request path.

type Handler

type Handler interface {
	Path() string
	Method() string
	Handle() http.HandlerFunc
}

Handler http handler for each controller API endpoint.

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

Operation represents REST API controller.

func New

func New(cmd Cmd, db db, keyManager keyManager, mf monitoring.MetricFactory) *Operation

New returns REST API controller.

func (*Operation) AddVC

func (c *Operation) AddVC(w http.ResponseWriter, r *http.Request)

AddVC swagger:route POST /{alias}/v1/add-vc vct addVCRequest

Adds verifiable credential to log.

Responses:

default: genericError
200: addVCResponse

func (*Operation) GetEntries

func (c *Operation) GetEntries(w http.ResponseWriter, r *http.Request)

GetEntries swagger:route GET /{alias}/v1/get-entries vct getEntriesRequest

Retrieves entries from log.

Responses:

default: genericError
    200: getEntriesResponse

func (*Operation) GetEntryAndProof

func (c *Operation) GetEntryAndProof(w http.ResponseWriter, r *http.Request)

GetEntryAndProof swagger:route GET /{alias}/v1/get-entry-and-proof vct getEntryAndProofRequest

Retrieves entry and merkle audit proof from log.

Responses:

default: genericError
    200: getEntryAndProofResponse

func (*Operation) GetIssuers

func (c *Operation) GetIssuers(w http.ResponseWriter, r *http.Request)

GetIssuers swagger:route GET /{alias}/v1/get-issuers vct getIssuersRequest

Returns issuers.

Responses:

default: genericError
    200: getIssuersResponse

func (*Operation) GetProofByHash

func (c *Operation) GetProofByHash(w http.ResponseWriter, r *http.Request)

GetProofByHash swagger:route GET /{alias}/v1/get-proof-by-hash vct getProofByHashRequest

Retrieves Merkle Audit proof from Log by leaf hash.

Responses:

default: genericError
    200: getProofByHashResponse

func (*Operation) GetRESTHandlers

func (c *Operation) GetRESTHandlers() []Handler

GetRESTHandlers returns list of all handlers supported by this controller.

func (*Operation) GetSTH

func (c *Operation) GetSTH(w http.ResponseWriter, r *http.Request)

GetSTH swagger:route GET /{alias}/v1/get-sth vct getSTHRequest

Retrieves the latest signed tree head.

Responses:

default: genericError
    200: getSTHResponse

func (*Operation) GetSTHConsistency

func (c *Operation) GetSTHConsistency(w http.ResponseWriter, r *http.Request)

GetSTHConsistency swagger:route GET /{alias}/v1/get-sth-consistency vct getSTHConsistencyRequest

Retrieves merkle consistency proofs between signed tree heads.

Responses:

default: genericError
    200: getSTHConsistencyResponse

func (*Operation) HealthCheck

func (c *Operation) HealthCheck(rw http.ResponseWriter, _ *http.Request)

HealthCheck swagger:route GET /healthcheck vct healthCheckRequest

Returns health check status.

Responses:

default: genericError
    200: healthCheckResponse

func (*Operation) Webfinger added in v0.1.2

func (c *Operation) Webfinger(w http.ResponseWriter, r *http.Request)

Webfinger swagger:route GET /.well-known/webfinger vct webfingerRequest

Returns discovery info.

Responses:

default: genericError
    200: webfingerResponse

Jump to

Keyboard shortcuts

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