issuer

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

Documentation

Overview

Package issuer is a generated GoMock package.

Index

Constants

View Source
const RevocationDocumentType = "application/vc+json;type=revocation"

RevocationDocumentType holds the content type used in network documents which contain a credential revocation

View Source
const VcDocumentType = "application/vc+json"

VcDocumentType holds the content type used in network documents which contain Verifiable Credentials

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 CredentialSearcher

type CredentialSearcher interface {
	// SearchCredential searches for issued credentials
	SearchCredential(context ssi.URI, credentialType ssi.URI, issuer did.DID, subject *ssi.URI) ([]vc.VerifiableCredential, error)
}

CredentialSearcher defines the functions to resolve or search for credentials. It is a separate interface from Store so when an object only needs resolving, it only needs the resolver.

type Issuer

type Issuer interface {
	// Issue issues a credential by signing an unsigned credential.
	// The publish param indicates if the credendential should be published to the network.
	// The public param instructs the Publisher to publish the param with a certain visibility.
	Issue(unsignedCredential vc.VerifiableCredential, publish, public bool) (*vc.VerifiableCredential, error)
	// Revoke revokes a credential by the provided type.
	// It requires access to the private key of the issuer which will be used to sign the revocation.
	// It returns an error when the credential is not issued by this node or is already revoked.
	// The revocation will be published to the network by the issuers Publisher.
	Revoke(credentialID ssi.URI) (*credential.Revocation, error)
	CredentialSearcher
}

Issuer is a role in the network for a party who issues credentials about a subject to a holder.

func NewIssuer

func NewIssuer(store Store, publisher Publisher, docResolver vdr.DocResolver, keyStore crypto.KeyStore, contextLoader ld.DocumentLoader, trustConfig *trust.Config) Issuer

NewIssuer creates a new issuer which implements the Issuer interface.

type MockCredentialSearcher

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

MockCredentialSearcher is a mock of CredentialSearcher interface.

func NewMockCredentialSearcher

func NewMockCredentialSearcher(ctrl *gomock.Controller) *MockCredentialSearcher

NewMockCredentialSearcher creates a new mock instance.

func (*MockCredentialSearcher) EXPECT

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

func (*MockCredentialSearcher) SearchCredential

func (m *MockCredentialSearcher) SearchCredential(context, credentialType ssi.URI, issuer did.DID, subject *ssi.URI) ([]vc.VerifiableCredential, error)

SearchCredential mocks base method.

type MockCredentialSearcherMockRecorder

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

MockCredentialSearcherMockRecorder is the mock recorder for MockCredentialSearcher.

func (*MockCredentialSearcherMockRecorder) SearchCredential

func (mr *MockCredentialSearcherMockRecorder) SearchCredential(context, credentialType, issuer, subject interface{}) *gomock.Call

SearchCredential indicates an expected call of SearchCredential.

type MockIssuer

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

MockIssuer is a mock of Issuer interface.

func NewMockIssuer

func NewMockIssuer(ctrl *gomock.Controller) *MockIssuer

NewMockIssuer creates a new mock instance.

func (*MockIssuer) EXPECT

func (m *MockIssuer) EXPECT() *MockIssuerMockRecorder

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

func (*MockIssuer) Issue

func (m *MockIssuer) Issue(unsignedCredential vc.VerifiableCredential, publish, public bool) (*vc.VerifiableCredential, error)

Issue mocks base method.

func (*MockIssuer) Revoke

func (m *MockIssuer) Revoke(credentialID ssi.URI) (*credential.Revocation, error)

Revoke mocks base method.

func (*MockIssuer) SearchCredential

func (m *MockIssuer) SearchCredential(context, credentialType ssi.URI, issuer did.DID, subject *ssi.URI) ([]vc.VerifiableCredential, error)

SearchCredential mocks base method.

type MockIssuerMockRecorder

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

MockIssuerMockRecorder is the mock recorder for MockIssuer.

func (*MockIssuerMockRecorder) Issue

func (mr *MockIssuerMockRecorder) Issue(unsignedCredential, publish, public interface{}) *gomock.Call

Issue indicates an expected call of Issue.

func (*MockIssuerMockRecorder) Revoke

func (mr *MockIssuerMockRecorder) Revoke(credentialID interface{}) *gomock.Call

Revoke indicates an expected call of Revoke.

func (*MockIssuerMockRecorder) SearchCredential

func (mr *MockIssuerMockRecorder) SearchCredential(context, credentialType, issuer, subject interface{}) *gomock.Call

SearchCredential indicates an expected call of SearchCredential.

type MockPublisher

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

