didman

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

Documentation

Overview

Package didman is a generated GoMock package.

Index

Constants

View Source
const ContactInformationServiceType = "node-contact-info"

ContactInformationServiceType contains the DID service type used for services that contain node contact information.

View Source
const ModuleName = "Didman"

ModuleName contains the name of this module: Didman

Variables

View Source
var ErrServiceInUse = errors.New("service is referenced by 1 or more services")

ErrServiceInUse is returned when a service is deleted but in use by other services

Functions

This section is empty.

Types

type CompoundServiceResolver

type CompoundServiceResolver interface {
	// GetCompoundServiceEndpoint retrieves the endpoint with the specified endpointType from the specified compound service.
	// It returns the serviceEndpoint of the specified service (which must be an absolute URL endpoint).
	// If resolveReferences is true and the specified endpointType contains a reference, it is resolved and the referenced endpoint is returned instead.
	// It returns ErrServiceNotFound if the specified compound service or endpoint can't be found in the DID Document.
	// It returns ErrInvalidServiceQuery if the endpoint doesn't contain a (valid) reference and resolveReferences = true.
	// It returns ErrServiceReferenceToDeep if the endpoint reference is nested too deep.
	GetCompoundServiceEndpoint(id did.DID, compoundServiceType string, endpointType string, resolveReferences bool) (string, error)

	// GetCompoundServices returns a list of all compoundServices defined on the given DID document.
	// It does not include special compound services like ContactInformation
	// It can also return various errors from DocResolver.Resolve
	GetCompoundServices(id did.DID) ([]did.Service, error)
}

CompoundServiceResolver defines high-level operations for resolving services of DID documents.

type ContactInformation

type ContactInformation struct {

	// Email contains the email address for normal priority support
	Email string `json:"email"`

	// Name contains the commonly known name of the service provider
	Name string `json:"name"`

	// Phone contains a phone number for high priority support
	Phone string `json:"phone"`

	// Website contains the URL of the public website of this Service Provider. Can point to a Nuts specific page with more information about the node and how to contact.
	Website string `json:"website"`
}

ContactInformation contains set of contact information entries

type Didman

type Didman interface {
	CompoundServiceResolver

	// AddEndpoint adds a service to a DID Document. The serviceEndpoint is set to the given URL.
	// It returns ErrDuplicateService if a service with the given type already exists.
	// It can also return various errors from DocResolver.Resolve and VDR.Update
	AddEndpoint(id did.DID, serviceType string, u url.URL) (*did.Service, error)

	// DeleteEndpointsByType takes a did and type and removes all endpoint with the type from the DID Document.
	// It returns ErrServiceNotFound if no services with the given type can't be found in the DID Document.
	// It returns ErrServiceInUse if the service is referenced by other services.
	// It can also return various errors from DocResolver.Resolve
	DeleteEndpointsByType(id did.DID, serviceType string) error

	// DeleteService removes a service from a DID Document.
	// It returns ErrServiceInUse if the service is referenced by other services.
	// It returns ErrServiceNotFound if the service can't be found in the DID Document.
	// It can also return various errors from DocResolver.Resolve and VDR.Update
	DeleteService(id ssi.URI) error

	// AddCompoundService adds a compound endpoint to a DID Document.
	// It returns ErrDuplicateService if a service with the given type already exists.
	// It returns ErrInvalidServiceQuery if one of the service references is invalid.
	// It returns ErrReferencedServiceNotAnEndpoint if one of the references does not resolve to a single endpoint URL.
	// It can also return various errors from DocResolver.Resolve and VDR.Update
	AddCompoundService(id did.DID, serviceType string, endpoints map[string]ssi.URI) (*did.Service, error)

	// UpdateContactInformation adds or updates the compoundService with type equal to node-contact-info with provided
	// contact information to the DID Document.
	// It returns the contact information when the update was successful.
	// It can also return various errors from DocResolver.Resolve and VDR.Update
	UpdateContactInformation(id did.DID, information ContactInformation) (*ContactInformation, error)

	// GetContactInformation finds and returns the contact information from the provided DID Document.
	// Returns nil, nil when no contactInformation for the DID was found.
	// It can also return various errors from DocResolver.Resolve
	GetContactInformation(id did.DID) (*ContactInformation, error)

	// SearchOrganizations searches VCR for organizations which's name matches the given query.
	// It then optionally filters on those which have a service of the specified type on their DID Document.
	SearchOrganizations(ctx context.Context, query string, didServiceType *string) ([]OrganizationSearchResult, error)
}

