Documentation

Index

Constants

View Source
const (
	// ProvenDBPrefix is the ProvenDB prefix used in Chainpoint Path format
	ProvenDBPrefix = "pdb"
)
View Source
const (
	// SignaturePrefix is the prefix for the signature entry in a proof
	SignaturePrefix = "sig:"
)

Variables

View Source
var (
	// ErrSignatureMissing is the error when the signature is missing in a proof
	ErrSignatureMissing = errors.New("signature is missing")
)

Functions

This section is empty.

Types

type ChpAnchor

type ChpAnchor struct {
	Type     string   `json:"type"`
	AnchorID string   `json:"anchor_id"`
	URIS     []string `json:"uris"`
}

    ChpAnchor represents a Chainpoint anchor object

    type ChpBranch

    type ChpBranch struct {
    	Label    string      `json:"label"`
    	OPS      []ChpOps    `json:"ops"`
    	Branches []ChpBranch `json:"branches,omitempty"`
    }

      ChpBranch represents a Chainpoint branch object

      type ChpOps

      type ChpOps struct {
      	L       string      `json:"l,omitempty"`
      	R       string      `json:"r,omitempty"`
      	OP      string      `json:"op,omitempty"`
      	Anchors []ChpAnchor `json:"anchors,omitempty"`
      }

        ChpOps represents a Chainpoint ops object

        type ChpPath

        type ChpPath struct {
        	Context             string      `json:"@context"`
        	Type                string      `json:"type"`
        	Hash                string      `json:"hash"`
        	HashIDNode          string      `json:"hash_id_node"`
        	HashSubmittedNodeAt string      `json:"hash_submitted_node_at"`
        	HashIDCore          string      `json:"hash_id_core"`
        	HashSubmittedCoreAt string      `json:"hash_submitted_core_at"`
        	Branches            []ChpBranch `json:"branches"`
        }

          ChpPath represents a proof in Chainpoint Path format

          func NewChpPathFromMerkleProof

          func NewChpPathFromMerkleProof(
          	proof *merkle.Proof,
          	derivedAt time.Time,
          	anchorType pb.Anchor_Type,
          	anchorID string,
          	anchorURI string,
          ) (
          	path *ChpPath,
          	er error,
          )

            NewChpPathFromMerkleProof creates a new ChpPath proof from the given merkle proof

            func (*ChpPath) Marshal

            func (c *ChpPath) Marshal() ([]byte, error)

              Marshal marshals current ChpPath

              func (*ChpPath) Unmarshal

              func (c *ChpPath) Unmarshal(data []byte) error

                Unmarshal unmarshals current ChpPath

                type EthTrie

                type EthTrie struct {
                	AnchorType    string   `json:"anchorType"`
                	TxnID         string   `json:"txnId"`
                	TxnURI        string   `json:"txnUri"`
                	BlockTime     uint64   `json:"blockTime,omitempty"`
                	BlockTimeNano uint64   `json:"blockTimeNano,omitempty"`
                	BlockNumber   uint64   `json:"blockNumber,omitempty"`
                	TrieNodes     [][]byte `json:"trieNodes,omitempty"`
                }

                  EthTrie represents a confirmed proof for pieces of data in Ethereum Trie (ETH_TRIE) format

                  func NewEthTrie

                  func NewEthTrie(
                  	acType ap.Anchor_Type,
                  	txnID,
                  	txnURI string,
                  	pfTrie [][]byte,
                  ) *EthTrie

                    NewEthTrie creates a new EthTrie

                    func (*EthTrie) Marshal

                    func (e *EthTrie) Marshal() ([]byte, error)

                      Marshal marshals current EthTrie

                      func (*EthTrie) Root

                      func (e *EthTrie) Root() []byte

                        Root returns current EthTrie's merkle root

                        func (*EthTrie) Unmarshal

                        func (e *EthTrie) Unmarshal(data []byte) error

                          Unmarshal unmarshals current EthTrie

                          type Proof

                          type Proof interface {
                          	// Unmarshal unmarshals to current proof.Data
                          	Unmarshal(data []byte) error
                          	// Marshal marshals current proof.Data
                          	Marshal() ([]byte, error)
                          }

                            Proof represents an existence proof in the `data` field of the result that is returned by the ProvenDB Anchor Service gRPC API

                            func NewProof

                            func NewProof(format ap.Proof_Format) (Proof, error)

                              NewProof returns a new proof