Version: v0.3.0 Latest Latest

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 18 Imported by: 0




This section is empty.


View Source
var (
	// ErrNilProof occurs when the provided GetUserResponse contains a nil proof.
	ErrNilProof = errors.New("nil proof")


This section is empty.


type LogTracker

type LogTracker interface {
	// LastVerifiedLogRoot retrieves the tree size of the latest log root.
	LastVerifiedLogRoot() *pb.LogRootRequest
	// VerifyLogRoot verifies root and updates the trusted root if it is newer.
	VerifyLogRoot(state *pb.LogRootRequest, newRoot *pb.LogRoot) (*types.LogRootV1, error)

LogTracker tracks a series of consistent log roots.

type LogTrackerFactory

type LogTrackerFactory func(*tclient.LogVerifier) LogTracker

LogTrackerFactory allows the caller of NewFromDirectory to supply different tracker implementations. eg. no-op, single-synchronous-head, and multi-head tracking.

type Verifier

type Verifier struct {
	// contains filtered or unexported fields

Verifier is a client helper library for verifying requests and responses.

func New

New creates a new instance of the client verifier.

func NewFromDirectory

func NewFromDirectory(config *pb.Directory, f LogTrackerFactory) (*Verifier, error)

NewFromDirectory creates a new instance of the client verifier from a config.

func (*Verifier) Index

func (v *Verifier) Index(vrfProof []byte, directoryID, userID string) ([]byte, error)

Index computes the index from a VRF proof.

func (*Verifier) LastVerifiedLogRoot

func (v *Verifier) LastVerifiedLogRoot() *pb.LogRootRequest

LastVerifiedLogRoot returns a LogRootRequest for making an RPC

func (*Verifier) VerifyBatchGetUser

func (v *Verifier) VerifyBatchGetUser(req *pb.BatchGetUserRequest, resp *pb.BatchGetUserResponse) error

VerifyBatchGetUser verifies that the retrieved profiles are correct.

func (*Verifier) VerifyGetUser

func (v *Verifier) VerifyGetUser(req *pb.GetUserRequest, resp *pb.GetUserResponse) error

VerifyGetUser verifies that the retrieved profile of userID is correct.

func (*Verifier) VerifyLogRoot

func (v *Verifier) VerifyLogRoot(req *pb.LogRootRequest, slr *pb.LogRoot) (*types.LogRootV1, error)

VerifyLogRoot verifies that revision.LogRoot is consistent with the last trusted SignedLogRoot.

func (*Verifier) VerifyMapLeaf

func (v *Verifier) VerifyMapLeaf(directoryID, userID string,
	in *pb.MapLeaf, mapRoot *types.MapRootV1) error

VerifyMapLeaf verifies pb.MapLeaf:

- Verify commitment.
- Verify VRF and index.
- Verify map inclusion proof.

func (*Verifier) VerifyMapRevision

func (v *Verifier) VerifyMapRevision(lr *types.LogRootV1, smr *pb.MapRoot) (*types.MapRootV1, error)

VerifyMapRevision verifies that the map revision is correctly signed and included in the append only log.

Jump to

Keyboard shortcuts

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