Documentation
¶
Overview ¶
Package didnuts is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CreateDocument() did.Document
- func CreateNewVerificationMethodForDID(ctx context.Context, id did.DID, keyCreator nutsCrypto.KeyCreator, ...) (*did.VerificationMethod, error)
- func DIDKIDNamingFunc(pKey crypto.PublicKey) (string, error)
- func DefaultKeyFlags() orm.DIDKeyFlags
- func ManagedDocumentValidator(serviceResolver resolver.ServiceResolver) did.Validator
- func NetworkDocumentValidator() did.Validator
- func ResolveControllers(resolver resolver.DIDResolver, doc did.Document, ...) ([]did.Document, error)
- type Ambassador
- type InvalidServiceError
- type Manager
- func (m Manager) Commit(ctx context.Context, change orm.DIDChangeLog) error
- func (m Manager) Deactivate(ctx context.Context, id did.DID) error
- func (m Manager) IsCommitted(_ context.Context, change orm.DIDChangeLog) (bool, error)
- func (m Manager) NewDocument(ctx context.Context, keyFlags orm.DIDKeyFlags) (*orm.DidDocument, error)
- func (m Manager) NewVerificationMethod(ctx context.Context, id did.DID, requestedFlags orm.DIDKeyFlags) (*did.VerificationMethod, error)
- func (m Manager) RemoveVerificationMethod(ctx context.Context, id did.DID, keyID did.DIDURL) error
- func (m Manager) Update(ctx context.Context, id did.DID, next did.Document) error
- type MockAmbassador
- type MockAmbassadorMockRecorder
- type Resolver
Constants ¶
const DIDDocumentType = "application/did+json"
DIDDocumentType contains network transaction mime-type to identify a DID Document in the network.
const MethodName = "nuts"
MethodName is the DID method name used by Nuts
Variables ¶
var ErrNestedDocumentsTooDeep = errors.New("DID Document controller structure has too many indirections")
ErrNestedDocumentsTooDeep is returned when a DID Document contains a multiple services with the same type
var ErrThumbprintMismatch = errors.New("thumbprint of signing key does not match DID")
ErrThumbprintMismatch is returned when a transaction publishing a new DID is signed with a different key than the DID is generated from
Functions ¶
func CreateDocument ¶
CreateDocument creates an empty DID document with baseline properties set.
func CreateNewVerificationMethodForDID ¶
func CreateNewVerificationMethodForDID(ctx context.Context, id did.DID, keyCreator nutsCrypto.KeyCreator, requiredUsage orm.DIDKeyFlags) (*did.VerificationMethod, error)
CreateNewVerificationMethodForDID creates a new VerificationMethod of type JsonWebKey2020 with a freshly generated key for a given DID. requiredUsage is checked against the key store backend's capability before any key is created; see nutsCrypto.KeyCreator.New.
func DIDKIDNamingFunc ¶
DIDKIDNamingFunc is a function used to name a key used in newly generated DID Documents.
func DefaultKeyFlags ¶
func DefaultKeyFlags() orm.DIDKeyFlags
DefaultKeyFlags returns the default DIDKeyFlags when creating did:nuts DIDs.
func ManagedDocumentValidator ¶
func ManagedDocumentValidator(serviceResolver resolver.ServiceResolver) did.Validator
ManagedDocumentValidator extends NetworkDocumentValidator with extra safety checks to be performed on DID documents managed by this node before they are published on the network.
func NetworkDocumentValidator ¶
NetworkDocumentValidator creates a DID Document validator that checks for inconsistencies in the DID Document: - validate it according to the W3C DID Core Data Model specification - validate it according to the Nuts DID Method specification:
- it checks validationMethods for the following conditions:
- every validationMethod id must have a fragment
- every validationMethod id should have the DID prefix
- every validationMethod id must be unique
- it checks services for the following conditions:
- every service id must have a fragment
- every service id should have the DID prefix
- every service id must be unique
- every service type must be unique
func ResolveControllers ¶
func ResolveControllers(resolver resolver.DIDResolver, doc did.Document, metadata *resolver.ResolveMetadata) ([]did.Document, error)
ResolveControllers finds the DID Document controllers
Types ¶
type Ambassador ¶
type Ambassador interface {
// Configure instructs the ambassador to start receiving DID Documents from the network.
Configure() error
// Start the event listener
Start() error
}
Ambassador acts as integration point between VDR and network by sending DID Documents network and process DID Documents received through the network.
func NewAmbassador ¶
func NewAmbassador(networkClient network.Transactions, didStore didstore.Store, eventManager events.Event) Ambassador
NewAmbassador creates a new Ambassador,
type InvalidServiceError ¶
type InvalidServiceError struct {
Cause error
}
func (InvalidServiceError) Error ¶
func (e InvalidServiceError) Error() string
func (InvalidServiceError) Unwrap ¶
func (e InvalidServiceError) Unwrap() error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cryptoClient nutsCrypto.KeyStore, networkClient network.Transactions, didStore didnutsStore.Store, didResolver resolver.DIDResolver, DB *gorm.DB) *Manager
NewManager creates a new Manager instance.
func (Manager) Deactivate ¶
Deactivate updates the DID Document so it can no longer be updated It removes key material, services and controllers.
func (Manager) IsCommitted ¶
func (Manager) NewDocument ¶
func (m Manager) NewDocument(ctx context.Context, keyFlags orm.DIDKeyFlags) (*orm.DidDocument, error)
NewDocument creates a new did:nuts document backed by a single key that backs every relationship in keyFlags. If the key store backend can't back a requested relationship (e.g. Azure Key Vault can't back KeyAgreement), no key is created and an error is returned: with OpenID4VCI as an alternative to gRPC/DAG private-transaction delivery, a did:nuts document no longer strictly needs KeyAgreement, so callers that don't need it shouldn't request it (see EncryptionKeyCreationOption).
func (Manager) NewVerificationMethod ¶
func (m Manager) NewVerificationMethod(ctx context.Context, id did.DID, requestedFlags orm.DIDKeyFlags) (*did.VerificationMethod, error)
func (Manager) RemoveVerificationMethod ¶
RemoveVerificationMethod is a helper function to remove a verificationMethod from a DID Document
type MockAmbassador ¶
type MockAmbassador struct {
// contains filtered or unexported fields
}
MockAmbassador is a mock of Ambassador interface.
func NewMockAmbassador ¶
func NewMockAmbassador(ctrl *gomock.Controller) *MockAmbassador
NewMockAmbassador creates a new mock instance.
func (*MockAmbassador) Configure ¶
func (m *MockAmbassador) Configure() error
Configure mocks base method.
func (*MockAmbassador) EXPECT ¶
func (m *MockAmbassador) EXPECT() *MockAmbassadorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAmbassadorMockRecorder ¶
type MockAmbassadorMockRecorder struct {
// contains filtered or unexported fields
}
MockAmbassadorMockRecorder is the mock recorder for MockAmbassador.
func (*MockAmbassadorMockRecorder) Configure ¶
func (mr *MockAmbassadorMockRecorder) Configure() *gomock.Call
Configure indicates an expected call of Configure.
func (*MockAmbassadorMockRecorder) Start ¶
func (mr *MockAmbassadorMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.