Documentation ¶
Index ¶
- Constants
- func DefaultService(srv documents.Service, repo documents.Repository, queueSrv queue.TaskQueuer, ...) documents.Service
- func UpdateValidator(repo anchors.AnchorRepository) documents.ValidatorGroup
- type Bootstrapper
- type Data
- type Generic
- func (g *Generic) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, ...) error
- func (g *Generic) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
- func (g *Generic) CalculateDataRoot() ([]byte, error)
- func (g *Generic) CalculateDocumentRoot() ([]byte, error)
- func (g *Generic) CalculateSigningRoot() ([]byte, error)
- func (g *Generic) CollaboratorCanUpdate(updated documents.Model, collaborator identity.DID) error
- func (g *Generic) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proofs []*proofspb.Proof, err error)
- func (g *Generic) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
- func (g *Generic) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
- func (g *Generic) DeriveFromCreatePayload(_ context.Context, payload documents.CreatePayload) error
- func (g *Generic) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Model, error)
- func (g *Generic) DocumentRootTree() (tree *proofs.DocumentTree, err error)
- func (*Generic) DocumentType() string
- func (g *Generic) FromJSON(jsonData []byte) error
- func (g *Generic) GetData() interface{}
- func (g *Generic) JSON() ([]byte, error)
- func (g *Generic) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (g *Generic) Patch(payload documents.UpdatePayload) error
- func (g *Generic) PrepareNewVersion(old documents.Model, collaborators documents.CollaboratorsAccess, ...) (err error)
- func (g *Generic) Scheme() string
- func (g *Generic) Type() reflect.Type
- func (g *Generic) UnpackCoreDocument(cd coredocumentpb.CoreDocument) (err error)
Constants ¶
const (
// Scheme to identify generic document
Scheme = prefix
)
Variables ¶
This section is empty.
Functions ¶
func DefaultService ¶
func DefaultService( srv documents.Service, repo documents.Repository, queueSrv queue.TaskQueuer, jobManager jobs.Manager, anchorRepo anchors.AnchorRepository, ) documents.Service
DefaultService returns the default implementation of the service.
func UpdateValidator ¶
func UpdateValidator(repo anchors.AnchorRepository) documents.ValidatorGroup
UpdateValidator returns a validator group that should be run before updating the generic document
Types ¶
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (Bootstrapper) Bootstrap(ctx map[string]interface{}) error
Bootstrap sets the required storage and registers
type Generic ¶
type Generic struct { *documents.CoreDocument Data Data }
Generic implements the documents.Model for Generic documents
func (*Generic) AddAttributes ¶
func (g *Generic) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, attrs ...documents.Attribute) error
AddAttributes adds attributes to the Generic model.
func (*Generic) CalculateDataRoot ¶
CalculateDataRoot calculates the data root and sets the root to core document.
func (*Generic) CalculateDocumentRoot ¶
CalculateDocumentRoot calculates the document root
func (*Generic) CalculateSigningRoot ¶
CalculateSigningRoot calculates the signing root of the document.
func (*Generic) CollaboratorCanUpdate ¶
CollaboratorCanUpdate checks if the collaborator can update the document.
func (*Generic) CreateNFTProofs ¶
func (g *Generic) CreateNFTProofs( account identity.DID, registry common.Address, tokenID []byte, nftUniqueProof, readAccessProof bool) (proofs []*proofspb.Proof, err error)
CreateNFTProofs creates proofs specific to NFT minting.
func (*Generic) CreateProofs ¶
CreateProofs generates proofs for given fields.
func (*Generic) DeleteAttribute ¶
DeleteAttribute deletes the attribute from the model.
func (*Generic) DeriveFromCreatePayload ¶
DeriveFromCreatePayload unpacks the invoice data from the Payload.
func (*Generic) DeriveFromUpdatePayload ¶
func (g *Generic) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Model, error)
DeriveFromUpdatePayload unpacks the update payload and prepares a new version.
func (*Generic) DocumentRootTree ¶
func (g *Generic) DocumentRootTree() (tree *proofs.DocumentTree, err error)
DocumentRootTree creates and returns the document root tree
func (*Generic) DocumentType ¶
DocumentType returns the generic document type.
func (*Generic) PackCoreDocument ¶
PackCoreDocument packs the Generic into a CoreDocument.
func (*Generic) Patch ¶
func (g *Generic) Patch(payload documents.UpdatePayload) error
Patch merges payload data into model
func (*Generic) PrepareNewVersion ¶
func (g *Generic) PrepareNewVersion(old documents.Model, collaborators documents.CollaboratorsAccess, attrs map[documents.AttrKey]documents.Attribute) (err error)
PrepareNewVersion prepares new version from the old generic.
func (*Generic) UnpackCoreDocument ¶
UnpackCoreDocument unpacks the core document into Generic.