pkiclient

package
v0.0.0-...-c15aa5a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0, GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package pkiclient implements a caching wrapper

katzenmint pkiclient interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastTxError

type BroadcastTxError struct {
	Resp *ctypes.ResultBroadcastTxCommit
}

func (BroadcastTxError) Error

func (e BroadcastTxError) Error() string

type Cache

type Cache struct {
	sync.Mutex
	worker.Worker
	// contains filtered or unexported fields
}

Cache is a caching PKI client.

func NewCacheClient

func NewCacheClient(impl Client) (*Cache, error)

New constructs a new Client backed by an existing pki.Client instance.

func (*Cache) Deserialize

func (c *Cache) Deserialize(raw []byte) (*pki.Document, error)

Deserialize returns PKI document given the raw bytes.

func (*Cache) GetDoc

func (c *Cache) GetDoc(ctx context.Context, epoch uint64) (*pki.Document, []byte, error)

GetDoc returns the PKI document for the provided epoch.

func (*Cache) GetEpoch

func (c *Cache) GetEpoch(ctx context.Context) (epoch uint64, ellapsedHeight uint64, err error)

GetEpoch returns the epoch information of PKI.

func (*Cache) Halt

func (c *Cache) Halt()

Halt tears down the Client instance.

func (*Cache) Post

func (c *Cache) Post(ctx context.Context, epoch uint64, signingKey *eddsa.PrivateKey, d *pki.MixDescriptor) error

Post posts the node's descriptor to the PKI for the provided epoch.

func (*Cache) Shutdown

func (c *Cache) Shutdown()

Shutdown the client

type Client

type Client interface {
	// GetEpoch returns the epoch information of PKI.
	GetEpoch(ctx context.Context) (epoch uint64, ellapsedHeight uint64, err error)

	// GetDoc returns the PKI document along with the raw serialized form for the provided epoch.
	GetDoc(ctx context.Context, epoch uint64) (*cpki.Document, []byte, error)

	// Post posts the node's descriptor to the PKI for the provided epoch.
	Post(ctx context.Context, epoch uint64, signingKey *eddsa.PrivateKey, d *cpki.MixDescriptor) error

	// Deserialize returns PKI document given the raw bytes.
	Deserialize(raw []byte) (*cpki.Document, error)

	// Shutdown the client
	Shutdown()
}

Client is the abstract interface used for PKI interaction.

type PKIClient

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

func NewPKIClient

func NewPKIClient(cfg *PKIClientConfig) (*PKIClient, error)

NewPKIClient create PKI Client from PKI config

func NewPKIClientFromLightClient

func NewPKIClientFromLightClient(light *lightrpc.Client, logBackend *log.Backend) (*PKIClient, error)

NewPKIClientFromLightClient create PKI Client from tendermint rpc light client

func (*PKIClient) Deserialize

func (p *PKIClient) Deserialize(raw []byte) (*cpki.Document, error)

Deserialize returns PKI document given the raw bytes.

func (*PKIClient) DeserializeWithEpoch

func (p *PKIClient) DeserializeWithEpoch(raw []byte, epoch uint64) (*cpki.Document, error)

DeserializeWithEpoch returns PKI document given the raw bytes.

func (*PKIClient) GetDoc

func (p *PKIClient) GetDoc(ctx context.Context, epoch uint64) (*cpki.Document, []byte, error)

GetDoc returns the PKI document along with the raw serialized form for the provided epoch.

func (*PKIClient) GetEpoch

func (p *PKIClient) GetEpoch(ctx context.Context) (epoch uint64, ellapsedHeight uint64, err error)

GetEpoch returns the epoch information of PKI.

func (*PKIClient) Post

func (p *PKIClient) Post(ctx context.Context, epoch uint64, signingKey *eddsa.PrivateKey, d *cpki.MixDescriptor) error

Post posts the node's descriptor to the PKI for the provided epoch.

func (*PKIClient) PostTx

PostTx posts the transaction to the katzenmint node.

func (*PKIClient) Shutdown

func (p *PKIClient) Shutdown()

Shutdown the client

type PKIClientConfig

type PKIClientConfig struct {
	LogBackend         *log.Backend
	ChainID            string
	TrustOptions       light.TrustOptions
	PrimaryAddress     string
	WitnessesAddresses []string
	DatabaseName       string
	DatabaseDir        string
	RPCAddress         string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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