Documentation ¶
Index ¶
- func CalculateDocumentRoot(document *coredocumentpb.CoreDocument) error
- func CalculateSigningRoot(doc *coredocumentpb.CoreDocument) error
- func CreateProofs(dataTree *proofs.DocumentTree, coreDoc *coredocumentpb.CoreDocument, ...) (proofs []*proofspb.Proof, err error)
- func FillSalts(doc *coredocumentpb.CoreDocument) error
- func GetDocumentRootTree(document *coredocumentpb.CoreDocument) (tree *proofs.DocumentTree, err error)
- func GetDocumentSigningTree(document *coredocumentpb.CoreDocument) (tree *proofs.DocumentTree, err error)
- func GetExternalCollaborators(selfCentID identity.CentID, doc *coredocumentpb.CoreDocument) ([][]byte, error)
- func GetTypeURL(coreDocument *coredocumentpb.CoreDocument) (string, error)
- func New() *coredocumentpb.CoreDocument
- func NewWithCollaborators(collaborators []string) (*coredocumentpb.CoreDocument, error)
- func PostAnchoredValidator(idService identity.Service, repo anchors.AnchorRepository) documents.ValidatorGroup
- func PostSignatureRequestValidator(idService identity.Service) documents.ValidatorGroup
- func PreAnchorValidator(idService identity.Service) documents.ValidatorGroup
- func PreSignatureRequestValidator(centIDBytes, priv, pub []byte) documents.ValidatorGroup
- func PrepareNewVersion(oldCD coredocumentpb.CoreDocument, collaborators []string) (*coredocumentpb.CoreDocument, error)
- func SignatureRequestValidator(idService identity.Service) documents.ValidatorGroup
- func UpdateVersionValidator() documents.Validator
- type Config
- type Processor
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 ¶
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 ¶
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 ¶
UpdateVersionValidator validates if the new core document is properly derived from old one
Types ¶
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