Didman groups all high-level methods for manipulating DID Documents

func NewDidmanInstance

func NewDidmanInstance(docResolver types.DocResolver, store types.Store, vdr types.VDR, vcr vcr.VCR) Didman

NewDidmanInstance creates a new didman instance with services set

type ErrReferencedServiceNotAnEndpoint

type ErrReferencedServiceNotAnEndpoint struct {
	Cause error
}

ErrReferencedServiceNotAnEndpoint is returned when a compound service contains a reference that does not resolve to a single endpoint URL.

func (ErrReferencedServiceNotAnEndpoint) Error

Error returns the error message.

func (ErrReferencedServiceNotAnEndpoint) Is

Is checks whether the other error is also a ErrReferencedServiceNotAnEndpoint

type MockCompoundServiceResolver

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

MockCompoundServiceResolver is a mock of CompoundServiceResolver interface.

func NewMockCompoundServiceResolver

func NewMockCompoundServiceResolver(ctrl *gomock.Controller) *MockCompoundServiceResolver

NewMockCompoundServiceResolver creates a new mock instance.

func (*MockCompoundServiceResolver) EXPECT

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

func (*MockCompoundServiceResolver) GetCompoundServiceEndpoint

func (m *MockCompoundServiceResolver) GetCompoundServiceEndpoint(id did.DID, compoundServiceType, endpointType string, resolveReferences bool) (string, error)

GetCompoundServiceEndpoint mocks base method.

func (*MockCompoundServiceResolver) GetCompoundServices

func (m *MockCompoundServiceResolver) GetCompoundServices(id did.DID) ([]did.Service, error)

GetCompoundServices mocks base method.

type MockCompoundServiceResolverMockRecorder

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

MockCompoundServiceResolverMockRecorder is the mock recorder for MockCompoundServiceResolver.

func (*MockCompoundServiceResolverMockRecorder) GetCompoundServiceEndpoint

func (mr *MockCompoundServiceResolverMockRecorder) GetCompoundServiceEndpoint(id, compoundServiceType, endpointType, resolveReferences interface{}) *gomock.Call

GetCompoundServiceEndpoint indicates an expected call of GetCompoundServiceEndpoint.

func (*MockCompoundServiceResolverMockRecorder) GetCompoundServices

func (mr *MockCompoundServiceResolverMockRecorder) GetCompoundServices(id interface{}) *gomock.Call

GetCompoundServices indicates an expected call of GetCompoundServices.

type MockDidman

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

MockDidman is a mock of Didman interface.

func NewMockDidman

func NewMockDidman(ctrl *gomock.Controller) *MockDidman

NewMockDidman creates a new mock instance.

func (*MockDidman) AddCompoundService

func (m *MockDidman) AddCompoundService(id did.DID, serviceType string, endpoints map[string]go_did.URI) (*did.Service, error)

AddCompoundService mocks base method.

func (*MockDidman) AddEndpoint

func (m *MockDidman) AddEndpoint(id did.DID, serviceType string, u url.URL) (*did.Service, error)

AddEndpoint mocks base method.

func (*MockDidman) DeleteEndpointsByType

func (m *MockDidman) DeleteEndpointsByType(id did.DID, serviceType string) error

DeleteEndpointsByType mocks base method.

func (*MockDidman) DeleteService

func (m *MockDidman) DeleteService(id go_did.URI) error

DeleteService mocks base method.

func (*MockDidman) EXPECT

