httphandlers

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenIDParam is the parameter name for the vehicle token id.
	TokenIDParam = "tokenId"

	// StatusGroupParam is the parameter name for the status group.
	StatusGroupParam = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPController added in v0.0.6

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

HTTPController handles VIN VC-related http requests.

func NewVCController

func NewVCController(vinService VINVCService, pomService POMVCService, telemetryURL string) (*HTTPController, error)

NewVCController creates a new http VCController.

func (*HTTPController) GetJSONLDDoc added in v0.0.6

func (v *HTTPController) GetJSONLDDoc(fiberCtx *fiber.Ctx) error

@Summary Get JSON-LD document @Description Returns the JSON-LD document for all VC types. @Tags VINVC @Accept json @Produce json @Success 200 {object} json.RawMessage @Router /v1/vc/context [get]

func (*HTTPController) GetPOMVC added in v0.0.6

func (v *HTTPController) GetPOMVC(fiberCtx *fiber.Ctx) error

@Summary Create POM VC @Description Create a Proof of Movement VC for a given token Id of a vehicle NFT. @Tags VINVC @Accept json @Produce json @Param tokenId path int true "token Id of the vehicle NFT" @Success 200 {object} getVCResponse @Security BearerAuth @Router /v1/vc/pom/{tokenId} [post]

func (*HTTPController) GetPublicKeyDoc added in v0.0.6

func (v *HTTPController) GetPublicKeyDoc(fiberCtx *fiber.Ctx) error

@Summary Get verification control document @Description Returns the public key document for verifying VCs. @Tags VINVC @Accept json @Produce json @Success 200 {object} verifiable.VerificationControlDocument @Router /v1/vc/keys [get]

func (*HTTPController) GetVCStatus added in v0.0.6

func (v *HTTPController) GetVCStatus(fiberCtx *fiber.Ctx) error

@Summary Get VC Status @Description Get the VC status for a given status group (currently this is just the vehcilesTokenId) @Tags VINVC @Accept json @Produce json @Param group path int true "status list group" @Success 200 {object} verifiable.Credential @Router /v1/vc/status/{group} [get]

func (*HTTPController) GetVINVC added in v0.0.6

func (v *HTTPController) GetVINVC(fiberCtx *fiber.Ctx) error

@Summary Get VIN VC @Description Get the VIN VC for a given token Id of a vehicle NFT. If a unexpired VC is not found, a new VC is generated. @Tags VINVC @Accept json @Produce json @Param tokenId path int true "token Id of the vehicle NFT" @Param force query bool false "force generation of a new VC even if an unexpired VC exists" @Success 200 {object} getVCResponse @Security BearerAuth @Router /v1/vc/vin/{tokenId} [post]

func (*HTTPController) GetVocabDoc added in v0.0.6

func (v *HTTPController) GetVocabDoc(fiberCtx *fiber.Ctx) error

@Summary Get vocabulary document @Description Returns the vocabulary document for all VC types. @Tags VINVC @Accept json @Produce html @Success 200 {string} string @Router /v1/vc/context/vocab [get]

type POMVCService added in v0.0.6

type POMVCService interface {
	CreatePOMVC(ctx context.Context, tokenID uint32) error
}

type VINVCService

type VINVCService interface {
	GetOrCreateVC(ctx context.Context, tokenID uint32, force bool) error
	GenerateStatusVC(tokenID uint32) (json.RawMessage, error)
	GenerateKeyControlDocument() (json.RawMessage, error)
	GenerateJSONLDDocument() (json.RawMessage, error)
	GenerateVocabDocument() (json.RawMessage, error)
}

VINVCService defines the interface for VIN VC operations.

Jump to

Keyboard shortcuts

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