types

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 144

Documentation

Overview

Package types defines serialization and parsing functions for SignedLogRoot fields.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogRoot

type LogRoot struct {
	Version tls.Enum   `tls:"size:2"`
	V1      *LogRootV1 `tls:"selector:Version,val:1"`
}

LogRoot holds the TLS-deserialization of the following structure (described in RFC5246 section 4 notation): enum { v1(1), (65535)} Version;

struct {
  Version version;
  select(version) {
    case v1: LogRootV1;
  }
} LogRoot;

type LogRootV1

type LogRootV1 struct {
	// TreeSize is the number of leaves in the log Merkle tree.
	TreeSize uint64
	// RootHash is the hash of the root node of the tree.
	RootHash []byte `tls:"minlen:0,maxlen:128"`
	// TimestampNanos is the time in nanoseconds for when this root was created,
	// counting from the UNIX epoch.
	TimestampNanos uint64

	// Revision is the Merkle tree revision associated with this root.
	//
	// Deprecated: Revision is a concept internal to the storage layer.
	Revision uint64

	// Metadata holds additional data associated with this root.
	Metadata []byte `tls:"minlen:0,maxlen:65535"`
}

LogRootV1 holds the TLS-deserialization of the following structure (described in RFC5246 section 4 notation):

struct {
  uint64 tree_size;
  opaque root_hash<0..128>;
  uint64 timestamp_nanos;
  uint64 revision;
  opaque metadata<0..65535>;
} LogRootV1;

func (*LogRootV1) MarshalBinary

func (l *LogRootV1) MarshalBinary() ([]byte, error)

MarshalBinary returns a canonical TLS serialization of LogRoot.

func (*LogRootV1) UnmarshalBinary

func (l *LogRootV1) UnmarshalBinary(logRootBytes []byte) error

UnmarshalBinary verifies that logRootBytes is a TLS serialized LogRoot, has the LOG_ROOT_FORMAT_V1 tag, and populates the caller with the deserialized *LogRootV1.

Jump to

Keyboard shortcuts

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