types

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

Documentation

Overview

Package types is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrDIDAlreadyExists = errors.New("DID document already exists in the store")

ErrDIDAlreadyExists is returned when a DID already exists.

View Source
var ErrDIDNotManagedByThisNode = errors.New("DID document not managed by this node")

ErrDIDNotManagedByThisNode is returned when an operation needs the private key and if is not found on this host

View Source
var ErrDeactivated = deactivatedError{/* contains filtered or unexported fields */}

ErrDeactivated The DID supplied to the DID resolution function has been deactivated.

View Source
var ErrDuplicateService = errors.New("service type is duplicate")

ErrDuplicateService is returned when a DID Document contains a multiple services with the same type

View Source
var ErrInvalidServiceQuery = errors.New("service query is invalid")

ErrInvalidServiceQuery is returned when a compound service contains an invalid service reference.

View Source
var ErrKeyNotFound = errors.New("key not found in DID document")

ErrKeyNotFound is returned when a particular key or type of key is not found.

View Source
var ErrNoActiveController = deactivatedError{/* contains filtered or unexported fields */}

ErrNoActiveController The DID supplied to the DID resolution does not have any active controllers.

View Source
var ErrNotFound = errors.New("unable to find the DID document")

ErrNotFound The DID resolver was unable to find the DID document resulting from this resolution request.

View Source
var ErrServiceNotFound = errors.New("service not found in DID Document")

ErrServiceNotFound is returned when the service is not found on a DID

View Source
var ErrServiceReferenceToDeep = errors.New("service references are nested to deeply before resolving to a non-reference")

ErrServiceReferenceToDeep is returned when a service reference is chain is nested too deeply.

View Source
var ErrUpdateOnOutdatedData = errors.New("could not update outdated DID document")

ErrUpdateOnOutdatedData is returned when a concurrent update is done on a DID document.

Functions

This section is empty.

Types

type CompoundService

type CompoundService map[string]string

CompoundService is a service type that can be used as target for github.com/nuts-foundation/go-did/did/document.go#UnmarshalServiceEndpoint

type DIDCreationOptions

type DIDCreationOptions struct {

	// Controllers lists the DIDs that can control the new DID Document. If selfControl = true and controllers is not empty,
	// the newly generated DID will be added to the list of controllers.
	Controllers []did.DID

	// AssertionMethod indicates if the generated key pair can be used for assertions.
	AssertionMethod bool

	// Authentication indicates if the generated key pair can be used for authentication.
	Authentication bool

	// CapabilityDelegation indicates if the generated key pair can be used for altering DID Documents.
	// In combination with selfControl = true, the key can be used to alter the new DID Document.
	// Defaults to true when not given.
	CapabilityDelegation bool

	// CapabilityInvocation indicates if the generated key pair can be used for capability invocations.
	CapabilityInvocation bool

	// KeyAgreement indicates if the generated key pair can be used for Key agreements.
	KeyAgreement bool

	// SelfControl indicates wether the generated DID Document can be altered with its own capabilityInvocation key.
	// Defaults to true when not given.
	SelfControl bool
}

DIDCreationOptions defines options for creating a DID Document.

type DocCreator

type DocCreator interface {
	// Create creates a new DID document and returns it.
	// The ID in the provided DID document will be ignored and a new one will be generated.
	// If something goes wrong an error is returned.
	// Implementors should generate private key and store it in a secure backend
	Create(options DIDCreationOptions) (*did.Document, crypto2.Key, error)
}

DocCreator is the interface that wraps the Create method

type DocFinder

type DocFinder interface {
	Find(...Predicate) ([]did.Document, error)
}

DocFinder is the interface that groups all methods for finding DID documents based on search conditions

type DocIterator

type DocIterator func(doc did.Document, metadata DocumentMetadata) error

DocIterator is the function type for iterating over the all current DID Documents in the store

type DocManipulator

