vc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package vc provides the controller for handling VIN VC-related requests.

Index

Constants

View Source
const (
	// TokenIDParam is the parameter name for the vehilce 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 Controller

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

Controller handles VIN VC-related requests.

func NewVCController

func NewVCController(
	logger *zerolog.Logger,
	vcService VCService,
	identityService IdentityService,
	fingerprintService FingerprintService,
	vinService VINService,
	telemetryURL string,
) (*Controller, error)

NewVCController creates a new VCController instance.

func (*Controller) GetVCStatus

func (v *Controller) 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 @Security BearerAuth @Router /v1/vc/status/{group} [get]

func (*Controller) GetVINVC

func (v *Controller) 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" @Success 200 {object} getVINVCResponse @Security BearerAuth @Router /v1/vc/vin/{tokenId} [get]

type FingerprintService

type FingerprintService interface {
	GetLatestFingerprintMessages(ctx context.Context, pairedDeviceAddr common.Address) (*models.DecodedFingerprintData, error)
}

FingerprintService defines the interface for fingerprint message operations.

type IdentityService

type IdentityService interface {
	GetVehicleInfo(ctx context.Context, tokenID uint32) (*models.VehicleInfo, error)
}

IdentityService defines the interface for identity operations.

type VCService

type VCService interface {
	GetLatestVC(ctx context.Context, tokenID uint32) (*verifiable.Credential, error)
	GenerateAndStoreVINVC(ctx context.Context, tokenID uint32, vin, countryCode string) error
	GenerateStatusVC(tokenID uint32) (json.RawMessage, error)
}

VCService defines the interface for VC operations.

type VINService

type VINService interface {
	DecodeVIN(ctx context.Context, vin, countryCode string) (string, error)
}

VINService defines the interface for VIN validation.

Jump to

Keyboard shortcuts

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