func (m *MockDidman) EXPECT() *MockDidmanMockRecorder

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

func (*MockDidman) GetCompoundServiceEndpoint

func (m *MockDidman) GetCompoundServiceEndpoint(id did.DID, compoundServiceType, endpointType string, resolveReferences bool) (string, error)

GetCompoundServiceEndpoint mocks base method.

func (*MockDidman) GetCompoundServices

func (m *MockDidman) GetCompoundServices(id did.DID) ([]did.Service, error)

GetCompoundServices mocks base method.

func (*MockDidman) GetContactInformation

func (m *MockDidman) GetContactInformation(id did.DID) (*ContactInformation, error)

GetContactInformation mocks base method.

func (*MockDidman) SearchOrganizations

func (m *MockDidman) SearchOrganizations(ctx context.Context, query string, didServiceType *string) ([]OrganizationSearchResult, error)

SearchOrganizations mocks base method.

func (*MockDidman) UpdateContactInformation

func (m *MockDidman) UpdateContactInformation(id did.DID, information ContactInformation) (*ContactInformation, error)

UpdateContactInformation mocks base method.

type MockDidmanMockRecorder

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

MockDidmanMockRecorder is the mock recorder for MockDidman.

func (*MockDidmanMockRecorder) AddCompoundService

func (mr *MockDidmanMockRecorder) AddCompoundService(id, serviceType, endpoints interface{}) *gomock.Call

AddCompoundService indicates an expected call of AddCompoundService.

func (*MockDidmanMockRecorder) AddEndpoint

func (mr *MockDidmanMockRecorder) AddEndpoint(id, serviceType, u interface{}) *gomock.Call

AddEndpoint indicates an expected call of AddEndpoint.

func (*MockDidmanMockRecorder) DeleteEndpointsByType

func (mr *MockDidmanMockRecorder) DeleteEndpointsByType(id, serviceType interface{}) *gomock.Call

DeleteEndpointsByType indicates an expected call of DeleteEndpointsByType.

func (*MockDidmanMockRecorder) DeleteService

func (mr *MockDidmanMockRecorder) DeleteService(id interface{}) *gomock.Call

DeleteService indicates an expected call of DeleteService.

func (*MockDidmanMockRecorder) GetCompoundServiceEndpoint

func (mr *MockDidmanMockRecorder) GetCompoundServiceEndpoint(id, compoundServiceType, endpointType, resolveReferences interface{}) *gomock.Call

GetCompoundServiceEndpoint indicates an expected call of GetCompoundServiceEndpoint.

func (*MockDidmanMockRecorder) GetCompoundServices

func (mr *MockDidmanMockRecorder) GetCompoundServices(id interface{}) *gomock.Call

GetCompoundServices indicates an expected call of GetCompoundServices.

func (*MockDidmanMockRecorder) GetContactInformation

func (mr *MockDidmanMockRecorder) GetContactInformation(id interface{}) *gomock.Call

GetContactInformation indicates an expected call of GetContactInformation.

func (*MockDidmanMockRecorder) SearchOrganizations

func (mr *MockDidmanMockRecorder) SearchOrganizations(ctx, query, didServiceType interface{}) *gomock.Call

SearchOrganizations indicates an expected call of SearchOrganizations.

func (*MockDidmanMockRecorder) UpdateContactInformation

func (mr *MockDidmanMockRecorder) UpdateContactInformation(id, information interface{}) *gomock.Call

UpdateContactInformation indicates an expected call of UpdateContactInformation.

type OrganizationSearchResult

type OrganizationSearchResult struct {
	// DIDDocument contains the organization's DID Document.
	DIDDocument did.Document `json:"didDocument"`
	// Organization contains the organization's information derived from its Verifiable Credential.
	Organization map[string]interface{} `json:"organization"`
}

OrganizationSearchResult is returned by SearchOrganizations and associates a resulting organization with its DID Document.

Directories

Path Synopsis
api
v1
Package v1 provides primitives to interact with the openapi HTTP API.
Package v1 provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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