type DocManipulator interface {
	// Deactivate deactivates a DID document
	// Deactivation will be done in such a way that a DID doc cannot be used / activated anymore.
	// Since the deactivation is definitive, no version is required
	// If the DID Document is not found ErrNotFound is returned
	// If the DID Document is not managed by this node, ErrDIDNotManagedByThisNode is returned
	// If the DID Document is already deactivated ErrDeactivated is returned
	Deactivate(id did.DID) error

	// RemoveVerificationMethod removes a VerificationMethod from a DID document.
	// It accepts the id DID as identifier for the DID document.
	// It accepts the kid DID as identifier for the VerificationMethod.
	// It returns an ErrNotFound when the DID document could not be found.
	// It returns an ErrNotFound when there is no VerificationMethod with the provided kid in the document.
	// It returns an ErrDeactivated when the DID document has the deactivated state.
	// It returns an ErrDIDNotManagedByThisNode if the DID document is not managed by this node.
	RemoveVerificationMethod(id, keyID did.DID) error

	// AddVerificationMethod generates a new key and adds it, wrapped as a VerificationMethod, to a DID document.
	// It accepts a DID as identifier for the DID document.
	// It returns an ErrNotFound when the DID document could not be found.
	// It returns an ErrDeactivated when the DID document has the deactivated state.
	// It returns an ErrDIDNotManagedByThisNode if the DID document is not managed by this node.
	AddVerificationMethod(id did.DID) (*did.VerificationMethod, error)
}

DocManipulator groups several higher level methods to alter the state of a DID document.

type DocResolver

type DocResolver interface {
	// Resolve returns a DID Document for the provided DID.
	// If metadata is not provided the latest version is returned.
	// If metadata is provided then the result is filtered or scoped on that metadata.
	// It returns ErrNotFound if there are no corresponding DID documents or when the DID Documents are disjoint with the provided ResolveMetadata
	// It returns ErrDeactivated if the DID Document has been deactivated and metadata is unset or metadata.AllowDeactivated is false.
	// It returns ErrNoActiveController if all of the DID Documents controllers have been deactivated and metadata is unset or metadata.AllowDeactivated is false.
	Resolve(id did.DID, metadata *ResolveMetadata) (*did.Document, *DocumentMetadata, error)
	// ResolveControllers finds the DID Document controllers
	ResolveControllers(input did.Document, metadata *ResolveMetadata) ([]did.Document, error)
}

DocResolver is the interface that groups all the DID Document read methods

type DocUpdater

type DocUpdater interface {
	// Update replaces the DID document identified by DID with the nextVersion
	// To prevent updating stale data a hash of the current version should be provided.
	// If the given hash does not represent the current version, a ErrUpdateOnOutdatedData is returned
	// If the DID Document is not found, ErrNotFound is returned
	// If the DID Document is not managed by this node, ErrDIDNotManagedByThisNode is returned
	Update(id did.DID, current hash.SHA256Hash, next did.Document, metadata *DocumentMetadata) error
}

DocUpdater is the interface that defines functions that alter the state of a DID document

type DocWriter

type DocWriter interface {
	// Write writes a DID Document.
	// Returns ErrDIDAlreadyExists when DID already exists
	// When a document already exists, the Update should be used instead
	Write(document did.Document, metadata DocumentMetadata) error
}

DocWriter is the interface that groups al the DID Document write methods

type DocumentMetadata

type DocumentMetadata struct {
	Created time.Time  `json:"created"`
	Updated *time.Time `json:"updated,omitempty"`
	// Hash of DID document bytes. Is equal to payloadHash in network layer.
	Hash hash.SHA256Hash `json:"hash"`
	// PreviousHash of the previous version of this DID document
	PreviousHash *hash.SHA256Hash `json:"previousHash,omitempty"`
	// SourceTransactions points to the transaction(s) that created the current version of this DID Document.
	// If multiple transactions are listed, the DID Document is conflicted
	SourceTransactions []hash.SHA256Hash `json:"txs"`
	// Deactivated indicates if the document is deactivated
	Deactivated bool `json:"deactivated"`
}

DocumentMetadata holds the metadata of a DID document

func (DocumentMetadata) Copy

Copy creates a deep copy of DocumentMetadata

func (DocumentMetadata) IsConflicted

func (m DocumentMetadata) IsConflicted() bool

IsConflicted returns if a DID Document is conflicted

type KeyResolver

