coredocument

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDocumentRoot

func CalculateDocumentRoot(document *coredocumentpb.CoreDocument) error

CalculateDocumentRoot calculates the document root of the core document

func CalculateSigningRoot

func CalculateSigningRoot(doc *coredocumentpb.CoreDocument) error

CalculateSigningRoot calculates the signing root of the core document

func CreateProofs

func CreateProofs(dataTree *proofs.DocumentTree, coreDoc *coredocumentpb.CoreDocument, fields []string) (proofs []*proofspb.Proof, err error)

CreateProofs util function that takes document data tree, coreDocument and a list fo fields and generates proofs

func FillSalts

func FillSalts(doc *coredocumentpb.CoreDocument) error

FillSalts creates a new coredocument.Salts and fills it

func GetDocumentRootTree

func GetDocumentRootTree(document *coredocumentpb.CoreDocument) (tree *proofs.DocumentTree, err error)

GetDocumentRootTree returns the merkle tree for the document root

func GetDocumentSigningTree

func GetDocumentSigningTree(document *coredocumentpb.CoreDocument) (tree *proofs.DocumentTree, err error)

GetDocumentSigningTree returns the merkle tree for the signing root

func GetExternalCollaborators

func GetExternalCollaborators(selfCentID identity.CentID, doc *coredocumentpb.CoreDocument) ([][]byte, error)

GetExternalCollaborators returns collaborators of a document without the own centID.

func GetTypeURL

func GetTypeURL(coreDocument *coredocumentpb.CoreDocument) (string, error)

GetTypeURL returns the type of the embedded document

func New

func New() *coredocumentpb.CoreDocument

New returns a new core document Note: collaborators and salts are to be filled by the caller

func NewWithCollaborators

func NewWithCollaborators(collaborators []string) (*coredocumentpb.CoreDocument, error)

NewWithCollaborators generates new core document, adds collaborators, and fills salts

func PostAnchoredValidator

func PostAnchoredValidator(idService identity.Service, repo anchors.AnchorRepository) documents.ValidatorGroup

PostAnchoredValidator is a validator group with following validators PreAnchorValidator anchoredValidator should be called after anchoring the document/when received anchored document

func PostSignatureRequestValidator

func PostSignatureRequestValidator(idService identity.Service) documents.ValidatorGroup

PostSignatureRequestValidator is a validator group with following validators baseValidator signingRootValidator signaturesValidator should be called after the signature collection/before preparing for anchoring

func PreAnchorValidator

func PreAnchorValidator(idService identity.Service) documents.ValidatorGroup

PreAnchorValidator is a validator group with following validators base validator signing root validator document root validator signatures validator should be called before pre anchoring

func PreSignatureRequestValidator

func PreSignatureRequestValidator(centIDBytes, priv, pub []byte) documents.ValidatorGroup

PreSignatureRequestValidator is a validator group with following validators baseValidator signingRootValidator readyForSignaturesValidator should be called after sender signing the document and before requesting the document

func PrepareNewVersion

func PrepareNewVersion(oldCD coredocumentpb.CoreDocument, collaborators []string) (*coredocumentpb.CoreDocument, error)

PrepareNewVersion creates a copy of the passed coreDocument with the version fields updated Adds collaborators and fills salts Note: ignores any collaborators in the oldCD

func SignatureRequestValidator

func SignatureRequestValidator(idService identity.Service) documents.ValidatorGroup

SignatureRequestValidator returns a validator group with following validators base validator signing root validator signatures validator should be used when node receives a document requesting for signature

func UpdateVersionValidator

func UpdateVersionValidator() documents.Validator

UpdateVersionValidator validates if the new core document is properly derived from old one

Types

type Config

type Config interface {
	GetNetworkID() uint32
	GetIdentityID() ([]byte, error)
}

Config defines required methods required for the coredocument package.

type Processor

type Processor interface {
	Send(ctx *header.ContextHeader, coreDocument *coredocumentpb.CoreDocument, recipient identity.CentID) (err error)
	PrepareForSignatureRequests(ctx *header.ContextHeader, model documents.Model) error
	RequestSignatures(ctx *header.ContextHeader, model documents.Model) error
	PrepareForAnchoring(model documents.Model) error
	AnchorDocument(ctx *header.ContextHeader, model documents.Model) error
	SendDocument(ctx *header.ContextHeader, model documents.Model) error
}

Processor identifies an implementation, which can do a bunch of things with a CoreDocument. E.g. send, anchor, etc.

func DefaultProcessor

func DefaultProcessor(idService identity.Service, p2pClient client, repository anchors.AnchorRepository, config Config) Processor

DefaultProcessor returns the default implementation of CoreDocument Processor

Jump to

Keyboard shortcuts

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