diddoc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDIDNotRegistered thows when requested DID is not present in registry
	ErrDIDNotRegistered = errors.New("DID is not registered")

	// ErrDIDAlreadyRegistered thows when system tries to register DID that is already registered
	ErrDIDAlreadyRegistered = errors.New("DID was already registered")

	// ErrVerificationKeyNotFound thows when requested verification key is not present in DID document
	ErrVerificationKeyNotFound = errors.New("unknown verification method")
)

Functions

This section is empty.

Types

type DIDDoc

type DIDDoc interface {
	// Register registers a new DID document in the registry
	Register(ctx context.Context, did string, vm []types.VerificationMethod, a []string) error

	// Get retrieves a DID document from the registry
	Get(ctx context.Context, did string) (types.DIDDocument, error)

	// GetMetadataHistory returns the history of asset data changes
	GetMetadataHistory(ctx context.Context, did string) (asset.DataArrayVersions, error)

	// SaveMetadata saves metadata to the registry
	SaveMetadata(ctx context.Context, did string, m []asset.Object) error

	// SaveVerificationMethods saves verification methods for patrticular DID
	SaveVerificationMethods(ctx context.Context, did string, vms []types.VerificationMethod, a []string) error

	// GetVerificationKeyByAuthID returns verification key by authentification ID
	GetVerificationKeyByAuthID(ctx context.Context, did, authID string) (cryptotypes.PubKey, error)
}

DIDDoc defines an API for work with DID documents

type Service

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

Service implements DIDDoc

func NewService

func NewService(db immudb.ImmuClient, logger *zap.SugaredLogger) *Service

NewService creates a new instance of DIDDoc service

func (Service) Get

func (s Service) Get(ctx context.Context, did string) (types.DIDDocument, error)

Get implements DIDDoc Get

func (Service) GetMetadataHistory

func (s Service) GetMetadataHistory(ctx context.Context, did string) (asset.DataArrayVersions, error)

GetMetadataHistory implements DIDDoc GetMetadataHistory

func (Service) GetVerificationKeyByAuthID

func (s Service) GetVerificationKeyByAuthID(ctx context.Context, did, authID string) (cryptotypes.PubKey, error)

GetVerificationKeyByAuthID implements DIDDoc GetVerificationKeyByAuthID

func (Service) Register

func (s Service) Register(ctx context.Context, did string, vm []types.VerificationMethod, a []string) error

Register implements DIDDoc Register

func (Service) SaveMetadata

func (s Service) SaveMetadata(ctx context.Context, did string, m []asset.Object) error

SaveMetadata implements DIDDoc SaveMetadata

func (Service) SaveVerificationMethods

func (s Service) SaveVerificationMethods(ctx context.Context, did string, vms []types.VerificationMethod, a []string) error

SaveVerificationMethods implements DIDDoc SaveVerificationMethods

Jump to

Keyboard shortcuts

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