types

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: BSD-2-Clause Imports: 9 Imported by: 10

Documentation

Index

Constants

View Source
const (
	SignatureSize = ed25519.SignatureSize
	PublicKeySize = ed25519.PublicKeySize
)
View Source
const (
	EndpointAddLeaf             = Endpoint("add-leaf")
	EndpointAddCosignature      = Endpoint("add-cosignature")
	EndpointGetTreeHeadToCosign = Endpoint("get-tree-head-to-cosign")
	EndpointGetTreeHeadCosigned = Endpoint("get-tree-head-cosigned")
	EndpointGetInclusionProof   = Endpoint("get-inclusion-proof/")
	EndpointGetConsistencyProof = Endpoint("get-consistency-proof/")
	EndpointGetLeaves           = Endpoint("get-leaves/")

	EndpointGetTreeHeadUnsigned = Endpoint("get-tree-head-unsigned")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistencyProof

type ConsistencyProof struct {
	NewSize uint64
	OldSize uint64
	Path    []merkle.Hash `ascii:"consistency_path"`
}

func (*ConsistencyProof) FromASCII

func (p *ConsistencyProof) FromASCII(r io.Reader, oldSize, newSize uint64) error

func (*ConsistencyProof) ToASCII

func (p *ConsistencyProof) ToASCII(w io.Writer) error

func (*ConsistencyProof) Verify

func (p *ConsistencyProof) Verify(oldRoot, newRoot *merkle.Hash) error

type CosignedTreeHead

type CosignedTreeHead struct {
	SignedTreeHead
	Cosignature []Signature   `ascii:"cosignature"`
	KeyHash     []merkle.Hash `ascii:"key_hash"`
}

func (*CosignedTreeHead) FromASCII

func (cth *CosignedTreeHead) FromASCII(r io.Reader) error

func (*CosignedTreeHead) ToASCII

func (cth *CosignedTreeHead) ToASCII(w io.Writer) error

type Endpoint

type Endpoint string

func (Endpoint) Path

func (e Endpoint) Path(components ...string) string

Path joins a number of components to form a full endpoint path. For example, EndpointAddLeaf.Path("example.com", "sigsum/v0") -> example.com/sigsum/v0/add-leaf.

type InclusionProof

type InclusionProof struct {
	TreeSize  uint64
	LeafIndex uint64        `ascii:"leaf_index"`
	Path      []merkle.Hash `ascii:"inclusion_path"`
}

func (*InclusionProof) FromASCII

func (p *InclusionProof) FromASCII(r io.Reader, treeSize uint64) error

func (*InclusionProof) ToASCII

func (p *InclusionProof) ToASCII(w io.Writer) error

func (*InclusionProof) Verify

func (p *InclusionProof) Verify(leaf *merkle.Hash, root *merkle.Hash) error

type Leaf

type Leaf struct {
	Statement
	Signature Signature   `ascii:"signature"`
	KeyHash   merkle.Hash `ascii:"key_hash"`
}

func (*Leaf) FromASCII

func (l *Leaf) FromASCII(r io.Reader) error

func (*Leaf) FromBinary

func (l *Leaf) FromBinary(b []byte) error

func (*Leaf) ToASCII

func (l *Leaf) ToASCII(w io.Writer) error

func (*Leaf) ToBinary

func (l *Leaf) ToBinary() []byte

type Leaves

type Leaves []Leaf

func (*Leaves) FromASCII

func (l *Leaves) FromASCII(r io.Reader) error

type PublicKey

type PublicKey [PublicKeySize]byte

type Signature

type Signature [SignatureSize]byte

type SignedTreeHead

type SignedTreeHead struct {
	TreeHead
	Signature Signature `ascii:"signature"`
}

func (*SignedTreeHead) FromASCII

func (sth *SignedTreeHead) FromASCII(r io.Reader) error

func (*SignedTreeHead) ToASCII

func (sth *SignedTreeHead) ToASCII(w io.Writer) error

func (*SignedTreeHead) Verify

func (sth *SignedTreeHead) Verify(key *PublicKey, kh *merkle.Hash) bool

type Statement

type Statement struct {
	ShardHint uint64      `ascii:"shard_hint"`
	Checksum  merkle.Hash `ascii:"checksum"`
}

func (*Statement) Sign

func (s *Statement) Sign(signer crypto.Signer) (*Signature, error)

func (*Statement) ToBinary

func (s *Statement) ToBinary() []byte

func (*Statement) Verify

func (s *Statement) Verify(key *PublicKey, sig *Signature) bool

type TreeHead

type TreeHead struct {
	Timestamp uint64      `ascii:"timestamp"`
	TreeSize  uint64      `ascii:"tree_size"`
	RootHash  merkle.Hash `ascii:"root_hash"`
}

func (*TreeHead) FromASCII added in v0.0.9

func (th *TreeHead) FromASCII(r io.Reader) error

func (*TreeHead) Sign

func (th *TreeHead) Sign(s crypto.Signer, kh *merkle.Hash) (*SignedTreeHead, error)

func (*TreeHead) ToASCII added in v0.0.9

func (th *TreeHead) ToASCII(w io.Writer) error

func (*TreeHead) ToBinary

func (th *TreeHead) ToBinary(keyHash *merkle.Hash) []byte

Jump to

Keyboard shortcuts

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