MockPublisher is a mock of Publisher interface.

func NewMockPublisher

func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher

NewMockPublisher creates a new mock instance.

func (*MockPublisher) EXPECT

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

func (*MockPublisher) PublishCredential

func (m *MockPublisher) PublishCredential(verifiableCredential vc.VerifiableCredential, public bool) error

PublishCredential mocks base method.

func (*MockPublisher) PublishRevocation

func (m *MockPublisher) PublishRevocation(revocation credential.Revocation) error

PublishRevocation mocks base method.

type MockPublisherMockRecorder

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

MockPublisherMockRecorder is the mock recorder for MockPublisher.

func (*MockPublisherMockRecorder) PublishCredential

func (mr *MockPublisherMockRecorder) PublishCredential(verifiableCredential, public interface{}) *gomock.Call

PublishCredential indicates an expected call of PublishCredential.

func (*MockPublisherMockRecorder) PublishRevocation

func (mr *MockPublisherMockRecorder) PublishRevocation(revocation interface{}) *gomock.Call

PublishRevocation indicates an expected call of PublishRevocation.

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

func (m *MockStore) GetCredential(id ssi.URI) (*vc.VerifiableCredential, error)

GetCredential mocks base method.

func (*MockStore) SearchCredential

func (m *MockStore) SearchCredential(context, credentialType ssi.URI, issuer did.DID, subject *ssi.URI) ([]vc.VerifiableCredential, error)

SearchCredential mocks base method.

func (*MockStore) StoreCredential

func (m *MockStore) StoreCredential(vc vc.VerifiableCredential) error

StoreCredential 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) GetCredential

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

GetCredential indicates an expected call of GetCredential.

func (*MockStoreMockRecorder) SearchCredential

func (mr *MockStoreMockRecorder) SearchCredential(context, credentialType, issuer, subject interface{}) *gomock.Call

SearchCredential indicates an expected call of SearchCredential.

func (*MockStoreMockRecorder) StoreCredential

func (mr *MockStoreMockRecorder) StoreCredential(vc interface{}) *gomock.Call

StoreCredential indicates an expected call of StoreCredential.

type MockkeyResolver

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

MockkeyResolver is a mock of keyResolver interface.

func NewMockkeyResolver

func NewMockkeyResolver(ctrl *gomock.Controller) *MockkeyResolver

NewMockkeyResolver creates a new mock instance.

func (*MockkeyResolver) EXPECT

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

func (*MockkeyResolver) ResolveAssertionKey

func (m *MockkeyResolver) ResolveAssertionKey(issuerDID did.DID) (crypto.Key, error)

ResolveAssertionKey mocks base method.

type MockkeyResolverMockRecorder

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

MockkeyResolverMockRecorder is the mock recorder for MockkeyResolver.

func (*MockkeyResolverMockRecorder) ResolveAssertionKey

func (mr *MockkeyResolverMockRecorder) ResolveAssertionKey(issuerDID interface{}) *gomock.Call

ResolveAssertionKey indicates an expected call of ResolveAssertionKey.

type Publisher

type Publisher interface {
	// PublishCredential publishes the credential to the outside world.
	// A public flag is used to indicate if everybody can see the credential, or just the involved parties.
	PublishCredential(verifiableCredential vc.VerifiableCredential, public bool) error
	// PublishRevocation publishes the revocation to the outside world.
	// It indicates to the network a credential can no longer be used.
	PublishRevocation(revocation credential.Revocation) error
}

Publisher publishes new credentials and revocations to a channel. Used by a credential issuer.

func NewNetworkPublisher

func NewNetworkPublisher(networkTx network.Transactions, docResolver vdr.DocResolver, keyResolver crypto.KeyResolver) Publisher

NewNetworkPublisher creates a new networkPublisher which implements the Publisher interface. It is the default implementation to use for issuers to publish credentials and revocations to the Nuts network.

type Store

type Store interface {
	// GetCredential retrieves an issued credential by ID
	// Returns an ErrNotFound when the credential is not in the store
	GetCredential(id ssi.URI) (*vc.VerifiableCredential, error)
	// StoreCredential writes a VC to storage.
	StoreCredential(vc vc.VerifiableCredential) error
	CredentialSearcher
	// Closer closes and frees the underlying resources the store uses.
	io.Closer
}

Store defines the interface for an issuer store. An implementation stores all the issued credentials and the revocations.

func NewLeiaIssuerStore

func NewLeiaIssuerStore(dbPath string) (Store, error)

NewLeiaIssuerStore creates a new instance of leiaIssuerStore which implements the Store interface.

Jump to

Keyboard shortcuts

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