generic

package
v0.0.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

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

type Data struct{}

Data is a empty structure.

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

func (g *Generic) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error

AddNFT adds NFT to the Generic.

func (*Generic) CalculateDataRoot

func (g *Generic) CalculateDataRoot() ([]byte, error)

CalculateDataRoot calculates the data root and sets the root to core document.

func (*Generic) CalculateDocumentRoot

func (g *Generic) CalculateDocumentRoot() ([]byte, error)

CalculateDocumentRoot calculates the document root

func (*Generic) CalculateSigningRoot

func (g *Generic) CalculateSigningRoot() ([]byte, error)

CalculateSigningRoot calculates the signing root of the document.

func (*Generic) CollaboratorCanUpdate

func (g *Generic) CollaboratorCanUpdate(updated documents.Model, 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) (proofs []*proofspb.Proof, err error)

CreateNFTProofs creates proofs specific to NFT minting.

func (*Generic) CreateProofs

func (g *Generic) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)

CreateProofs generates proofs for given fields.

func (*Generic) DeleteAttribute

func (g *Generic) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error

DeleteAttribute deletes the attribute from the model.

func (*Generic) DeriveFromCreatePayload

func (g *Generic) DeriveFromCreatePayload(_ context.Context, payload documents.CreatePayload) error

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

func (*Generic) DocumentType() string

DocumentType returns the generic document type.

func (*Generic) FromJSON

func (g *Generic) FromJSON(jsonData []byte) error

FromJSON unmarshals the json bytes into Generic

func (*Generic) GetData

func (g *Generic) GetData() interface{}

GetData returns Generic Data.

func (*Generic) JSON

func (g *Generic) JSON() ([]byte, error)

JSON marshals Generic into a json bytes

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.Model, collaborators documents.CollaboratorsAccess, attrs map[documents.AttrKey]documents.Attribute) (err error)

PrepareNewVersion prepares new version from the old generic.

func (*Generic) Scheme

func (g *Generic) Scheme() string

Scheme returns the invoice Scheme.

func (*Generic) Type

func (g *Generic) Type() reflect.Type

Type gives the Generic type

func (*Generic) UnpackCoreDocument

func (g *Generic) UnpackCoreDocument(cd coredocumentpb.CoreDocument) (err error)

UnpackCoreDocument unpacks the core document into Generic.

Jump to

Keyboard shortcuts

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