didnuts

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package didnuts is a generated GoMock package.

Index

Constants

View Source
const DIDDocumentType = "application/did+json"

DIDDocumentType contains network transaction mime-type to identify a DID Document in the network.

View Source
const MethodName = "nuts"

MethodName is the DID method name used by Nuts

Variables

View Source
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

View Source
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

func CreateDocument() did.Document

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

func DIDKIDNamingFunc(pKey crypto.PublicKey) (string, error)

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

func NetworkDocumentValidator() did.Validator

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

func (m Manager) Commit(ctx context.Context, change orm.DIDChangeLog) error

func (Manager) Deactivate

func (m Manager) Deactivate(ctx context.Context, id did.DID) error

Deactivate updates the DID Document so it can no longer be updated It removes key material, services and controllers.

func (Manager) IsCommitted

func (m Manager) IsCommitted(_ context.Context, change orm.DIDChangeLog) (bool, error)

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

func (m Manager) RemoveVerificationMethod(ctx context.Context, id did.DID, keyID did.DIDURL) error

RemoveVerificationMethod is a helper function to remove a verificationMethod from a DID Document

func (Manager) Update

func (m Manager) Update(ctx context.Context, id did.DID, next did.Document) error

Update updates a DID Document based on the DID. It only works on did:nuts, so is subject for removal in the future.

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

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

func (*MockAmbassador) Start

func (m *MockAmbassador) Start() error

Start mocks base method.

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.

type Resolver

type Resolver struct {
	Store didstore.Store
}

Resolver implements the DIDResolver interface for resolving did:nuts documents.

func (Resolver) Resolve

Directories

Path Synopsis
Package didstore is a generated GoMock package.
Package didstore is a generated GoMock package.

Jump to

Keyboard shortcuts

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