package types

import "github.com/google/trillian/types"

Package types defines serialization and parsing functions for SignedLogRoot and SignedMapRoot fields.

Index

Functions

func ParseKeyHint

func ParseKeyHint(hint []byte) (int64, error)

ParseKeyHint converts a keyhint into a keyID.

func SerializeKeyHint

func SerializeKeyHint(logID int64) []byte

SerializeKeyHint returns a byte slice with logID serialized as a big endian uint64.

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       uint64
	RootHash       []byte `tls:"minlen:0,maxlen:128"`
	TimestampNanos uint64
	Revision       uint64
	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.

type MapRoot

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

MapRoot 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: MapRootV1;
  }
} MapRoot;

type MapRootV1

type MapRootV1 struct {
	RootHash       []byte `tls:"minlen:0,maxlen:128"`
	TimestampNanos uint64
	Revision       uint64
	Metadata       []byte `tls:"minlen:0,maxlen:65535"`
}

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

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

func (*MapRootV1) MarshalBinary

func (m *MapRootV1) MarshalBinary() ([]byte, error)

MarshalBinary returns a canonical TLS serialization of the map root.

func (*MapRootV1) UnmarshalBinary

func (m *MapRootV1) UnmarshalBinary(mapRootBytes []byte) error

UnmarshalBinary verifies that mapRootBytes is a TLS serialized MapRoot, has the MAP_ROOT_FORMAT_V1 tag, and returns the deserialized *MapRootV1.

Source Files

logroot.go maproot.go

Version
v1.3.4
Published
Oct 23, 2019
Platform
js/wasm
Imports
4 packages
Last checked
6 hours ago

Tools for package owners.