type KeyResolver interface {
	// ResolveSigningKeyID looks up a signing key of the specified holder. It returns the ID
	// of the found key. Typically used to find a key for signing one's own documents. If no suitable keys
	// are found an error is returned.
	ResolveSigningKeyID(holder did.DID, validAt *time.Time) (string, error)
	// ResolveSigningKey looks up a specific signing key and returns it as crypto.PublicKey. If the key can't be found
	// or isn't meant for signing an error is returned.
	ResolveSigningKey(keyID string, validAt *time.Time) (crypto.PublicKey, error)
	// ResolveAssertionKeyID look for a valid assertion key for the give DID. If multiple keys are valid, the first one is returned.
	// An ErrKeyNotFound is returned when no key is found.
	ResolveAssertionKeyID(id did.DID) (ssi.URI, error)
	// ResolveKeyAgreementKey look for a valid keyAgreement key for the give DID. If multiple keys are valid, the first one is returned.
	// An ErrKeyNotFound is returned when no key is found.
	ResolveKeyAgreementKey(id did.DID) (crypto.PublicKey, error)
	// ResolvePublicKeyInTime loads the key from a DID Document
	// It returns ErrKeyNotFound when the key could not be found in the DID Document.
	// It returns ErrNotFound when the DID Document can't be found.
	ResolvePublicKeyInTime(kid string, validAt *time.Time) (crypto.PublicKey, error)
	// ResolvePublicKey loads the key from a DID Document where the DID Document
	// was created with one of the given tx refs
	// It returns ErrKeyNotFound when the key could not be found in the DID Document.
	// It returns ErrNotFound when the DID Document can't be found.
	ResolvePublicKey(kid string, sourceTransactionsRefs []hash.SHA256Hash) (crypto.PublicKey, error)
}

KeyResolver is the interface for resolving keys. This can be used for checking if a signing key is valid at a point in time or to just find a valid key for signing.

type MockDocCreator

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

MockDocCreator is a mock of DocCreator interface.

func NewMockDocCreator

func NewMockDocCreator(ctrl *gomock.Controller) *MockDocCreator

NewMockDocCreator creates a new mock instance.

func (*MockDocCreator) Create

func (m *MockDocCreator) Create(options DIDCreationOptions) (*did.Document, crypto0.Key, error)

Create mocks base method.

func (*MockDocCreator) EXPECT

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

type MockDocCreatorMockRecorder

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

MockDocCreatorMockRecorder is the mock recorder for MockDocCreator.

func (*MockDocCreatorMockRecorder) Create

func (mr *MockDocCreatorMockRecorder) Create(options interface{}) *gomock.Call

Create indicates an expected call of Create.

type MockDocFinder

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

MockDocFinder is a mock of DocFinder interface.

func NewMockDocFinder

func NewMockDocFinder(ctrl *gomock.Controller) *MockDocFinder

NewMockDocFinder creates a new mock instance.

func (*MockDocFinder) EXPECT

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

func (*MockDocFinder) Find

func (m *MockDocFinder) Find(arg0 ...Predicate) ([]did.Document, error)

Find mocks base method.

type MockDocFinderMockRecorder

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

MockDocFinderMockRecorder is the mock recorder for MockDocFinder.

func (*MockDocFinderMockRecorder) Find

func (mr *MockDocFinderMockRecorder) Find(arg0 ...interface{}) *gomock.Call

Find indicates an expected call of Find.

type MockDocManipulator

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

MockDocManipulator is a mock of DocManipulator interface.

func NewMockDocManipulator

func NewMockDocManipulator(ctrl *gomock.Controller) *MockDocManipulator

NewMockDocManipulator creates a new mock instance.

func (*MockDocManipulator) AddVerificationMethod

func (m *MockDocManipulator) AddVerificationMethod(id did.DID) (*did.VerificationMethod, error)

AddVerificationMethod mocks base method.

func (*MockDocManipulator) Deactivate

func (m *MockDocManipulator) Deactivate(id did.DID) error

Deactivate mocks base method.

func (*MockDocManipulator) EXPECT

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

func (*MockDocManipulator) RemoveVerificationMethod

func (m *MockDocManipulator) RemoveVerificationMethod(id, keyID did.DID) error

RemoveVerificationMethod mocks base method.

type MockDocManipulatorMockRecorder

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

