Documentation ¶
Index ¶
- Constants
- func CreateValidator(factory identity.Factory) documents.ValidatorGroup
- func GRPCHandler(config config.Service, srv Service) cliententitypb.EntityServiceServer
- func UpdateValidator(factory identity.Factory) documents.ValidatorGroup
- type Bootstrapper
- type Entity
- func (e *Entity) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
- func (e *Entity) CalculateDataRoot() ([]byte, error)
- func (e *Entity) CalculateDocumentRoot() ([]byte, error)
- func (e *Entity) CalculateSigningRoot() ([]byte, error)
- func (e *Entity) CollaboratorCanUpdate(updated documents.Model, collaborator identity.DID) error
- func (e *Entity) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proofs []*proofspb.Proof, err error)
- func (e *Entity) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
- func (e *Entity) DocumentRootTree() (tree *proofs.DocumentTree, err error)
- func (*Entity) DocumentType() string
- func (e *Entity) FromJSON(jsonData []byte) error
- func (e *Entity) InitEntityInput(payload *cliententitypb.EntityCreatePayload, self identity.DID) error
- func (e *Entity) JSON() ([]byte, error)
- func (e *Entity) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (e *Entity) PrepareNewVersion(old documents.Model, data *cliententitypb.EntityData, ...) error
- func (e *Entity) Type() reflect.Type
- func (e *Entity) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
- type Service
Constants ¶
const ( // BootstrappedEntityHandler maps to grpc handler for entities BootstrappedEntityHandler string = "BootstrappedEntityHandler" // BootstrappedEntityService maps to the service for entities BootstrappedEntityService string = "BootstrappedEntityService" )
Variables ¶
This section is empty.
Functions ¶
func CreateValidator ¶
func CreateValidator(factory identity.Factory) documents.ValidatorGroup
CreateValidator returns a validator group that should be run before creating the entity and persisting it to DB
func GRPCHandler ¶
func GRPCHandler(config config.Service, srv Service) cliententitypb.EntityServiceServer
GRPCHandler returns an implementation of entity.DocumentServiceServer
func UpdateValidator ¶
func UpdateValidator(factory identity.Factory) documents.ValidatorGroup
UpdateValidator returns a validator group that should be run before updating the entity
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 Entity ¶
type Entity struct { *documents.CoreDocument Identity *identity.DID LegalName string // address Addresses []*entitypb.Address // tax information PaymentDetails []*entitypb.PaymentDetail // Entity contact list Contacts []*entitypb.Contact }
Entity implements the documents.Model keeps track of entity related fields and state
func (*Entity) CalculateDataRoot ¶
CalculateDataRoot calculates the data root and sets the root to core document.
func (*Entity) CalculateDocumentRoot ¶
CalculateDocumentRoot calculates the document root
func (*Entity) CalculateSigningRoot ¶
CalculateSigningRoot calculates the signing root of the document.
func (*Entity) CollaboratorCanUpdate ¶
CollaboratorCanUpdate checks if the collaborator can update the document.
func (*Entity) CreateNFTProofs ¶
func (e *Entity) 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 (*Entity) CreateProofs ¶
CreateProofs generates proofs for given fields.
func (*Entity) DocumentRootTree ¶
func (e *Entity) DocumentRootTree() (tree *proofs.DocumentTree, err error)
DocumentRootTree creates and returns the document root tree
func (*Entity) DocumentType ¶
DocumentType returns the entity document type.
func (*Entity) InitEntityInput ¶
func (e *Entity) InitEntityInput(payload *cliententitypb.EntityCreatePayload, self identity.DID) error
InitEntityInput initialize the model based on the received parameters from the rest api call
func (*Entity) PackCoreDocument ¶
PackCoreDocument packs the Entity into a CoreDocument.
func (*Entity) PrepareNewVersion ¶
func (e *Entity) PrepareNewVersion(old documents.Model, data *cliententitypb.EntityData, collaborators documents.CollaboratorsAccess) error
PrepareNewVersion prepares new version from the old entity.
func (*Entity) UnpackCoreDocument ¶
UnpackCoreDocument unpacks the core document into Entity.
type Service ¶
type Service interface { documents.Service // DeriveFromPayload derives Entity from clientPayload DeriveFromCreatePayload(ctx context.Context, payload *cliententitypb.EntityCreatePayload) (documents.Model, error) // DeriveFromUpdatePayload derives entity model from update payload DeriveFromUpdatePayload(ctx context.Context, payload *cliententitypb.EntityUpdatePayload) (documents.Model, error) // DeriveEntityData returns the entity data as client data DeriveEntityData(entity documents.Model) (*cliententitypb.EntityData, error) // DeriveEntityResponse returns the entity model in our standard client format DeriveEntityResponse(ctx context.Context, entity documents.Model) (*cliententitypb.EntityResponse, error) // ListEntityRelationships lists all the relationships associated with the passed in entity identifier ListEntityRelationships(ctx context.Context, entityIdentifier []byte) (documents.Model, []documents.Model, error) // GetEntityByRelationship returns the entity model from database or requests from granter GetEntityByRelationship(ctx context.Context, relationshipIdentifier []byte) (documents.Model, error) DeriveFromSharePayload(ctx context.Context, payload *cliententitypb.RelationshipPayload) (documents.Model, error) Share(ctx context.Context, entityRelationship documents.Model) (documents.Model, jobs.JobID, chan bool, error) // DeriveFromRevokePayload derives the revoked entity relationship from the relationship payload DeriveFromRevokePayload(ctx context.Context, payload *cliententitypb.RelationshipPayload) (documents.Model, error) // Revoke takes a revoked entity relationship, validates it, and tries to persist it to the DB Revoke(ctx context.Context, entityRelationship documents.Model) (documents.Model, jobs.JobID, chan bool, error) // DeriveEntityRelationshipResponse returns create response from entity relationship model DeriveEntityRelationshipResponse(model documents.Model) (*cliententitypb.RelationshipResponse, error) }
Service defines specific functions for entity
func DefaultService ¶
func DefaultService( srv documents.Service, repo documents.Repository, queueSrv queue.TaskQueuer, jobManager jobs.Manager, factory identity.Factory, erService entityrelationship.Service, idService identity.ServiceDID, anchorRepo anchors.AnchorRepository, processor documents.DocumentRequestProcessor, receivedEntityValidator func() documents.ValidatorGroup, ) Service
DefaultService returns the default implementation of the service.