func ToIncrementalProof(ir *IncrementalResponse, hasherF func() hashing.Hasher) *balloon.IncrementalProof {
	return balloon.NewIncrementalProof(ir.Start, ir.End, history.ParseAuditPath(ir.AuditPath), hasherF())
}
ToIncrementalProof translate public protocol.IncrementalResponse to internal
balloon.IncrementalProof.
package protocol
import (
	"encoding/json"
	"github.com/bbva/qed/balloon"
	"github.com/bbva/qed/balloon/history"
	"github.com/bbva/qed/balloon/hyper"
	"github.com/bbva/qed/crypto/hashing"
	"github.com/bbva/qed/util"
)
type Event struct {
	Event []byte
}
type EventsBulk struct {
	Events [][]byte
}
type MembershipQuery struct {
	Key     []byte
	Version *uint64
}
type MembershipDigest struct {
	KeyDigest hashing.Digest
	Version   *uint64
}
type Snapshot struct {
	EventDigest   hashing.Digest
	HistoryDigest hashing.Digest
	HyperDigest   hashing.Digest
	Version       uint64
}
func (b *Snapshot) Encode() ([]byte, error) {
	return json.Marshal(b)
}
func (b *Snapshot) Decode(msg []byte) error {
	err := json.Unmarshal(msg, b)
	return err
}
type SignedSnapshot struct {
	Snapshot  *Snapshot
	Signature []byte
}
func (b *SignedSnapshot) Encode() ([]byte, error) {
	return json.Marshal(b)
}
func (b *SignedSnapshot) Decode(msg []byte) error {
	err := json.Unmarshal(msg, b)
	return err
}
type BatchSnapshots struct {
	Snapshots []*SignedSnapshot
}
func (b *BatchSnapshots) Encode() ([]byte, error) {
	return json.Marshal(b)
}
func (b *BatchSnapshots) Decode(msg []byte) error {
	err := json.Unmarshal(msg, b)
	return err
}
type MembershipResult struct {
	Exists         bool
	Hyper          map[string]hashing.Digest
	History        map[string]hashing.Digest
	CurrentVersion uint64
	QueryVersion   uint64
	ActualVersion  uint64
	KeyDigest      hashing.Digest
	Key            []byte
}
type IncrementalRequest struct {
	Start uint64
	End   uint64
}
type IncrementalResponse struct {
	Start     uint64
	End       uint64
	AuditPath map[string]hashing.Digest
}
func ToMembershipResult(key []byte, mp *balloon.MembershipProof) *MembershipResult {
	var serialized map[string]hashing.Digest
	if mp.HistoryProof != nil && mp.HistoryProof.AuditPath != nil {
		serialized = mp.HistoryProof.AuditPath.Serialize()
	}
	return &MembershipResult{
		mp.Exists,
		mp.HyperProof.AuditPath,
		serialized,
		mp.CurrentVersion,
		mp.QueryVersion,
		mp.ActualVersion,
		mp.KeyDigest,
		key,
	}
}
func ToBalloonProof(mr *MembershipResult, hasherF func() hashing.Hasher) *balloon.MembershipProof {
	historyProof := history.NewMembershipProof(
		mr.ActualVersion,
		mr.QueryVersion,
		history.ParseAuditPath(mr.History),
		hasherF(),
	)
	hasher := hasherF()
	hyperProof := hyper.NewQueryProof(
		mr.KeyDigest,
		util.Uint64AsPaddedBytes(mr.ActualVersion, int(hasher.Len())),
		mr.Hyper,
		hasher,
	)
	return balloon.NewMembershipProof(
		mr.Exists,
		hyperProof,
		historyProof,
		mr.CurrentVersion,
		mr.QueryVersion,
		mr.ActualVersion,
		mr.KeyDigest,
		hasherF(),
	)
}
func ToIncrementalResponse(proof *balloon.IncrementalProof) *IncrementalResponse {
	return &IncrementalResponse{
		proof.Start,
		proof.End,
		proof.AuditPath.Serialize(),
	}
}