MockDocManipulatorMockRecorder is the mock recorder for MockDocManipulator.

func (*MockDocManipulatorMockRecorder) AddVerificationMethod

func (mr *MockDocManipulatorMockRecorder) AddVerificationMethod(id interface{}) *gomock.Call

AddVerificationMethod indicates an expected call of AddVerificationMethod.

func (*MockDocManipulatorMockRecorder) Deactivate

func (mr *MockDocManipulatorMockRecorder) Deactivate(id interface{}) *gomock.Call

Deactivate indicates an expected call of Deactivate.

func (*MockDocManipulatorMockRecorder) RemoveVerificationMethod

func (mr *MockDocManipulatorMockRecorder) RemoveVerificationMethod(id, keyID interface{}) *gomock.Call

RemoveVerificationMethod indicates an expected call of RemoveVerificationMethod.

type MockDocResolver

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

MockDocResolver is a mock of DocResolver interface.

func NewMockDocResolver

func NewMockDocResolver(ctrl *gomock.Controller) *MockDocResolver

NewMockDocResolver creates a new mock instance.

func (*MockDocResolver) EXPECT

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

func (*MockDocResolver) Resolve

func (m *MockDocResolver) Resolve(id did.DID, metadata *ResolveMetadata) (*did.Document, *DocumentMetadata, error)

Resolve mocks base method.

func (*MockDocResolver) ResolveControllers

func (m *MockDocResolver) ResolveControllers(input did.Document, metadata *ResolveMetadata) ([]did.Document, error)

ResolveControllers mocks base method.

type MockDocResolverMockRecorder

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

MockDocResolverMockRecorder is the mock recorder for MockDocResolver.

func (*MockDocResolverMockRecorder) Resolve

func (mr *MockDocResolverMockRecorder) Resolve(id, metadata interface{}) *gomock.Call

Resolve indicates an expected call of Resolve.

func (*MockDocResolverMockRecorder) ResolveControllers

func (mr *MockDocResolverMockRecorder) ResolveControllers(input, metadata interface{}) *gomock.Call

ResolveControllers indicates an expected call of ResolveControllers.

type MockDocUpdater

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

MockDocUpdater is a mock of DocUpdater interface.

func NewMockDocUpdater

func NewMockDocUpdater(ctrl *gomock.Controller) *MockDocUpdater

NewMockDocUpdater creates a new mock instance.

func (*MockDocUpdater) EXPECT

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

func (*MockDocUpdater) Update

func (m *MockDocUpdater) Update(id did.DID, current hash.SHA256Hash, next did.Document, metadata *DocumentMetadata) error

Update mocks base method.

type MockDocUpdaterMockRecorder

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

MockDocUpdaterMockRecorder is the mock recorder for MockDocUpdater.

func (*MockDocUpdaterMockRecorder) Update

