merkle

package
v4.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentEncodingType = EncodingTypeBlindedSHA512_256v1
View Source
const (
	LeafTypeTeamv1 = 1
)

Variables

This section is empty.

Functions

func GetTreeConfig

func GetTreeConfig(encodingType EncodingType) (merkletree.Config, error)

Types

type BlindedEntropy

type BlindedEntropy []byte

type BlindedPreimage

type BlindedPreimage struct {
	LeafContainer  LeafContainer
	BlindedEntropy BlindedEntropy
}

func NewBlindedPreimage

func NewBlindedPreimage(leaf Leaf, blindedEntropy BlindedEntropy) (BlindedPreimage, error)

type EncodedLeaf

type EncodedLeaf []byte

func (EncodedLeaf) Construct

func (l EncodedLeaf) Construct() interface{}

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(encodingType EncodingType) *Encoder

func (*Encoder) BlindedPreimage

func (e *Encoder) BlindedPreimage(leaf Leaf, key Key, secret Secret) (BlindedPreimage, error)

func (*Encoder) Encode

func (e *Encoder) Encode(leaf Leaf, key Key, secret Secret) ([]byte, error)

func (*Encoder) EncodingType

func (e *Encoder) EncodingType() EncodingType

func (*Encoder) GenerateSecret

func (e *Encoder) GenerateSecret() (Secret, error)

func (*Encoder) Hash

func (e *Encoder) Hash(preimage BlindedPreimage) ([]byte, error)

type EncodingType

type EncodingType byte
const (
	EncodingTypeBlindedSHA512_256v1 EncodingType = 1 // p = HMAC-SHA512-256; (k, v) -> (k, p(p(k, s), v)) where s is a secret unique per Merkle seqno
)

type HashMeta

type HashMeta []byte

type HistoricalQueryResponse

type HistoricalQueryResponse struct {
	RootMetadata     RootMetadata      `codec:"r,omitempty"`
	Paths            []Path            `codec:"p,omitempty"`
	BlindedPreimages []BlindedPreimage `codec:"v,omitempty"`
	Skiplists        []Skiplist        `codec:"s,omitempty"`
}

type ID

type ID []byte

type Key

type Key struct {
	Key []byte
}

func NewKey

func NewKey(key []byte) Key

type Leaf

type Leaf interface {
	Serialize() ([]byte, error)
	Type() LeafType
	ID() ID
	GetRevelations() Revelations
}

type LeafBytes

type LeafBytes []byte

type LeafContainer

type LeafContainer struct {
	LeafType  LeafType  // specifies structure of leafBytes
	LeafBytes LeafBytes // msgpack deserialization implements Leaf
	// contains filtered or unexported fields
}

func ExportLeaf

func ExportLeaf(l Leaf) (LeafContainer, error)

func NewLeafContainer

func NewLeafContainer(leafType LeafType, leafBytes LeafBytes) LeafContainer

func (LeafContainer) Serialize

func (c LeafContainer) Serialize() ([]byte, error)

type LeafType

type LeafType uint16

type Path

type Path = []merkletree.Node

type QueryResponse

type QueryResponse struct {
	RootMetadata    RootMetadata    `codec:"r,omitempty"`
	Path            Path            `codec:"p,omitempty"`
	BlindedPreimage BlindedPreimage `codec:"v,omitempty"`
	Skiplists       []Skiplist      `codec:"s,omitempty"`
}

type Revelations

type Revelations map[keybase1.SeqType]keybase1.Seqno

type RootHash

type RootHash []byte

type RootMetadata

type RootMetadata struct {
	EncodingType EncodingType `codec:"e"`
	Seqno        TreeSeqno    `codec:"s"`
	Skips        Skips        `codec:"t"` // includes prev
	Hash         RootHash     `codec:"r"`
	// contains filtered or unexported fields
}

func (RootMetadata) EncodingAndHashMeta

func (r RootMetadata) EncodingAndHashMeta() (encoding []byte, hashMeta HashMeta, err error)

func (RootMetadata) HashMeta

func (r RootMetadata) HashMeta() (HashMeta, error)

type SHA512_256Hasher

type SHA512_256Hasher struct{}

func (SHA512_256Hasher) Hash

func (h SHA512_256Hasher) Hash(x []byte) merkletree.Hash

type Secret

type Secret struct {
	Secret []byte
}

func NewSecret

func NewSecret(secret []byte) Secret

type SigID

type SigID []byte

type Skiplist

type Skiplist = []RootMetadata

type Skips

type Skips map[TreeSeqno]HashMeta

type Teamv1HiddenTail

type Teamv1HiddenTail struct {
	SigID  SigID
	LinkID sig3.LinkID
	Seqno  keybase1.Seqno
	// contains filtered or unexported fields
}

type Teamv1Leaf

type Teamv1Leaf struct {

	// do not encode teamID; it's redundant in the tree
	TeamID sig3.TeamID `codec:"-"`
	Tails  map[keybase1.SeqType]Teamv1HiddenTail
	// contains filtered or unexported fields
}

func (Teamv1Leaf) GetRevelations

func (l Teamv1Leaf) GetRevelations() Revelations

func (Teamv1Leaf) ID

func (l Teamv1Leaf) ID() ID

func (Teamv1Leaf) Serialize

func (l Teamv1Leaf) Serialize() ([]byte, error)

func (Teamv1Leaf) Type

func (l Teamv1Leaf) Type() LeafType

type TreeSeqno

type TreeSeqno int64

func ComputeSkipPath

func ComputeSkipPath(start TreeSeqno, end TreeSeqno) []TreeSeqno

computeSkipPath computes a log pattern skip path in reverse e.g., start=100, end=2033 -> ret = {1009, 497, 241, 113, 105, 101} such that ret[i+1] \in computeSkipPointers(ret[i])

func ComputeSkipPointers

func ComputeSkipPointers(s TreeSeqno) []TreeSeqno

Jump to

Keyboard shortcuts

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