grpcc

package
v0.0.0-...-9be813a Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package grpcc is a client for communicating with the Key Server. It wraps the gRPC apis in a rpc system neutral interface and verifies all responses.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRetry occurs when an update request has been submitted, but the
	// results of the update are not visible on the server yet. The client
	// must retry until the request is visible.
	ErrRetry = errors.New("update not present on server yet")
	// ErrIncomplete occurs when the server indicates that requested epochs
	// are not available.
	ErrIncomplete = errors.New("incomplete account history")
	// Vlog is the verbose logger. By default it outputs to /dev/null.
	Vlog = log.New(ioutil.Discard, "", 0)
)

Functions

This section is empty.

Types

type Client

type Client struct {
	RetryCount int
	RetryDelay time.Duration
	// contains filtered or unexported fields
}

Client is a helper library for issuing updates to the key server. Client Responsibilities - Trust Model: - - Trusted Monitors - - Verify last X days - Gossip - What is the current value of the root? - - Gossip advancement: advance state between current and server. - Sender queries - Do queries match up against the gossip root? - - List trusted monitors. - Key Owner - - Periodically query own keys. Do they match the private keys I have? - - Sign key update requests.

func New

func New(ktClient pb.KeyTransparencyClient,
	domainID string,
	vrf vrf.PublicKey,
	mapPubKey crypto.PublicKey,
	mapHasher hashers.MapHasher,
	logVerifier client.LogVerifier) *Client

New creates a new client.

func NewFromConfig

func NewFromConfig(ktClient pb.KeyTransparencyClient, config *pb.Domain) (*Client, error)

NewFromConfig creates a new client from a config

func (*Client) GetEntry

func (c *Client) GetEntry(ctx context.Context, userID, appID string, opts ...grpc.CallOption) ([]byte, *trillian.SignedMapRoot, error)

GetEntry returns an entry if it exists, and nil if it does not.

func (*Client) ListHistory

func (c *Client) ListHistory(ctx context.Context, userID, appID string, start, end int64, opts ...grpc.CallOption) (map[*trillian.SignedMapRoot][]byte, error)

ListHistory returns a list of profiles starting and ending at given epochs. It also filters out all identical consecutive profiles.

func (*Client) Retry

func (c *Client) Retry(ctx context.Context, m *entry.Mutation, signers []signatures.Signer, opts ...grpc.CallOption) error

Retry takes take a mutation, signs, and sends it again, and updates the back pointer with the current leaf value.

func (*Client) Update

func (c *Client) Update(ctx context.Context, appID, userID string, profileData []byte,
	signers []signatures.Signer, authorizedKeys []*keyspb.PublicKey,
	opts ...grpc.CallOption) (*entry.Mutation, error)

Update creates an UpdateEntryRequest for a user, attempt to submit it multiple times depending on RetryCount.

Jump to

Keyboard shortcuts

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