Documentation
¶
Index ¶
- Constants
- func DefaultService(srv documents.Service, repo documents.Repository, anchorSrv anchors.Service) documents.Service
- 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, pad bool) error
- func (g *Generic) CalculateDocumentRoot() ([]byte, error)
- func (g *Generic) CalculateSigningRoot() ([]byte, error)
- func (g *Generic) CollaboratorCanUpdate(updated documents.Document, collaborator identity.DID) error
- func (g *Generic) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proof *documents.DocumentProof, err error)
- func (g *Generic) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
- func (g *Generic) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
- func (g *Generic) DeriveFromClonePayload(_ context.Context, m documents.Document) error
- func (g *Generic) DeriveFromCreatePayload(_ context.Context, payload documents.CreatePayload) error
- func (g *Generic) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, 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.Document, 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, anchorSrv anchors.Service, ) documents.Service
DefaultService returns the default implementation of the service.
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.Document 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) AddNFT ¶
func (g *Generic) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte, pad bool) error
AddNFT adds NFT to the Generic.
func (*Generic) CalculateDocumentRoot ¶
CalculateDocumentRoot calculates the document root
func (*Generic) CalculateSigningRoot ¶
CalculateSigningRoot calculates the signing root of the document.
func (*Generic) CollaboratorCanUpdate ¶
func (g *Generic) CollaboratorCanUpdate(updated documents.Document, collaborator identity.DID) error
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) (proof *documents.DocumentProof, err error)
CreateNFTProofs creates proofs specific to NFT minting.
func (*Generic) CreateProofs ¶
func (g *Generic) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
CreateProofs generates proofs for given fields.
func (*Generic) DeleteAttribute ¶
DeleteAttribute deletes the attribute from the model.
func (*Generic) DeriveFromClonePayload ¶ added in v1.2.0
DeriveFromClonePayload unpacks the generic data from the Payload This method clones the transition rules and roles from a template document.
func (*Generic) DeriveFromCreatePayload ¶
DeriveFromCreatePayload unpacks the invoice data from the Payload.
func (*Generic) DeriveFromUpdatePayload ¶
func (g *Generic) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, error)
DeriveFromUpdatePayload unpacks the update payload and prepares a new version.
func (*Generic) DocumentType ¶
DocumentType returns the generic document type.
func (*Generic) PackCoreDocument ¶
func (g *Generic) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
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.Document, collaborators documents.CollaboratorsAccess, attrs map[documents.AttrKey]documents.Attribute) (err error)
PrepareNewVersion prepares new version from the old generic.
func (*Generic) UnpackCoreDocument ¶
func (g *Generic) UnpackCoreDocument(cd coredocumentpb.CoreDocument) (err error)
UnpackCoreDocument unpacks the core document into Generic.