Documentation ¶
Index ¶
- Constants
- 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 PrepareNewVersion(oldCD coredocumentpb.CoreDocument, collaborators []string) (*coredocumentpb.CoreDocument, error)
- type ReadAccessValidator
- type TokenRegistry
Constants ¶
const ( // ErrZeroCollaborators error when no collaborators are passed ErrZeroCollaborators = errors.Error("require at least one collaborator") )
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, adds read rules and fills salts
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: new collaborators are added to the list with old collaborators.
Types ¶
type ReadAccessValidator ¶
type ReadAccessValidator interface { PeerCanRead(cd *coredocumentpb.CoreDocument, peer identity.CentID) bool NFTOwnerCanRead( cd *coredocumentpb.CoreDocument, registry common.Address, tokenID []byte, peer identity.CentID) error }
ReadAccessValidator defines validator functions for peer.