types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashSizeV1 = 32
)

Variables

This section is empty.

Functions

func Marshal

func Marshal(item interface{}) ([]byte, error)

Marshal marshals a TLS-encodable structure

func Unmarshal

func Unmarshal(serialized []byte, out interface{}) error

Unmarshal unmarshals a TLS-encoded structure

Types

type ChecksumV1

type ChecksumV1 struct {
	Identifier []byte `tls:"minlen:1,maxlen:128"`
	Checksum   []byte `tls:"minlen:1,maxlen:64"`
}

type ConsistencyProofV1

type ConsistencyProofV1 struct {
	LogId           Namespace
	TreeSize1       uint64
	TreeSize2       uint64
	ConsistencyPath []NodeHash `tls:"minlen:0,maxlen:65535"`
}

type CosignedTreeHeadV1

type CosignedTreeHeadV1 struct {
	SignedTreeHead SignedTreeHeadV1
	Cosignatures   []SignatureV1 `tls:"minlen:0,maxlen:4294967295"`
}

type Ed25519V1

type Ed25519V1 struct {
	Namespace [32]byte
}

Ed25519V1 uses an Ed25519 verification key as namespace. Encoding, signing, and verification operations are defined by RFC 8032.

type GetConsistencyProofV1

type GetConsistencyProofV1 struct {
	First  uint64
	Second uint64
}

GetConsistencyProofV1 is a serializable get-consistency-proof request

type GetEntriesV1

type GetEntriesV1 struct {
	Start uint64
	End   uint64
}

GetEntriesV1 is a serializable get-entries request

type GetProofByHashV1

type GetProofByHashV1 struct {
	Hash     [HashSizeV1]byte
	TreeSize uint64
}

GetProofByHashV1 is a serializable get-proof-by-hash request

type InclusionProofV1

type InclusionProofV1 struct {
	LogId         Namespace
	TreeSize      uint64
	LeafIndex     uint64
	InclusionPath []NodeHash `tls:"minlen:0,maxlen:65535"`
}

type Namespace

type Namespace struct {
	Format    NamespaceFormat `tls:"maxval:65535"`
	Ed25519V1 *Ed25519V1      `tls:"selector:Format,val:1"`
}

Namespace references a versioned namespace based on a given format specifier

func NewNamespaceEd25519V1

func NewNamespaceEd25519V1(vk []byte) (*Namespace, error)

NewNamespaceEd25519V1 returns an new Ed25519V1 namespace based on a verification key.

func (*Namespace) Fingerprint

func (n *Namespace) Fingerprint() (*[NamespaceFingerprintSize]byte, error)

Fingerprint returns a fixed-size namespace fingerprint that is unique.

func (Namespace) String

func (n Namespace) String() string

func (*Namespace) Verify

func (ns *Namespace) Verify(message, signature []byte) error

Verify checks that signature is valid over message for this namespace

type NamespaceFormat

type NamespaceFormat tls.Enum

NamespaceFormat defines a particular namespace type that is versioend

const (
	NamespaceFormatReserved  NamespaceFormat = 0
	NamespaceFormatEd25519V1 NamespaceFormat = 1

	NamespaceFingerprintSize = 32
)

func (NamespaceFormat) String

func (f NamespaceFormat) String() string

type NamespacePool

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

NamespacePool is a pool of namespaces that contain complete verification keys

func NewNamespacePool

func NewNamespacePool(namespaces []*Namespace) (*NamespacePool, error)

NewNameSpacePool creates a new namespace pool from a list of namespaces. An error is returned if there are duplicate namespaces or namespaces without a complete verification key. The latter is determined by namespaceWithKey().

func (*NamespacePool) Find

func (np *NamespacePool) Find(namespace *Namespace) (*Namespace, bool)

Find checks if namespace is a member of the namespace pool.

func (*NamespacePool) List

func (np *NamespacePool) List() []*Namespace

List returns a copied list of namespaces that is used by this pool.

type NodeHash

type NodeHash struct {
	Data []byte `tls:"minlen:32,maxlen:255"`
}

type SignatureV1

type SignatureV1 struct {
	Namespace Namespace
	Signature []byte `tls:"minlen:1,maxlen:65535"`
}

type SignedChecksumV1

type SignedChecksumV1 struct {
	Data      ChecksumV1
	Signature SignatureV1
}

type SignedTreeHeadV1

type SignedTreeHeadV1 struct {
	TreeHead  TreeHeadV1
	Signature SignatureV1
}

type StFormat

type StFormat tls.Enum

StFormat defines a particular StItem type that is versioned

const (
	StFormatReserved           StFormat = 0
	StFormatSignedTreeHeadV1   StFormat = 1
	StFormatCosignedTreeHeadV1 StFormat = 2
	StFormatConsistencyProofV1 StFormat = 3
	StFormatInclusionProofV1   StFormat = 4
	StFormatSignedChecksumV1   StFormat = 5
)

func (StFormat) String

func (f StFormat) String() string

type StItem

type StItem struct {
	Format             StFormat            `tls:"maxval:65535"`
	SignedTreeHeadV1   *SignedTreeHeadV1   `tls:"selector:Format,val:1"`
	CosignedTreeHeadV1 *CosignedTreeHeadV1 `tls:"selector:Format,val:2"`
	ConsistencyProofV1 *ConsistencyProofV1 `tls:"selector:Format,val:3"`
	InclusionProofV1   *InclusionProofV1   `tls:"selector:Format,val:4"`
	SignedChecksumV1   *SignedChecksumV1   `tls:"selector:Format,val:5"`
}

StItem references a versioned item based on a given format specifier

func NewConsistencyProofV1

func NewConsistencyProofV1(id *Namespace, size1, size2 uint64, path []NodeHash) *StItem

func NewCosignedTreeHeadV1

func NewCosignedTreeHeadV1(sth *SignedTreeHeadV1, cosig []SignatureV1) *StItem

func NewInclusionProofV1

func NewInclusionProofV1(id *Namespace, size, index uint64, path []NodeHash) *StItem

func NewSignedChecksumV1

func NewSignedChecksumV1(data *ChecksumV1, sig *SignatureV1) *StItem

func NewSignedTreeHeadV1

func NewSignedTreeHeadV1(th *TreeHeadV1, sig *SignatureV1) *StItem

func (StItem) String

func (i StItem) String() string

type StItemList

type StItemList struct {
	Items []StItem `tls:"minlen:0,maxlen:4294967295"`
}

type TreeHeadV1

type TreeHeadV1 struct {
	Timestamp uint64
	TreeSize  uint64
	RootHash  NodeHash
	Extension []byte `tls:"minlen:0,maxlen:65535"`
}

func NewTreeHeadV1

func NewTreeHeadV1(timestamp, size uint64, hash, extension []byte) *TreeHeadV1

Directories

Path Synopsis
cmd
new-namespace command
Package main outputs the private and public parts of a new namespace
Package main outputs the private and public parts of a new namespace

Jump to

Keyboard shortcuts

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