func (mr *MockDocUpdaterMockRecorder) Update(id, current, next, metadata interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockDocWriter

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

MockDocWriter is a mock of DocWriter interface.

func NewMockDocWriter

func NewMockDocWriter(ctrl *gomock.Controller) *MockDocWriter

NewMockDocWriter creates a new mock instance.

func (*MockDocWriter) EXPECT

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

func (*MockDocWriter) Write

func (m *MockDocWriter) Write(document did.Document, metadata DocumentMetadata) error

Write mocks base method.

type MockDocWriterMockRecorder

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

MockDocWriterMockRecorder is the mock recorder for MockDocWriter.

func (*MockDocWriterMockRecorder) Write

func (mr *MockDocWriterMockRecorder) Write(document, metadata interface{}) *gomock.Call

Write indicates an expected call of Write.

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

func (m *MockKeyResolver) ResolveAssertionKeyID(id did.DID) (go_did.URI, error)

ResolveAssertionKeyID mocks base method.

func (*MockKeyResolver) ResolveKeyAgreementKey

func (m *MockKeyResolver) ResolveKeyAgreementKey(id did.DID) (crypto.PublicKey, error)

ResolveKeyAgreementKey mocks base method.

func (*MockKeyResolver) ResolvePublicKey

func (m *MockKeyResolver) ResolvePublicKey(kid string, sourceTransactionsRefs []hash.SHA256Hash) (crypto.PublicKey, error)

ResolvePublicKey mocks base method.

func (*MockKeyResolver) ResolvePublicKeyInTime

func (m *MockKeyResolver) ResolvePublicKeyInTime(kid string, validAt *time.Time) (crypto.PublicKey, error)

ResolvePublicKeyInTime mocks base method.

func (*MockKeyResolver) ResolveSigningKey

func (m *MockKeyResolver) ResolveSigningKey(keyID string, validAt *time.Time) (crypto.PublicKey, error)

ResolveSigningKey mocks base method.

func (*MockKeyResolver) ResolveSigningKeyID

func (m *MockKeyResolver) ResolveSigningKeyID(holder did.DID, validAt *time.Time) (string, error)

ResolveSigningKeyID mocks base method.

type MockKeyResolverMockRecorder

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

MockKeyResolverMockRecorder is the mock recorder for MockKeyResolver.

func (*MockKeyResolverMockRecorder) ResolveAssertionKeyID

func (mr *MockKeyResolverMockRecorder) ResolveAssertionKeyID(id interface{}) *gomock.Call

ResolveAssertionKeyID indicates an expected call of ResolveAssertionKeyID.

func (*MockKeyResolverMockRecorder) ResolveKeyAgreementKey

func (mr *MockKeyResolverMockRecorder) ResolveKeyAgreementKey(id interface{}) *gomock.Call

ResolveKeyAgreementKey indicates an expected call of ResolveKeyAgreementKey.

func (*MockKeyResolverMockRecorder) ResolvePublicKey

func (mr *MockKeyResolverMockRecorder) ResolvePublicKey(kid, sourceTransactionsRefs interface{}) *gomock.Call

ResolvePublicKey indicates an expected call of ResolvePublicKey.

func (*MockKeyResolverMockRecorder) ResolvePublicKeyInTime

func (mr *MockKeyResolverMockRecorder) ResolvePublicKeyInTime(kid, validAt interface{}) *gomock.Call

ResolvePublicKeyInTime indicates an expected call of ResolvePublicKeyInTime.

func (*MockKeyResolverMockRecorder) ResolveSigningKey

func (mr *MockKeyResolverMockRecorder) ResolveSigningKey(keyID, validAt interface{}) *gomock.Call

ResolveSigningKey indicates an expected call of ResolveSigningKey.

func (*MockKeyResolverMockRecorder) ResolveSigningKeyID

func (mr *MockKeyResolverMockRecorder) ResolveSigningKeyID(holder, validAt interface{}) *gomock.Call

ResolveSigningKeyID indicates an expected call of ResolveSigningKeyID.

type MockPredicate

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

MockPredicate is a mock of Predicate interface.

func NewMockPredicate

func NewMockPredicate(ctrl *gomock.Controller) *MockPredicate

NewMockPredicate creates a new mock instance.

func (*MockPredicate) EXPECT

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

func (*MockPredicate) Match

func (m *MockPredicate) Match(arg0 did.Document, arg1 DocumentMetadata) bool

Match mocks base method.

type MockPredicateMockRecorder

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

MockPredicateMockRecorder is the mock recorder for MockPredicate.

func (*MockPredicateMockRecorder) Match

func (mr *MockPredicateMockRecorder) Match(arg0, arg1 interface{}) *gomock.Call

Match indicates an expected call of Match.

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

func (m *MockStore) EXPECT() *MockStoreMockRecorder

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

func (*MockStore) Iterate

func (m *MockStore) Iterate(fn DocIterator) error

Iterate mocks base method.

func (*MockStore) Processed

func (m *MockStore) Processed(hash hash.SHA256Hash) (bool, error)

Processed mocks base method.

func (*MockStore) Resolve

func (m *MockStore) Resolve(id did.DID, metadata *ResolveMetadata) (*did.Document, *DocumentMetadata, error)

Resolve mocks base method.

func (*MockStore) Update

func (m *MockStore) Update(id did.DID, current hash.SHA256Hash, next did.Document, metadata *DocumentMetadata) error

Update mocks base method.

func (*MockStore) Write

func (m *MockStore) Write(document did.Document, metadata DocumentMetadata) error

Write mocks base method.

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) Iterate

