roughtime

package
v0.0.0-...-aaa8282 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(w io.Writer, s *config.ServersJSON, nonce []byte) error

Chain runs a chain of request against a list of servers and stores the result as JSON in w.

func FetchRoughtime

func FetchRoughtime(s *Server, nonce []byte) (m time.Time, r time.Duration, err error)

FetchRoughtime fetches the current time from the given server, using the given nonce. Nonce has to be 64 bytes long or nil, in which case a random nonce is generated. The server response is verified and any verification error is returned.

func LoadChain

func LoadChain(r io.Reader) (*config.Chain, error)

LoadChain loads a serialized chain from r.

func ParseResponse

func ParseResponse(resp, nonce []byte, root ed25519.PublicKey) (m time.Time, r time.Duration, err error)

ParseResponse parses a roughtime response and validates it against the given nonce and root key. Any validation error is returned.

func ReadServersJSON

func ReadServersJSON(r io.Reader) (*config.ServersJSON, error)

ReadServersJSON reads a servers.json from r.

func VerifyChain

func VerifyChain(c *config.Chain, s *config.ServersJSON) error

VerifyChain verifies the given chain against the list of servers and outputs any validation errors.

Types

type Server

type Server struct {
	Address   string
	PublicKey ed25519.PublicKey
}

Server configures a server to connect to.

Jump to

Keyboard shortcuts

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