verifier

package
v6.2.12 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: GPL-3.0 Imports: 29 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.

View Source
var ExtractProtectedHeaders = crypto.ExtractProtectedHeaders

Functions

func ToVerificationError

func ToVerificationError(cause error) error

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) Diagnostics

func (m *MockStore) Diagnostics() []core.DiagnosticResult

Diagnostics 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) Diagnostics

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

Diagnostics indicates an expected call of Diagnostics.

func (*MockStoreMockRecorder) GetRevocations

func (mr *MockStoreMockRecorder) GetRevocations(id any) *gomock.Call

GetRevocations indicates an expected call of GetRevocations.

func (*MockStoreMockRecorder) StoreRevocation

func (mr *MockStoreMockRecorder) StoreRevocation(r any) *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(cred vc.VerifiableCredential) (*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) Verify

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

Verify mocks base method.

func (*MockVerifier) VerifySignature

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

VerifySignature mocks base method.

func (*MockVerifier) VerifyVP

func (m *MockVerifier) VerifyVP(presentation vc.VerifiablePresentation, verifyVCs, allowUntrustedVCs 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(cred any) *gomock.Call

GetRevocation indicates an expected call of GetRevocation.

func (*MockVerifierMockRecorder) IsRevoked

func (mr *MockVerifierMockRecorder) IsRevoked(credentialID any) *gomock.Call

IsRevoked indicates an expected call of IsRevoked.

func (*MockVerifierMockRecorder) RegisterRevocation

func (mr *MockVerifierMockRecorder) RegisterRevocation(revocation any) *gomock.Call

RegisterRevocation indicates an expected call of RegisterRevocation.

func (*MockVerifierMockRecorder) Verify

func (mr *MockVerifierMockRecorder) Verify(arg0, allowUntrusted, checkSignature, validAt any) *gomock.Call

Verify indicates an expected call of Verify.

func (*MockVerifierMockRecorder) VerifySignature

func (mr *MockVerifierMockRecorder) VerifySignature(credentialToVerify, at any) *gomock.Call

VerifySignature indicates an expected call of VerifySignature.

func (*MockVerifierMockRecorder) VerifyVP

func (mr *MockVerifierMockRecorder) VerifyVP(presentation, verifyVCs, allowUntrustedVCs, validAt any) *gomock.Call

VerifyVP indicates an expected call of VerifyVP.

type Store

type Store interface {
	core.Diagnosable
	// 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, backupStore stoabs.KVStore) (Store, error)

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

type VerificationError

type VerificationError struct {
	Msg  string
	Args []interface{}
}

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 (optional)
	// if it has been revoked
	// if the issuer is registered as trusted (optional)
	Verify(credential vc.VerifiableCredential, allowUntrusted bool, checkSignature bool, validAt *time.Time) error
	// VerifySignature checks that the signature on the verifiable credential is correct and valid at the given time and nothing else
	VerifySignature(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 for the given credential.
	// If the credential is not revoked, it returns no revocation and no error.
	GetRevocation(cred vc.VerifiableCredential) (*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
	// - trust status (unless allowUntrustedVCs is true).
	// It always checks whether the signer of the presentation is the holder of the presented credentials,
	// but only if there are credentials in the presentation.
	VerifyVP(presentation vc.VerifiablePresentation, verifyVCs bool, allowUntrustedVCs bool, validAt *time.Time) ([]vc.VerifiableCredential, error)
}

Verifier defines the interface for verifying verifiable credentials.

func NewVerifier

func NewVerifier(store Store, didResolver resolver.DIDResolver, keyResolver resolver.KeyResolver, jsonldManager jsonld.JSONLD, trustConfig *trust.Config, credentialStatus *revocation.StatusList2021, pkiValidator pki.Validator) 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