client

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package client encapsulates all calls to issuers and providers.

Package client encapsulates all calls to issuers and providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents an user of Coconut network

func New

func New(cfg *config.Config) (*Client, error)

New returns a new Client instance parameterized with the specified configuration. nolint: gocyclo

func (*Client) BlindSignAttributes

func (c *Client) BlindSignAttributes(pubM []*Curve.BIG, privM []*Curve.BIG) (*coconut.Signature, error)

BlindSignAttributes sends sign request to all IA servers specified in the config using TCP sockets with given set of public and private attributes. In the case of threshold system, after unblinding all results, first t results are aggregated and the result is randomised and returned. Otherwise all unblinded results are aggregated and then randomised. Error is returned if insufficient number of signatures was received.

func (*Client) BlindSignAttributesGrpc

func (c *Client) BlindSignAttributesGrpc(pubM []*Curve.BIG, privM []*Curve.BIG) (*coconut.Signature, error)

BlindSignAttributesGrpc sends blind sign request to all IA-grpc servers specified in the config with given set of public and private attributes. In the case of threshold system, after unblinding all results, first t results are aggregated and the result is randomised and returned. Otherwise all unblinded results are aggregated and then randomised. Error is returned if insufficient number of signatures was received.

func (*Client) GetAggregateVerificationKey

func (c *Client) GetAggregateVerificationKey() (*coconut.VerificationKey, error)

GetAggregateVerificationKey is basically a wrapper for GetVerificationKeys, but returns a single vk rather than slice with one element.

func (*Client) GetAggregateVerificationKeyGrpc

func (c *Client) GetAggregateVerificationKeyGrpc() (*coconut.VerificationKey, error)

GetAggregateVerificationKeyGrpc is basically a wrapper for GetVerificationKeysGrpc, but returns a single vk rather than slice with one element.

func (*Client) GetCredential

func (c *Client) GetCredential(token *token.Token) (*coconut.Signature, error)

GetCredential is a multistep procedure. First it sends 'GetCredential' request to Tendermint blockchain. This is followed by query to all IA servers specified in the config to obtain partial credentials based on materials sent to the chain.

func (*Client) GetCurrentERC20Balance

func (c *Client) GetCurrentERC20Balance() (uint64, error)

GetCurrentERC20Balance gets the current balance of ERC20 tokens associated with the client's address

func (*Client) GetCurrentERC20PendingBalance

func (c *Client) GetCurrentERC20PendingBalance() (uint64, error)

GetCurrentERC20PendingBalance gets the current pending balance of ERC20 tokens associated with the client's address

func (*Client) GetCurrentNymBalance

func (c *Client) GetCurrentNymBalance() (uint64, error)

GetCurrentNymBalance gets the current (might be slightly stale due to request being sent as a query and not transaction) balance associated with the client's address.

func (*Client) GetVerificationKeys

func (c *Client) GetVerificationKeys(shouldAggregate bool) ([]*coconut.VerificationKey, error)

GetVerificationKeys sends GetVerificationKey request to all IA servers specified in the config using TCP sockets. If the flag 'shouldAggregate' is set to true, the returned slice will consist of a single element, which will be the aggregated verification key. In the case of threshold system, first t results are aggregated, otherwise all results are aggregated. Error is returned if insufficient number of verification keys was received.

func (*Client) GetVerificationKeysGrpc

func (c *Client) GetVerificationKeysGrpc(shouldAggregate bool) ([]*coconut.VerificationKey, error)

GetVerificationKeysGrpc sends GetVerificationKey request to all IA-grpc servers specified in the config. If the flag 'shouldAggregate' is set to true, the returned slice will consist of a single element, which will be the aggregated verification key. In the case of threshold system, first t results are aggregated, otherwise all results are aggregated. Error is returned if insufficient number of verification keys was received.

func (*Client) LookUpIssuedCredential

