refresh

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Overview

Package refresh provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type Config

type Config struct {
	RefreshService        CredentialRefreshService
	ProfileService        ProfileService
	ProofChecker          ProofChecker
	DocumentLoader        ld.DocumentLoader
	IssuerVCSPublicHost   string
	DataIntegrityVerifier *dataintegrity.Verifier
}

type Controller

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

func NewController

func NewController(cfg *Config) *Controller

func (*Controller) GetRefreshedCredential

func (c *Controller) GetRefreshedCredential(
	ctx echo.Context,
	profileID string,
	profileVersion string,
	_ GetRefreshedCredentialParams,
) error

GetRefreshedCredential gets refreshed credentials (POST /refresh/{profileID}/{profileVersion}).

func (*Controller) RequestRefreshStatus

func (c *Controller) RequestRefreshStatus(
	ctx echo.Context,
	issuerID string,
	profileVersion string,
	params RequestRefreshStatusParams,
) error

RequestRefreshStatus gets refresh status (GET /refresh/{profileID}/{profileVersion}).

type CredentialRefreshAvailableResponse

type CredentialRefreshAvailableResponse struct {
	VerifiablePresentationRequest VerifiablePresentationRequest `json:"verifiablePresentationRequest"`
}

CredentialRefreshAvailableResponse Model for Credential Update Response.

type CredentialRefreshService

type CredentialRefreshService interface {
	RequestRefreshStatus(
		ctx context.Context,
		credentialID string,
		issuer profileapi.Issuer,
	) (*refresh.GetRefreshStateResponse, error)

	GetRefreshedCredential(
		ctx context.Context,
		presentation *verifiable.Presentation,
		issuer profileapi.Issuer,
	) (*refresh.GetRefreshedCredentialResponse, error)
}

CredentialRefreshService defines credential refresh service interface.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetRefreshedCredentialJSONRequestBody

type GetRefreshedCredentialJSONRequestBody = GetRefreshedCredentialReq

GetRefreshedCredentialJSONRequestBody defines body for GetRefreshedCredential for application/json ContentType.

type GetRefreshedCredentialParams

type GetRefreshedCredentialParams struct {
	// CredentialID Credential ID
	CredentialID string `form:"credentialID" json:"credentialID"`
}

GetRefreshedCredentialParams defines parameters for GetRefreshedCredential.

type GetRefreshedCredentialReq

type GetRefreshedCredentialReq struct {
	// VerifiablePresentation Verifiable Presentation.
	VerifiablePresentation []byte `json:"verifiable_presentation"`
}

GetRefreshedCredentialReq Model for getting refreshed credential.

type GetRefreshedCredentialResp

type GetRefreshedCredentialResp struct {
	IssuerURI            string `json:"issuerURI"`
	VerifiableCredential any    `json:"verifiable_credential"`
}

GetRefreshedCredentialResp Model for getting refreshed credential.

type ProfileService

type ProfileService interface {
	GetProfile(profileID profileapi.ID, profileVersion profileapi.Version) (*profileapi.Issuer, error)
}

ProfileService defines issuer profile service interface.

type ProofChecker

type ProofChecker interface {
	CheckLDProof(proof *proof.Proof, expectedProofIssuer string, msg, signature []byte) error

	// GetLDPCanonicalDocument will return normalized/canonical version of the document
	GetLDPCanonicalDocument(proof *proof.Proof, doc map[string]interface{}, opts ...processor.Opts) ([]byte, error)

	// GetLDPDigest returns document digest
	GetLDPDigest(proof *proof.Proof, doc []byte) ([]byte, error)

	CheckJWTProof(headers jose.Headers, expectedProofIssuer string, msg, signature []byte) error
	CheckCWTProof(
		checkCWTRequest checker.CheckCWTProofRequest,
		expectedProofIssuer string,
		msg []byte,
		signature []byte,
	) error
}

type RefreshService

type RefreshService struct {
	// ServiceEndpoint Service endpoint.
	ServiceEndpoint string `json:"serviceEndpoint"`

	// Type Service type.
	Type string `json:"type"`
}

RefreshService defines model for RefreshService.

type RefreshServiceInteract

type RefreshServiceInteract struct {
	Service []RefreshService `json:"service"`
}

RefreshServiceInteract defines model for RefreshServiceInteract.

type RequestRefreshStatusParams

type RequestRefreshStatusParams struct {
	// CredentialID Credential ID
	CredentialID string `form:"credentialID" json:"credentialID"`
}

RequestRefreshStatusParams defines parameters for RequestRefreshStatus.

type ServerInterface

type ServerInterface interface {
	// Get refresh status for credential.
	// (GET /refresh/{profileID}/{profileVersion})
	RequestRefreshStatus(ctx echo.Context, profileID string, profileVersion string, params RequestRefreshStatusParams) error
	// Receive updated (refreshed) credentials.
	// (POST /refresh/{profileID}/{profileVersion})
	GetRefreshedCredential(ctx echo.Context, profileID string, profileVersion string, params GetRefreshedCredentialParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetRefreshedCredential

func (w *ServerInterfaceWrapper) GetRefreshedCredential(ctx echo.Context) error

GetRefreshedCredential converts echo context to params.

func (*ServerInterfaceWrapper) RequestRefreshStatus

func (w *ServerInterfaceWrapper) RequestRefreshStatus(ctx echo.Context) error

RequestRefreshStatus converts echo context to params.

type VerifiablePresentationRequest

type VerifiablePresentationRequest struct {
	// Challenge Challenge value.
	Challenge string `json:"challenge"`

	// Domain Domain value.
	Domain   string                 `json:"domain"`
	Interact RefreshServiceInteract `json:"interact"`

	// Query Credential Presentation Query.
	Query map[string]interface{} `json:"query"`
}

VerifiablePresentationRequest defines model for VerifiablePresentationRequest.

Jump to

Keyboard shortcuts

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