coredocument

package
v0.0.3-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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

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

type TokenRegistry

type TokenRegistry interface {
	// OwnerOf to retrieve owner of the tokenID
	OwnerOf(registry common.Address, tokenID []byte) (common.Address, error)
}

TokenRegistry defines NFT retrieval functions.

Jump to

Keyboard shortcuts

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