func (c *Client) LookUpIssuedCredential(height int64,
	elGamalPrivateKey *elgamal.PrivateKey,
	elGamalPublicKey *elgamal.PublicKey,
) (*coconut.Signature, error)

LookUpIssuedCredential allows to recover a previously issued credential given knowledge of height on which we sent the materials and the elGamal keypair associated with the request.

func (*Client) SendCredentialsForBlindVerification

func (c *Client) SendCredentialsForBlindVerification(pubM []*Curve.BIG,
	privM []*Curve.BIG,
	sig *coconut.Signature,
	addr string,
	vk *coconut.VerificationKey,
) (bool, error)

SendCredentialsForBlindVerification sends a TCP request to verify obtained blind credentials to some specified provider server. If client does not provide aggregate verification key, the call will first try to obtain it. nolint: dupl

func (*Client) SendCredentialsForBlindVerificationGrpc

func (c *Client) SendCredentialsForBlindVerificationGrpc(pubM []*Curve.BIG,
	privM []*Curve.BIG,
	sig *coconut.Signature,
	addr string,
	vk *coconut.VerificationKey,
) (bool, error)

SendCredentialsForBlindVerificationGrpc sends a gRPC request to verify obtained blind credentials to some specified provider server. If client does not provide aggregate verification key, the call will first try to obtain it. errcheck is ignored to make it not complain about not checking for err in conn.Close() nolint: errcheck

func (*Client) SendCredentialsForVerification

func (c *Client) SendCredentialsForVerification(pubM []*Curve.BIG, sig *coconut.Signature, addr string) (bool, error)

SendCredentialsForVerification sends a TCP request to verify obtained credentials to some specified provider server.

func (*Client) SendCredentialsForVerificationGrpc

func (c *Client) SendCredentialsForVerificationGrpc(pubM []*Curve.BIG,
	sig *coconut.Signature,
	addr string,
) (bool, error)

SendCredentialsForVerificationGrpc sends a gRPC request to verify obtained credentials to some specified provider server. errcheck is ignored to make it not complain about not checking for err in conn.Close() nolint: errcheck

func (*Client) SendToPipeAccount

func (c *Client) SendToPipeAccount(ctx context.Context, amount int64) error

func (*Client) SignAttributes

func (c *Client) SignAttributes(pubM []*Curve.BIG) (*coconut.Signature, error)

SignAttributes sends sign request to all IA servers specified in the config using TCP sockets with given set of public attributes. In the case of threshold system, first t results are aggregated and the result is randomised and returned. Otherwise all results are aggregated and then randomised. Error is returned if insufficient number of signatures was received.

func (*Client) SignAttributesGrpc

func (c *Client) SignAttributesGrpc(pubM []*Curve.BIG) (*coconut.Signature, error)

SignAttributesGrpc sends sign request to all IA-grpc servers specified in the config with given set of public attributes. In the case of threshold system, first t results are aggregated and the result is randomised and returned. Otherwise all results are aggregated and then randomised. Error is returned if insufficient number of signatures was received.

func (*Client) SpendCredential

func (c *Client) SpendCredential(
	token *token.Token,
	credential *coconut.Signature,
	address string,
	providerAccountAddress ethcommon.Address,
	vk *coconut.VerificationKey,
) (bool, error)

SpendCredential sends a TCP request to spend an issued credential at a particular provider. nolint: dupl

func (*Client) SpendCredentialGrpc

func (c *Client) SpendCredentialGrpc(token *token.Token, credential *coconut.Signature, providerAddress []byte) error

SpendCredentialGrpc sends a gRPC request to spend an issued credential at a particular provider.

func (*Client) Stop

func (c *Client) Stop()

Stop stops client instance

Directories

Path Synopsis
Package config defines configuration used by coconut client.
Package config defines configuration used by coconut client.
Package cryptoworker combines coconut worker and job workers for a client instance.
Package cryptoworker combines coconut worker and job workers for a client instance.

Jump to

Keyboard shortcuts

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