func (mr *MockStoreMockRecorder) Iterate(fn interface{}) *gomock.Call

Iterate indicates an expected call of Iterate.

func (*MockStoreMockRecorder) Processed

func (mr *MockStoreMockRecorder) Processed(hash interface{}) *gomock.Call

Processed indicates an expected call of Processed.

func (*MockStoreMockRecorder) Resolve

func (mr *MockStoreMockRecorder) Resolve(id, metadata interface{}) *gomock.Call

Resolve indicates an expected call of Resolve.

func (*MockStoreMockRecorder) Update

func (mr *MockStoreMockRecorder) Update(id, current, next, metadata interface{}) *gomock.Call

Update indicates an expected call of Update.

func (*MockStoreMockRecorder) Write

func (mr *MockStoreMockRecorder) Write(document, metadata interface{}) *gomock.Call

Write indicates an expected call of Write.

type MockVDR

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

MockVDR is a mock of VDR interface.

func NewMockVDR

func NewMockVDR(ctrl *gomock.Controller) *MockVDR

NewMockVDR creates a new mock instance.

func (*MockVDR) ConflictedDocuments

func (m *MockVDR) ConflictedDocuments() ([]did.Document, []DocumentMetadata, error)

ConflictedDocuments mocks base method.

func (*MockVDR) Create

func (m *MockVDR) Create(options DIDCreationOptions) (*did.Document, crypto0.Key, error)

Create mocks base method.

func (*MockVDR) EXPECT

func (m *MockVDR) EXPECT() *MockVDRMockRecorder

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

func (*MockVDR) Update

func (m *MockVDR) Update(id did.DID, current hash.SHA256Hash, next did.Document, metadata *DocumentMetadata) error

Update mocks base method.

type MockVDRMockRecorder

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

MockVDRMockRecorder is the mock recorder for MockVDR.

func (*MockVDRMockRecorder) ConflictedDocuments

func (mr *MockVDRMockRecorder) ConflictedDocuments() *gomock.Call

ConflictedDocuments indicates an expected call of ConflictedDocuments.

func (*MockVDRMockRecorder) Create

func (mr *MockVDRMockRecorder) Create(options interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockVDRMockRecorder) Update

func (mr *MockVDRMockRecorder) Update(id, current, next, metadata interface{}) *gomock.Call

Update indicates an expected call of Update.

type Predicate

type Predicate interface {
	// Match returns true if the given DID Document passes the predicate condition
	Match(did.Document, DocumentMetadata) bool
}

Predicate is an interface for abstracting search options on DID documents

type ResolveMetadata

type ResolveMetadata struct {
	// Resolve the version which is valid at this time
	ResolveTime *time.Time
	// if provided, use the version which matches this exact hash
	Hash *hash.SHA256Hash
	// SourceTransaction must match a TX hash from the metadata.SourceTransaction field, if provided
	SourceTransaction *hash.SHA256Hash
	// Allow DIDs which are deactivated
	AllowDeactivated bool
}

ResolveMetadata contains metadata for the resolver.

type Store

type Store interface {
	// Processed returns true if a DID Document has already been processed for the given TX hash.
	Processed(hash hash.SHA256Hash) (bool, error)
	// Resolve returns the DID Document for the provided DID.
	// If metadata is not provided the latest version is returned.
	// If metadata is provided then the result is filtered or scoped on that metadata.
	// It returns ErrNotFound if there are no corresponding DID documents or when the DID Documents are disjoint with the provided ResolveMetadata
	Resolve(id did.DID, metadata *ResolveMetadata) (*did.Document, *DocumentMetadata, error)
	// Iterate loops over all the latest versions of the stored DID Documents and applies fn.
	// Calling any of the Store's functions from the given fn might cause a deadlock.
	Iterate(fn DocIterator) error

	DocWriter
	DocUpdater
}

Store is the interface that groups all low level VDR DID storage operations.

type VDR

type VDR interface {
	DocCreator
	DocUpdater

	// ConflictedDocuments returns the DID Document and metadata of all documents with a conflict.
	ConflictedDocuments() ([]did.Document, []DocumentMetadata, error)
}

VDR defines the public end facing methods for the Verifiable Data Registry.

Jump to

Keyboard shortcuts

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