types

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Sigsum log api.
	EndpointAddLeaf             = Endpoint("add-leaf")
	EndpointGetTreeHead         = Endpoint("get-tree-head")
	EndpointGetInclusionProof   = Endpoint("get-inclusion-proof/")
	EndpointGetConsistencyProof = Endpoint("get-consistency-proof/")
	EndpointGetLeaves           = Endpoint("get-leaves/")

	// For primary/secondary replication.
	EndpointGetSecondaryTreeHead = Endpoint("get-secondary-tree-head")

	// Sigsum witness api.
	EndpointAddTreeHead = Endpoint("add-tree-head")
	EndpointGetTreeSize = Endpoint("get-tree-size/")
)
View Source
const (
	CosignatureNamespace = "cosignature/v1"
	CheckpointNamePrefix = "sigsum.org/v1/tree/"
)
View Source
const (
	TreeLeafNamespace = "sigsum.org/v1/tree-leaf"
)

Variables

This section is empty.

Functions

func LeavesToASCII added in v0.1.6

func LeavesToASCII(w io.Writer, leaves []Leaf) error

func SignLeafChecksum added in v0.1.3

func SignLeafChecksum(signer crypto.Signer, checksum *crypto.Hash) (crypto.Signature, error)

func SignLeafMessage added in v0.1.3

func SignLeafMessage(signer crypto.Signer, msg []byte) (crypto.Signature, error)

func VerifyLeafChecksum added in v0.1.3

func VerifyLeafChecksum(key *crypto.PublicKey, checksum *crypto.Hash, sig *crypto.Signature) bool

func VerifyLeafMessage added in v0.1.3

func VerifyLeafMessage(key *crypto.PublicKey, msg []byte, sig *crypto.Signature) bool

Types

type ConsistencyProof

type ConsistencyProof struct {
	Path []crypto.Hash
}

func (*ConsistencyProof) FromASCII

func (pr *ConsistencyProof) FromASCII(r io.Reader) error

func (*ConsistencyProof) Parse added in v0.2.0

func (pr *ConsistencyProof) Parse(p *ascii.Parser) error

func (*ConsistencyProof) ToASCII

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

func (*ConsistencyProof) Verify

func (pr *ConsistencyProof) Verify(oldTree, newTree *TreeHead) error

type Cosignature added in v0.1.6

type Cosignature struct {
	KeyHash   crypto.Hash
	Timestamp uint64
	Signature crypto.Signature
}

func ParseCosignatures added in v0.1.23

func ParseCosignatures(p *ascii.Parser) ([]Cosignature, error)

func (*Cosignature) FromASCII added in v0.1.13

func (cs *Cosignature) FromASCII(r io.Reader) error

func (*Cosignature) Parse added in v0.1.23

func (cs *Cosignature) Parse(p *ascii.Parser) error

func (*Cosignature) ToASCII added in v0.1.6

func (cs *Cosignature) ToASCII(w io.Writer) error

func (*Cosignature) Verify added in v0.1.14

func (cs *Cosignature) Verify(key *crypto.PublicKey, logKeyHash *crypto.Hash, th *TreeHead) bool

type CosignedTreeHead

type CosignedTreeHead struct {
	SignedTreeHead
	Cosignatures []Cosignature
}

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(prefix string) string

Path adds endpoint name to a service prefix. If prefix is empty, nothing is added. For example, EndpointAddLeaf.Path("example.com/sigsum") -> "example.com/sigsum/add-leaf". EndpointAddLeaf.Path("") -> "add-leaf".

type InclusionProof

type InclusionProof struct {
	LeafIndex uint64
	Path      []crypto.Hash
}

func (*InclusionProof) FromASCII

func (pr *InclusionProof) FromASCII(r io.Reader) error

func (*InclusionProof) ToASCII

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

Note the size is not included on the wire.

func (*InclusionProof) Verify

func (pr *InclusionProof) Verify(leaf *crypto.Hash, th *TreeHead) error

type Leaf

type Leaf struct {
	Checksum  crypto.Hash
	Signature crypto.Signature
	KeyHash   crypto.Hash
}

func LeavesFromASCII added in v0.1.6

func LeavesFromASCII(r io.Reader, maxCount uint64) ([]Leaf, error)

func (*Leaf) FromBinary

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

func (*Leaf) Parse added in v0.1.23

func (l *Leaf) Parse(p *ascii.Parser) error

func (*Leaf) ToASCII

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

func (*Leaf) ToBinary

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

func (*Leaf) ToHash added in v0.1.22

func (l *Leaf) ToHash() crypto.Hash

func (*Leaf) Verify added in v0.1.3

func (l *Leaf) Verify(key *crypto.PublicKey) bool

type SignedTreeHead

type SignedTreeHead struct {
	TreeHead
	Signature crypto.Signature
}

func (*SignedTreeHead) FromASCII

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

func (*SignedTreeHead) Parse added in v0.1.23

func (sth *SignedTreeHead) Parse(p *ascii.Parser) error

func (*SignedTreeHead) ToASCII

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

func (*SignedTreeHead) Verify

func (sth *SignedTreeHead) Verify(key *crypto.PublicKey) bool

func (*SignedTreeHead) VerifyVersion0 added in v0.1.25

func (sth *SignedTreeHead) VerifyVersion0(key *crypto.PublicKey) bool

type TreeHead

type TreeHead struct {
	Size     uint64
	RootHash crypto.Hash
}

func NewEmptyTreeHead added in v0.1.22

func NewEmptyTreeHead() TreeHead

func (*TreeHead) Cosign added in v0.1.14

func (th *TreeHead) Cosign(signer crypto.Signer, logKeyHash *crypto.Hash, timestamp uint64) (Cosignature, error)

func (*TreeHead) FromASCII

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

func (*TreeHead) Parse added in v0.1.23

func (th *TreeHead) Parse(p *ascii.Parser) error

Doesn't require EOF, so it can be used for parsing a tree head embedded in a larger struct.

func (*TreeHead) Sign

func (th *TreeHead) Sign(signer crypto.Signer) (SignedTreeHead, error)

func (*TreeHead) ToASCII

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

Jump to

Keyboard shortcuts

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