rest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AliasPath = "/{" + aliasVarName + "}"

	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         = AliasPath + "/.well-known/webfinger"
	AddContextPath        = basePath + "/context/add"
	HealthCheckPath       = "/healthcheck"
)

API endpoints.

Variables

This section is empty.

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
	AddLdContext(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) *Operation

New returns REST API controller.

func (*Operation) AddLdContext added in v0.1.2

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

AddLdContext adds jsonld context.

func (*Operation) AddVC

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

AddVC adds verifiable credential to log.

func (*Operation) GetEntries

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

GetEntries retrieves entries from log.

func (*Operation) GetEntryAndProof

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

GetEntryAndProof retrieves entry and merkle audit proof from log.

func (*Operation) GetIssuers

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

GetIssuers returns issuers.

func (*Operation) GetProofByHash

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

GetProofByHash retrieves Merkle Audit proof from Log by leaf hash.

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 retrieves latest signed tree head.

func (*Operation) GetSTHConsistency

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

GetSTHConsistency retrieves merkle consistency proofs between signed tree heads.

func (*Operation) HealthCheck

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

HealthCheck returns status.

func (*Operation) Webfinger added in v0.1.2

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

Webfinger returns discovery info.

Jump to

Keyboard shortcuts

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