verifier

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package verifier is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a credential or revocation can not be found based on its ID.

Functions

This section is empty.

Types

type MockStore

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

MockStore is a mock of Store interface.

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) Close

func (m *MockStore) Close() error

Close mocks base method.

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) GetRevocations

func (m *MockStore) GetRevocations(id ssi.URI) ([]*credential.Revocation, error)

GetRevocations mocks base method.

func (*MockStore) StoreRevocation

func (m *MockStore) StoreRevocation(r credential.Revocation) error

StoreRevocation mocks base method.

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) Close

func (mr *MockStoreMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockStoreMockRecorder) GetRevocations

func (mr *MockStoreMockRecorder) GetRevocations(id interface{}) *gomock.Call

GetRevocations indicates an expected call of GetRevocations.

func (*MockStoreMockRecorder) StoreRevocation

func (mr *MockStoreMockRecorder) StoreRevocation(r interface{}) *gomock.Call

StoreRevocation indicates an expected call of StoreRevocation.

type MockVerifier

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

MockVerifier is a mock of Verifier interface.

func NewMockVerifier

func NewMockVerifier(ctrl *gomock.Controller) *MockVerifier

NewMockVerifier creates a new mock instance.

func (*MockVerifier) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVerifier) GetRevocation

func (m *MockVerifier) GetRevocation(id ssi.URI) (*credential.Revocation, error)

GetRevocation mocks base method.

func (*MockVerifier) IsRevoked

func (m *MockVerifier) IsRevoked(credentialID ssi.URI) (bool, error)

IsRevoked mocks base method.

func (*MockVerifier) RegisterRevocation

func (m *MockVerifier) RegisterRevocation(revocation credential.Revocation) error

RegisterRevocation mocks base method.

func (*MockVerifier) Validate

func (m *MockVerifier) Validate(credentialToVerify vc.VerifiableCredential, at *time.Time) error

Validate mocks base method.

func (*MockVerifier) Verify

func (m *MockVerifier) Verify(credential vc.VerifiableCredential, allowUntrusted, checkSignature bool, validAt *time.Time) error

Verify mocks base method.

func (*MockVerifier) VerifyVP

func (m *MockVerifier) VerifyVP(presentation vc.VerifiablePresentation, verifyVCs bool, validAt *time.Time) ([]vc.VerifiableCredential, error)

VerifyVP mocks base method.

type MockVerifierMockRecorder

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

MockVerifierMockRecorder is the mock recorder for MockVerifier.

func (*MockVerifierMockRecorder) GetRevocation

func (mr *MockVerifierMockRecorder) GetRevocation(id interface{}) *gomock.Call

GetRevocation indicates an expected call of GetRevocation.

func (*MockVerifierMockRecorder) IsRevoked

func (mr *MockVerifierMockRecorder) IsRevoked(credentialID interface{}) *gomock.Call

IsRevoked indicates an expected call of IsRevoked.

func (*MockVerifierMockRecorder) RegisterRevocation

func (mr *MockVerifierMockRecorder) RegisterRevocation(revocation interface{}) *gomock.Call

RegisterRevocation indicates an expected call of RegisterRevocation.

func (*MockVerifierMockRecorder) Validate

func (mr *MockVerifierMockRecorder) Validate(credentialToVerify, at interface{}) *gomock.Call

Validate indicates an expected call of Validate.

func (*MockVerifierMockRecorder) Verify

func (mr *MockVerifierMockRecorder) Verify(credential, allowUntrusted, checkSignature, validAt interface{}) *gomock.Call

Verify indicates an expected call of Verify.

func (*MockVerifierMockRecorder) VerifyVP

func (mr *MockVerifierMockRecorder) VerifyVP(presentation, verifyVCs, validAt interface{}) *gomock.Call

VerifyVP indicates an expected call of VerifyVP.

type Store

type Store interface {
	// GetRevocations returns all revocations for a credential ID
	// Returns an ErrNotFound when the revocation is not in the store
	GetRevocations(id ssi.URI) ([]*credential.Revocation, error)
	// StoreRevocation writes a revocation to storage.
	StoreRevocation(r credential.Revocation) error
	// Closer closes and frees the underlying resources the store uses.
	io.Closer
}

Store defines the interface for a store for a verifier. The store is filled with public information such as revoked credentials, as well as local defined trust relations between issuer and credential type.

func NewLeiaVerifierStore

func NewLeiaVerifierStore(dbPath string) (Store, error)

NewLeiaVerifierStore creates a new instance of leiaVerifierStore which implements the Store interface.

type VerificationError

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

VerificationError is used to describe a VC/VP verification failure.

func (VerificationError) Error

func (e VerificationError) Error() string

func (VerificationError) Is

func (e VerificationError) Is(other error) bool

Is checks whether the given error is a VerificationError as well.

type Verifier

type Verifier interface {
	// Verify checks credential on full correctness. It checks:
	// validity of the signature
	// if it has been revoked
	// if the issuer is registered as trusted
	Verify(credential vc.VerifiableCredential, allowUntrusted bool, checkSignature bool, validAt *time.Time) error
	// Validate checks the verifiable credential technical correctness
	Validate(credentialToVerify vc.VerifiableCredential, at *time.Time) error
	// IsRevoked checks if the credential is revoked
	IsRevoked(credentialID ssi.URI) (bool, error)
	// GetRevocation returns the first revocation by credential ID
	// Returns an ErrNotFound when the revocation is not in the store
	GetRevocation(id ssi.URI) (*credential.Revocation, error)
	// RegisterRevocation stores the revocation in the store
	// before storing the revocation gets validated
	RegisterRevocation(revocation credential.Revocation) error

	// VerifyVP verifies the given Verifiable Presentation. If successful, it returns the credentials within the presentation.
	// If verifyVCs is true, it will also verify the credentials inside the VP, checking their correctness, signature and trust status.
	VerifyVP(presentation vc.VerifiablePresentation, verifyVCs bool, validAt *time.Time) ([]vc.VerifiableCredential, error)
}

Verifier defines the interface for verifying verifiable credentials.

func NewVerifier

func NewVerifier(store Store, keyResolver vdr.KeyResolver, contextLoader ld.DocumentLoader, trustConfig *trust.Config) Verifier

NewVerifier creates a new instance of the verifier. It needs a key resolver for validating signatures.

Jump to

Keyboard shortcuts

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