Documentation
¶
Overview ¶
Package didsubject is a generated GoMock package.
Index ¶
- Variables
- func NewIDForService(service did.Service) string
- type CreationOption
- type CreationOptions
- type DIDDocumentManager
- type DIDManager
- type DocumentManager
- type DocumentMigration
- type DocumentOwner
- type EncryptionKeyCreationOption
- type Manager
- type MethodManager
- type MockCreationOption
- type MockCreationOptionMockRecorder
- type MockCreationOptions
- type MockCreationOptionsMockRecorder
- type MockDocumentManager
- type MockDocumentManagerMockRecorder
- type MockDocumentMigration
- type MockDocumentMigrationMockRecorder
- type MockDocumentOwner
- type MockDocumentOwnerMockRecorder
- type MockManager
- func (m *MockManager) AddVerificationMethod(ctx context.Context, subject string, keyUsage orm.DIDKeyFlags) ([]did.VerificationMethod, error)
- func (m *MockManager) Create(ctx context.Context, options CreationOptions) ([]did.Document, string, error)
- func (m *MockManager) CreateService(ctx context.Context, subject string, service did.Service) ([]did.Service, error)
- func (m *MockManager) Deactivate(ctx context.Context, subject string) error
- func (m *MockManager) DeleteService(ctx context.Context, subject string, serviceID ssi.URI) error
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) Exists(ctx context.Context, subject string) (bool, error)
- func (m *MockManager) FindServices(ctx context.Context, subject string, serviceType *string) ([]did.Service, error)
- func (m *MockManager) List(ctx context.Context) (map[string][]did.DID, error)
- func (m *MockManager) ListDIDs(ctx context.Context, subject string) ([]did.DID, error)
- func (m *MockManager) Rollback(ctx context.Context)
- func (m *MockManager) UpdateService(ctx context.Context, subject string, serviceID ssi.URI, service did.Service) ([]did.Service, error)
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) AddVerificationMethod(ctx, subject, keyUsage any) *gomock.Call
- func (mr *MockManagerMockRecorder) Create(ctx, options any) *gomock.Call
- func (mr *MockManagerMockRecorder) CreateService(ctx, subject, service any) *gomock.Call
- func (mr *MockManagerMockRecorder) Deactivate(ctx, subject any) *gomock.Call
- func (mr *MockManagerMockRecorder) DeleteService(ctx, subject, serviceID any) *gomock.Call
- func (mr *MockManagerMockRecorder) Exists(ctx, subject any) *gomock.Call
- func (mr *MockManagerMockRecorder) FindServices(ctx, subject, serviceType any) *gomock.Call
- func (mr *MockManagerMockRecorder) List(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) ListDIDs(ctx, subject any) *gomock.Call
- func (mr *MockManagerMockRecorder) Rollback(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) UpdateService(ctx, subject, serviceID, service any) *gomock.Call
- type MockMethodManager
- func (m *MockMethodManager) Commit(ctx context.Context, event orm.DIDChangeLog) error
- func (m *MockMethodManager) EXPECT() *MockMethodManagerMockRecorder
- func (m *MockMethodManager) IsCommitted(ctx context.Context, event orm.DIDChangeLog) (bool, error)
- func (m *MockMethodManager) NewDocument(ctx context.Context, keyFlags orm.DIDKeyFlags) (*orm.DidDocument, error)
- func (m *MockMethodManager) NewVerificationMethod(ctx context.Context, controller did.DID, keyFlags orm.DIDKeyFlags) (*did.VerificationMethod, error)
- type MockMethodManagerMockRecorder
- func (mr *MockMethodManagerMockRecorder) Commit(ctx, event any) *gomock.Call
- func (mr *MockMethodManagerMockRecorder) IsCommitted(ctx, event any) *gomock.Call
- func (mr *MockMethodManagerMockRecorder) NewDocument(ctx, keyFlags any) *gomock.Call
- func (mr *MockMethodManagerMockRecorder) NewVerificationMethod(ctx, controller, keyFlags any) *gomock.Call
- type NutsLegacyNamingOption
- type Resolver
- type SkipAssertionKeyCreationOption
- type SqlDIDDocumentManager
- type SqlDIDManager
- func (s SqlDIDManager) Add(subject string, did did.DID) (*orm.DID, error)
- func (s SqlDIDManager) All() ([]orm.DID, error)
- func (s SqlDIDManager) Delete(did did.DID) error
- func (s SqlDIDManager) DeleteAll(subject string) error
- func (s SqlDIDManager) Find(id did.DID) (*orm.DID, error)
- func (s SqlDIDManager) FindBySubject(subject string) ([]orm.DID, error)
- func (s SqlDIDManager) SubjectExists(subject string) (bool, error)
- type SqlManager
- func (r *SqlManager) AddVerificationMethod(ctx context.Context, subject string, keyUsage orm.DIDKeyFlags) ([]did.VerificationMethod, error)
- func (r *SqlManager) Create(ctx context.Context, options CreationOptions) ([]did.Document, string, error)
- func (r *SqlManager) CreateService(ctx context.Context, subject string, service did.Service) ([]did.Service, error)
- func (r *SqlManager) Deactivate(ctx context.Context, subject string) error
- func (r *SqlManager) DeleteService(ctx context.Context, subject string, serviceID ssi.URI) error
- func (r *SqlManager) Exists(_ context.Context, subject string) (bool, error)
- func (r *SqlManager) FindServices(_ context.Context, subject string, serviceType *string) ([]did.Service, error)
- func (r *SqlManager) List(ctx context.Context) (map[string][]did.DID, error)
- func (r *SqlManager) ListDIDs(_ context.Context, subject string) ([]did.DID, error)
- func (r *SqlManager) MigrateAddWebToNuts(ctx context.Context, id did.DID) error
- func (r *SqlManager) MigrateDIDHistoryToSQL(id did.DID, subject string, ...) error
- func (r *SqlManager) Rollback(ctx context.Context)
- func (r *SqlManager) UpdateService(ctx context.Context, subject string, serviceID ssi.URI, service did.Service) ([]did.Service, error)
- type SubjectCreationOption
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidService = errors.New("invalid DID document service")
ErrInvalidService is returned when a service is invalid, e.g. invalid field values, duplicate ID, not found, etc.
var ErrKeyAgreementNotSupported = errors.New("key agreement not supported for did:web")
ErrKeyAgreementNotSupported is returned key agreement is required for did:web.
var ErrSubjectAlreadyExists = errors.New("subject already exists")
ErrSubjectAlreadyExists is returned when a subject already exists.
var ErrSubjectNotFound = errors.New("subject not found")
ErrSubjectNotFound is returned when a subject is not found.
var ErrSubjectValidation = errors.New("subject creation validation error")
ErrSubjectValidation is returned when the subject creation request is invalid.
var ErrUnsupportedDIDMethod = errors.New("unsupported DID method")
ErrUnsupportedDIDMethod is returned when a DID method is not supported.
Functions ¶
func NewIDForService ¶
NewIDForService generates a unique ID for a service based on the service data. This is compatible with all DID methods.
Types ¶
type CreationOption ¶
type CreationOption interface {
}
type CreationOptions ¶
type CreationOptions interface {
// With adds an option to the CreationOptions.
// It returns a new CreationOptions instance.
// If the same option is specified multiple times, the last instance will be used.
With(option CreationOption) CreationOptions
// All returns all the options.
All() []CreationOption
}
CreationOptions defines options for creating DID Documents.
func DefaultCreationOptions ¶
func DefaultCreationOptions() CreationOptions
DefaultCreationOptions returns a default CreationOptions instance.
type DIDDocumentManager ¶
type DIDDocumentManager interface {
// CreateOrUpdate adds a new version of a DID document, starts at 1
// If the DID does not exist yet, it will be created
// It adds all verification methods and services to the DID document
// Not passing any verification methods will create an empty DID document, deactivation checking should be done by the caller
CreateOrUpdate(did orm.DID, verificationMethods []orm.VerificationMethod, services []orm.Service) (*orm.DidDocument, error)
// Latest returns the latest version of a DID document
// if notAfter is given, it will return the latest version before that time
Latest(did did.DID, notAfter *time.Time) (*orm.DidDocument, error)
}
DIDDocumentManager is the interface to change data for the did_document table
type DIDManager ¶
type DIDManager interface {
// Add adds a new DID to the database, this is also done via DIDDocumentManager.CreateOrUpdate
Add(subject string, did did.DID) (*orm.DID, error)
// All returns all DIDs in the database
All() ([]orm.DID, error)
// Delete removes a DID from the database
Delete(did did.DID) error
// DeleteAll removes all DIDs for a subject from the database
DeleteAll(subject string) error
// Find returns a DID by its ID
Find(id did.DID) (*orm.DID, error)
// FindBySubject returns all DIDs for a subject
FindBySubject(subject string) ([]orm.DID, error)
}
DIDManager is the interface to change data for the did table
type DocumentManager ¶
type DocumentManager interface {
// Update replaces the DID document identified by DID with the nextVersion
// Deprecated: only did:nuts implements it, new methods should higher level functions, then this method can become private
// If the DID Document is not found, ErrNotFound is returned
// If the DID Document is not managed by this node, ErrDIDNotManagedByThisNode is returned
Update(ctx context.Context, id did.DID, next did.Document) error
// RemoveVerificationMethod removes a VerificationMethod from a DID document.
// Deprecated: only relevant for v1 API calls.
// 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(ctx context.Context, id did.DID, keyID did.DIDURL) error
}
DocumentManager is the interface that groups several higher level methods to create and update DID documents. Deprecated Only used for V1 API calls.
type DocumentMigration ¶
type DocumentMigration interface {
// MigrateDIDHistoryToSQL is used to migrate the history of a DID Document to SQL.
// It adds all versions of a DID Document up to a deactivated version. Any changes after a deactivation are not migrated.
// getHistory retrieves the history of the DID since the requested version.
MigrateDIDHistoryToSQL(id did.DID, subject string, getHistory func(id did.DID, sinceVersion int) ([]orm.MigrationDocument, error)) error
// MigrateAddWebToNuts checks if the provided did:nuts DID adds a did:web DID under the same subject if does not already have one.
// It does not check that id is a did:nuts DID
MigrateAddWebToNuts(ctx context.Context, id did.DID) error
}
DocumentMigration is used to migrate DID document versions to the SQL DB. This should only be used for DID documents managed by this node.
type DocumentOwner ¶
type DocumentOwner interface {
// IsOwner returns true if the DID Document is owned by the node, meaning there are private keys present for the DID Document.
IsOwner(context.Context, did.DID) (bool, error)
// ListOwned returns all the DIDs owned by the node.
ListOwned(ctx context.Context) ([]did.DID, error)
}
DocumentOwner is the interface for checking DID document ownership (presence of private keys).
type EncryptionKeyCreationOption ¶
type EncryptionKeyCreationOption struct{}
EncryptionKeyCreationOption signals that a separate RSA key should be created for encryption purposes.
type Manager ¶
type Manager interface {
// Create creates a new DID document for each method and returns them.
// The DID subject is also returned
Create(ctx context.Context, options CreationOptions) ([]did.Document, string, error)
// Deactivate deactivates DID documents for a subject, making it unusable for future interactions.
// If no documents are found, an error is returned.
Deactivate(ctx context.Context, subject string) error
// List returns all subjects and their DIDs.
List(ctx context.Context) (map[string][]did.DID, error)
// ListDIDs returns all DIDs for a subject
ListDIDs(ctx context.Context, subject string) ([]did.DID, error)
// Exists returns true if the subject exists
Exists(ctx context.Context, subject string) (bool, error)
// CreateService creates a new service in DID documents for the given subject.
// The service ID will be generated.
CreateService(ctx context.Context, subject string, service did.Service) ([]did.Service, error)
// FindServices returns services for a given subject matching type if given.
// Duplicate services (based on ID) are ignored.
FindServices(ctx context.Context, subject string, serviceType *string) ([]did.Service, error)
// UpdateService updates a service in the DID document identified by serviceID.
// It'll match any service for the subject based on the fragment. This allows for updating services across multiple DID methods.
UpdateService(ctx context.Context, subject string, serviceID ssi.URI, service did.Service) ([]did.Service, error)
// DeleteService deletes services in the DID documents for a given subject.
// It'll match any service for the subject based on the fragment.
// It returns an error if no services have been deleted.
DeleteService(ctx context.Context, subject string, serviceID ssi.URI) error
// AddVerificationMethod generates new keys and adds them, wrapped as a VerificationMethod, to all DID documents of a subject.
// For each DID method a new key will be generated.
// It returns an ErrNotFound when the subject could not be found.
// It returns an ErrDeactivated when the subject has the deactivated state.
AddVerificationMethod(ctx context.Context, subject string, keyUsage orm.DIDKeyFlags) ([]did.VerificationMethod, error)
// Rollback queries the did_change_log table for all changes that are older than 1 minute.
// Any entry that's still there is considered not committed and will be rolled back.
// All DID Document versions that are part of the same transaction_id will be deleted.
// This works because did:web is always committed and did:nuts might not be. So the DB state actually only depends on the result of the did:nuts network operation result.
Rollback(ctx context.Context)
}
Manager abstracts DID Document management away from the API caller. It manages DIDs for a DID subject.
type MethodManager ¶
type MethodManager interface {
// NewDocument generates a new DID document for the given subject.
// This is done by the method manager since the DID might depend on method specific rules.
// keyFlags is a hard requirement, same as NewVerificationMethod's.
NewDocument(ctx context.Context, keyFlags orm.DIDKeyFlags) (*orm.DidDocument, error)
// NewVerificationMethod generates a new VerificationMethod for the given subject.
// This is done by the method manager since the VM ID might depend on method specific rules.
// keyFlags is a hard requirement: if the underlying key store backend can't back every requested
// usage for the generated key (e.g. an Azure Key Vault EC key can sign but can't back
// KeyAgreement, since Azure Key Vault doesn't support decryption/ECDH with it), no key is created
// and an error is returned.
NewVerificationMethod(ctx context.Context, controller did.DID, keyFlags orm.DIDKeyFlags) (*did.VerificationMethod, error)
// Commit is called after changes are made to the primary db.
// On success, the caller will remove/update the DID changelog.
Commit(ctx context.Context, event orm.DIDChangeLog) error
// IsCommitted checks if the event is already committed for the specific method.
// A mismatch can occur if the method commits before the db is updated (db failure).
// If a change is not committed, a rollback of the primary db will occur (delete of that version)
IsCommitted(ctx context.Context, event orm.DIDChangeLog) (bool, error)
}
MethodManager keeps DID method specific state in sync with the DID sql database.
type MockCreationOption ¶
type MockCreationOption struct {
// contains filtered or unexported fields
}
MockCreationOption is a mock of CreationOption interface.
func NewMockCreationOption ¶
func NewMockCreationOption(ctrl *gomock.Controller) *MockCreationOption
NewMockCreationOption creates a new mock instance.
func (*MockCreationOption) EXPECT ¶
func (m *MockCreationOption) EXPECT() *MockCreationOptionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCreationOptionMockRecorder ¶
type MockCreationOptionMockRecorder struct {
// contains filtered or unexported fields
}
MockCreationOptionMockRecorder is the mock recorder for MockCreationOption.
type MockCreationOptions ¶
type MockCreationOptions struct {
// contains filtered or unexported fields
}
MockCreationOptions is a mock of CreationOptions interface.
func NewMockCreationOptions ¶
func NewMockCreationOptions(ctrl *gomock.Controller) *MockCreationOptions
NewMockCreationOptions creates a new mock instance.
func (*MockCreationOptions) All ¶
func (m *MockCreationOptions) All() []CreationOption
All mocks base method.
func (*MockCreationOptions) EXPECT ¶
func (m *MockCreationOptions) EXPECT() *MockCreationOptionsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockCreationOptions) With ¶
func (m *MockCreationOptions) With(option CreationOption) CreationOptions
With mocks base method.
type MockCreationOptionsMockRecorder ¶
type MockCreationOptionsMockRecorder struct {
// contains filtered or unexported fields
}
MockCreationOptionsMockRecorder is the mock recorder for MockCreationOptions.
func (*MockCreationOptionsMockRecorder) All ¶
func (mr *MockCreationOptionsMockRecorder) All() *gomock.Call
All indicates an expected call of All.
type MockDocumentManager ¶
type MockDocumentManager struct {
// contains filtered or unexported fields
}
MockDocumentManager is a mock of DocumentManager interface.
func NewMockDocumentManager ¶
func NewMockDocumentManager(ctrl *gomock.Controller) *MockDocumentManager
NewMockDocumentManager creates a new mock instance.
func (*MockDocumentManager) EXPECT ¶
func (m *MockDocumentManager) EXPECT() *MockDocumentManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDocumentManager) RemoveVerificationMethod ¶
func (m *MockDocumentManager) RemoveVerificationMethod(ctx context.Context, id did.DID, keyID did.DIDURL) error
RemoveVerificationMethod mocks base method.
type MockDocumentManagerMockRecorder ¶
type MockDocumentManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockDocumentManagerMockRecorder is the mock recorder for MockDocumentManager.
func (*MockDocumentManagerMockRecorder) RemoveVerificationMethod ¶
func (mr *MockDocumentManagerMockRecorder) RemoveVerificationMethod(ctx, id, keyID any) *gomock.Call
RemoveVerificationMethod indicates an expected call of RemoveVerificationMethod.
type MockDocumentMigration ¶
type MockDocumentMigration struct {
// contains filtered or unexported fields
}
MockDocumentMigration is a mock of DocumentMigration interface.
func NewMockDocumentMigration ¶
func NewMockDocumentMigration(ctrl *gomock.Controller) *MockDocumentMigration
NewMockDocumentMigration creates a new mock instance.
func (*MockDocumentMigration) EXPECT ¶
func (m *MockDocumentMigration) EXPECT() *MockDocumentMigrationMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDocumentMigration) MigrateAddWebToNuts ¶
MigrateAddWebToNuts mocks base method.
func (*MockDocumentMigration) MigrateDIDHistoryToSQL ¶
func (m *MockDocumentMigration) MigrateDIDHistoryToSQL(id did.DID, subject string, getHistory func(did.DID, int) ([]orm.MigrationDocument, error)) error
MigrateDIDHistoryToSQL mocks base method.
type MockDocumentMigrationMockRecorder ¶
type MockDocumentMigrationMockRecorder struct {
// contains filtered or unexported fields
}
MockDocumentMigrationMockRecorder is the mock recorder for MockDocumentMigration.
func (*MockDocumentMigrationMockRecorder) MigrateAddWebToNuts ¶
func (mr *MockDocumentMigrationMockRecorder) MigrateAddWebToNuts(ctx, id any) *gomock.Call
MigrateAddWebToNuts indicates an expected call of MigrateAddWebToNuts.
func (*MockDocumentMigrationMockRecorder) MigrateDIDHistoryToSQL ¶
func (mr *MockDocumentMigrationMockRecorder) MigrateDIDHistoryToSQL(id, subject, getHistory any) *gomock.Call
MigrateDIDHistoryToSQL indicates an expected call of MigrateDIDHistoryToSQL.
type MockDocumentOwner ¶
type MockDocumentOwner struct {
// contains filtered or unexported fields
}
MockDocumentOwner is a mock of DocumentOwner interface.
func NewMockDocumentOwner ¶
func NewMockDocumentOwner(ctrl *gomock.Controller) *MockDocumentOwner
NewMockDocumentOwner creates a new mock instance.
func (*MockDocumentOwner) EXPECT ¶
func (m *MockDocumentOwner) EXPECT() *MockDocumentOwnerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockDocumentOwnerMockRecorder ¶
type MockDocumentOwnerMockRecorder struct {
// contains filtered or unexported fields
}
MockDocumentOwnerMockRecorder is the mock recorder for MockDocumentOwner.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) AddVerificationMethod ¶
func (m *MockManager) AddVerificationMethod(ctx context.Context, subject string, keyUsage orm.DIDKeyFlags) ([]did.VerificationMethod, error)
AddVerificationMethod mocks base method.
func (*MockManager) Create ¶
func (m *MockManager) Create(ctx context.Context, options CreationOptions) ([]did.Document, string, error)
Create mocks base method.
func (*MockManager) CreateService ¶
func (m *MockManager) CreateService(ctx context.Context, subject string, service did.Service) ([]did.Service, error)
CreateService mocks base method.
func (*MockManager) Deactivate ¶
func (m *MockManager) Deactivate(ctx context.Context, subject string) error
Deactivate mocks base method.
func (*MockManager) DeleteService ¶
DeleteService mocks base method.
func (*MockManager) EXPECT ¶
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) FindServices ¶
func (m *MockManager) FindServices(ctx context.Context, subject string, serviceType *string) ([]did.Service, error)
FindServices mocks base method.
func (*MockManager) Rollback ¶
func (m *MockManager) Rollback(ctx context.Context)
Rollback mocks base method.
type MockManagerMockRecorder ¶
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) AddVerificationMethod ¶
func (mr *MockManagerMockRecorder) AddVerificationMethod(ctx, subject, keyUsage any) *gomock.Call
AddVerificationMethod indicates an expected call of AddVerificationMethod.
func (*MockManagerMockRecorder) Create ¶
func (mr *MockManagerMockRecorder) Create(ctx, options any) *gomock.Call
Create indicates an expected call of Create.
func (*MockManagerMockRecorder) CreateService ¶
func (mr *MockManagerMockRecorder) CreateService(ctx, subject, service any) *gomock.Call
CreateService indicates an expected call of CreateService.
func (*MockManagerMockRecorder) Deactivate ¶
func (mr *MockManagerMockRecorder) Deactivate(ctx, subject any) *gomock.Call
Deactivate indicates an expected call of Deactivate.
func (*MockManagerMockRecorder) DeleteService ¶
func (mr *MockManagerMockRecorder) DeleteService(ctx, subject, serviceID any) *gomock.Call
DeleteService indicates an expected call of DeleteService.
func (*MockManagerMockRecorder) Exists ¶
func (mr *MockManagerMockRecorder) Exists(ctx, subject any) *gomock.Call
Exists indicates an expected call of Exists.
func (*MockManagerMockRecorder) FindServices ¶
func (mr *MockManagerMockRecorder) FindServices(ctx, subject, serviceType any) *gomock.Call
FindServices indicates an expected call of FindServices.
func (*MockManagerMockRecorder) List ¶
func (mr *MockManagerMockRecorder) List(ctx any) *gomock.Call
List indicates an expected call of List.
func (*MockManagerMockRecorder) ListDIDs ¶
func (mr *MockManagerMockRecorder) ListDIDs(ctx, subject any) *gomock.Call
ListDIDs indicates an expected call of ListDIDs.
func (*MockManagerMockRecorder) Rollback ¶
func (mr *MockManagerMockRecorder) Rollback(ctx any) *gomock.Call
Rollback indicates an expected call of Rollback.
func (*MockManagerMockRecorder) UpdateService ¶
func (mr *MockManagerMockRecorder) UpdateService(ctx, subject, serviceID, service any) *gomock.Call
UpdateService indicates an expected call of UpdateService.
type MockMethodManager ¶
type MockMethodManager struct {
// contains filtered or unexported fields
}
MockMethodManager is a mock of MethodManager interface.
func NewMockMethodManager ¶
func NewMockMethodManager(ctrl *gomock.Controller) *MockMethodManager
NewMockMethodManager creates a new mock instance.
func (*MockMethodManager) Commit ¶
func (m *MockMethodManager) Commit(ctx context.Context, event orm.DIDChangeLog) error
Commit mocks base method.
func (*MockMethodManager) EXPECT ¶
func (m *MockMethodManager) EXPECT() *MockMethodManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMethodManager) IsCommitted ¶
func (m *MockMethodManager) IsCommitted(ctx context.Context, event orm.DIDChangeLog) (bool, error)
IsCommitted mocks base method.
func (*MockMethodManager) NewDocument ¶
func (m *MockMethodManager) NewDocument(ctx context.Context, keyFlags orm.DIDKeyFlags) (*orm.DidDocument, error)
NewDocument mocks base method.
func (*MockMethodManager) NewVerificationMethod ¶
func (m *MockMethodManager) NewVerificationMethod(ctx context.Context, controller did.DID, keyFlags orm.DIDKeyFlags) (*did.VerificationMethod, error)
NewVerificationMethod mocks base method.
type MockMethodManagerMockRecorder ¶
type MockMethodManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockMethodManagerMockRecorder is the mock recorder for MockMethodManager.
func (*MockMethodManagerMockRecorder) Commit ¶
func (mr *MockMethodManagerMockRecorder) Commit(ctx, event any) *gomock.Call
Commit indicates an expected call of Commit.
func (*MockMethodManagerMockRecorder) IsCommitted ¶
func (mr *MockMethodManagerMockRecorder) IsCommitted(ctx, event any) *gomock.Call
IsCommitted indicates an expected call of IsCommitted.
func (*MockMethodManagerMockRecorder) NewDocument ¶
func (mr *MockMethodManagerMockRecorder) NewDocument(ctx, keyFlags any) *gomock.Call
NewDocument indicates an expected call of NewDocument.
func (*MockMethodManagerMockRecorder) NewVerificationMethod ¶
func (mr *MockMethodManagerMockRecorder) NewVerificationMethod(ctx, controller, keyFlags any) *gomock.Call
NewVerificationMethod indicates an expected call of NewVerificationMethod.
type NutsLegacyNamingOption ¶
type NutsLegacyNamingOption struct{}
NutsLegacyNamingOption will make the subject equal to the Nuts DID.
type SkipAssertionKeyCreationOption ¶
type SkipAssertionKeyCreationOption struct{}
SkipAssertionKeyCreationOption signals that no assertion key should be created.
type SqlDIDDocumentManager ¶
type SqlDIDDocumentManager struct {
// contains filtered or unexported fields
}
SqlDIDDocumentManager is the implementation of the DIDDocumentManager interface
func NewDIDDocumentManager ¶
func NewDIDDocumentManager(tx *gorm.DB) *SqlDIDDocumentManager
NewDIDDocumentManager creates a new DIDDocumentManager for an open transaction
func (*SqlDIDDocumentManager) CreateOrUpdate ¶
func (s *SqlDIDDocumentManager) CreateOrUpdate(did orm.DID, verificationMethods []orm.VerificationMethod, services []orm.Service) (*orm.DidDocument, error)
func (*SqlDIDDocumentManager) Latest ¶
func (s *SqlDIDDocumentManager) Latest(did did.DID, resolveTime *time.Time) (*orm.DidDocument, error)
type SqlDIDManager ¶
type SqlDIDManager struct {
// contains filtered or unexported fields
}
SqlDIDManager is the implementation of the DIDManager interface
func NewDIDManager ¶
func NewDIDManager(tx *gorm.DB) *SqlDIDManager
NewDIDManager creates a new DIDManager for an open transaction
func (SqlDIDManager) DeleteAll ¶
func (s SqlDIDManager) DeleteAll(subject string) error
func (SqlDIDManager) FindBySubject ¶
func (s SqlDIDManager) FindBySubject(subject string) ([]orm.DID, error)
func (SqlDIDManager) SubjectExists ¶
func (s SqlDIDManager) SubjectExists(subject string) (bool, error)
type SqlManager ¶
type SqlManager struct {
DB *gorm.DB
MethodManagers map[string]MethodManager
KeyStore nutsCrypto.KeyStore
// PreferredOrder is the order in which the methods are preferred, which dictates the order in which they are returned.
PreferredOrder []string
}
func New ¶
func New(db *gorm.DB, methodManagers map[string]MethodManager, keyStore nutsCrypto.KeyStore, preferredOrder []string) *SqlManager
func (*SqlManager) AddVerificationMethod ¶
func (r *SqlManager) AddVerificationMethod(ctx context.Context, subject string, keyUsage orm.DIDKeyFlags) ([]did.VerificationMethod, error)
func (*SqlManager) Create ¶
func (r *SqlManager) Create(ctx context.Context, options CreationOptions) ([]did.Document, string, error)
Create generates new DID Documents
func (*SqlManager) CreateService ¶
func (r *SqlManager) CreateService(ctx context.Context, subject string, service did.Service) ([]did.Service, error)
CreateService creates a new service in the DID document identified by subjectDID.
func (*SqlManager) Deactivate ¶
func (r *SqlManager) Deactivate(ctx context.Context, subject string) error
func (*SqlManager) DeleteService ¶
DeleteService removes a service from the DID document identified by subjectDID.
func (*SqlManager) FindServices ¶
func (*SqlManager) MigrateAddWebToNuts ¶
func (*SqlManager) MigrateDIDHistoryToSQL ¶
func (*SqlManager) Rollback ¶
func (r *SqlManager) Rollback(ctx context.Context)
Rollback queries the did_change_log table for all changes that are older than 1 minute. Any entry that's still there is considered not committed and will be rolled back. All DID Document versions that are part of the same transaction_id will be deleted. This works because did:web is always committed and did:nuts might not be. So the DB state actually only depends on the result of the did:nuts network operation result.
type SubjectCreationOption ¶
type SubjectCreationOption struct {
Subject string
}
SubjectCreationOption links all create DIDs to the DID Subject