vinvc

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: 11 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	PolygonChainID = 137
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FingerprintRepo

type FingerprintRepo interface {
	GetLatestFingerprintMessages(ctx context.Context, vehicle cloudevent.NFTDID, pairedDeviceAddr models.PairedDevice) (*models.DecodedFingerprintData, error)
}

FingerprintRepo defines the interface for fingerprint message operations.

type IdentityAPI

type IdentityAPI interface {
	GetVehicleInfo(ctx context.Context, vehicleDID cloudevent.NFTDID) (*models.VehicleInfo, error)
}

IdentityAPI defines the interface for identity operations.

type Issuer

type Issuer interface {
	CreateBitstringStatusListVC(tokenID uint32, revoked bool) ([]byte, error)
	CreateKeyControlDoc() ([]byte, error)
	CreateVINVC(vinSubject verifiable.VINSubject, expTime time.Time) ([]byte, error)
	CreateJSONLDDoc() ([]byte, error)
	CreateVocabWebpage() ([]byte, error)
}

Issuer defines the interface for creating control documents.

type Service

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

Service handles VIN VC-related operations.

func NewService

func NewService(
	logger *zerolog.Logger,
	vcRepo VCRepo,
	identityService IdentityAPI,
	fingerprintService FingerprintRepo,
	vinService VINAPI,
	issuer Issuer,
	revokedList []uint32,
	vehicleNFTAddress string,
) *Service

NewService creates a new Service for VIN VC operations.

func (*Service) GenerateJSONLDDocument

func (v *Service) GenerateJSONLDDocument() (json.RawMessage, error)

func (*Service) GenerateKeyControlDocument

func (v *Service) GenerateKeyControlDocument() (json.RawMessage, error)

GenerateKeyControlDocument generates a new control document for sharing public keys.

func (*Service) GenerateStatusVC

func (v *Service) GenerateStatusVC(tokenID uint32) (json.RawMessage, error)

GenerateStatusVC generates a new status VC.

func (*Service) GenerateVINVC

func (v *Service) GenerateVINVC(ctx context.Context, tokenID uint32, logger *zerolog.Logger) error

func (*Service) GenerateVocabDocument

func (v *Service) GenerateVocabDocument() (json.RawMessage, error)

func (*Service) GetOrCreateVC

func (v *Service) GetOrCreateVC(ctx context.Context, tokenID uint32, force bool) error

GetOrCreateVC retrieves or generates a VC for the given token ID. if force is true, a new VC is generated regardless of the existing VC.

type VCRepo

type VCRepo interface {
	GetLatestVINVC(ctx context.Context, vehicleDID cloudevent.NFTDID) (*verifiable.Credential, error)
	StoreVINVC(ctx context.Context, vehicleDID, producerDID cloudevent.NFTDID, vinvc json.RawMessage) error
}

VCRepo defines the interface for manging VC storage.

type VINAPI

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

VINAPI defines the interface for VIN validation.

Jump to

Keyboard shortcuts

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