http

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 5

Documentation

Overview

Package http implements the Network interface for the tlock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotUnchained = errors.New("not an unchained network")

ErrNotUnchained represents an error when the informed chain belongs to a chained network.

Functions

This section is empty.

Types

type Network

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

Network represents the network support using the drand http client.

func NewNetwork

func NewNetwork(host string, chainHash string) (*Network, error)

NewNetwork constructs a network for use that will use the http client.

func (*Network) ChainHash

func (n *Network) ChainHash() string

ChainHash returns the chain hash for this network.

func (*Network) Current added in v1.0.0

func (n *Network) Current(date time.Time) uint64

Current returns the current round for that network at the given date.

func (*Network) PublicKey

func (n *Network) PublicKey() kyber.Point

PublicKey returns the kyber point needed for encryption and decryption.

func (*Network) RoundNumber

func (n *Network) RoundNumber(t time.Time) uint64

RoundNumber will return the latest round of randomness that is available for the specified time. To handle a duration construct time like this: time.Now().Add(6*time.Second)

func (*Network) Scheme added in v1.0.0

func (n *Network) Scheme() crypto.Scheme

Scheme returns the drand crypto Scheme used by the network.

func (*Network) Signature

func (n *Network) Signature(roundNumber uint64) ([]byte, error)

Signature makes a call to the network to retrieve the signature for the specified round number.

func (*Network) SwitchChainHash added in v1.1.0

func (n *Network) SwitchChainHash(new string) error

SwitchChainHash allows to start using another chainhash on the same host network

Jump to

Keyboard shortcuts

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