trustregistry

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const WalletAttestationVCType = "WalletAttestationCredential"

Variables

View Source
var ErrInteractionRestricted = errors.New("interaction restricted")

Functions

This section is empty.

Types

type Config

type Config struct {
	HTTPClient     httpClient
	DocumentLoader ld.DocumentLoader
	ProofChecker   verifiable.CombinedProofChecker
}

Config defines dependencies for Service.

type CredentialMatches added in v1.10.0

type CredentialMatches struct {
	// Credential ID
	CredentialID string `json:"credential_id"`
	// Credential Types.
	Types []string `json:"credential_types"`
	// Issuer ID.
	IssuerID string `json:"issuer_id"`
	// Issuance date/time.
	Issued string `json:"issuance_date"`
	// Expiration date/time.
	Expired string `json:"expiration_date"`
}

CredentialMatches represents metadata of matched credentials for policy evaluation.

type IssuancePolicyEvaluationRequest

type IssuancePolicyEvaluationRequest struct {
	CredentialTypes []string  `json:"credential_types"`
	AttestationVC   *[]string `json:"attestation_vc,omitempty"`
	IssuerDID       string    `json:"issuer_did"`
}

IssuancePolicyEvaluationRequest is a request payload for issuance policy evaluation service.

type PolicyEvaluationResponse

type PolicyEvaluationResponse struct {
	Allowed     bool                   `json:"allowed"`
	DenyReasons *[]string              `json:"deny_reasons,omitempty"`
	Payload     map[string]interface{} `json:"payload,omitempty"`
}

PolicyEvaluationResponse is a response from policy evaluation service.

type PresentationPolicyEvaluationRequest

type PresentationPolicyEvaluationRequest struct {
	AttestationVC     *[]string           `json:"attestation_vc,omitempty"`
	CredentialMatches []CredentialMatches `json:"credential_matches"`
	VerifierDID       string              `json:"verifier_did"`
}

PresentationPolicyEvaluationRequest is a request payload for presentation policy evaluation service.

type Service

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

Service requests policy evaluation from Trust Registry to validate that the wallet has satisfied attestation requirements.

func NewService

func NewService(config *Config) *Service

NewService returns a new Service instance.

func (*Service) ValidateIssuance

func (s *Service) ValidateIssuance(
	ctx context.Context,
	profile *profileapi.Issuer,
	data *ValidateIssuanceData,
) error

ValidateIssuance validates attestation VP and requests issuance policy evaluation.

func (*Service) ValidatePresentation

func (s *Service) ValidatePresentation(
	ctx context.Context,
	profile *profileapi.Verifier,
	data *ValidatePresentationData,
) error

ValidatePresentation validates attestation VP and requests presentation policy evaluation.

type ServiceInterface

type ServiceInterface interface {
	ValidateIssuance
	ValidatePresentation
}

ServiceInterface defines an interface for Trust Registry service.

type ValidateIssuance

type ValidateIssuance interface {
	ValidateIssuance(ctx context.Context, profile *profileapi.Issuer, data *ValidateIssuanceData) error
}

ValidateIssuance requests evaluation of the given policy to validate that the wallet has satisfied attestation requirements.

type ValidateIssuanceData

type ValidateIssuanceData struct {
	AttestationVP   string
	CredentialTypes []string
	Nonce           string
}

type ValidatePresentation

type ValidatePresentation interface {
	ValidatePresentation(ctx context.Context, profile *profileapi.Verifier, data *ValidatePresentationData) error
}

ValidatePresentation requests evaluation of the given policy to validate that the presented credential is presented as per policy (by type, by issuer DID, etc.).

type ValidatePresentationData

type ValidatePresentationData struct {
	AttestationVP     string
	CredentialMatches []CredentialMatches
}

Jump to

Keyboard shortcuts

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