generic

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 13 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,
	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 Data

type Data struct{}

Data is a empty structure.

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

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.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

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

DeleteAttribute deletes the attribute from the model.

func (*Generic) DeriveFromClonePayload added in v1.2.0

func (g *Generic) DeriveFromClonePayload(_ context.Context, m documents.Document) error

DeriveFromClonePayload unpacks the generic data from the Payload This method clones the transition rules and roles from a template document.

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.Document, error)

DeriveFromUpdatePayload unpacks the update payload and prepares a new version.

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.Document, 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