verifier

package
Version: v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdenStateOnChainDoesntMatch    = fmt.Errorf("IdenState on chain doesn't match the one in the credential")
	ErrMtpNonExistence                = fmt.Errorf("The Merkle Tree Proof is of non-existence")
	ErrMtpExistence                   = fmt.Errorf("The Merkle Tree Proof is of existence")
	ErrCalculatedIdenStateDoesntMatch = fmt.Errorf("Calculated IdenState doesn't match the one in the credential")
	ErrClaimExpired                   = fmt.Errorf("Expired claim")
	ErrFailedVerifyZkProofCredential  = fmt.Errorf("failed verifing generated zk proof of credential")
)

Functions

This section is empty.

Types

type Verifier

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

Verifier allows verifying claims in three forms: credential of existence, credential of validity, and zero knowledge proof of valid credential ownership.

func New

func New(idenPubOnChain idenpubonchain.IdenPubOnChainer) *Verifier

NewWithTimeNow creates a verifier that uses the real time to validate freshness of claims.

func NewWithTimeNow

func NewWithTimeNow(idenPubOnChain idenpubonchain.IdenPubOnChainer, timeNow func() time.Time) *Verifier

NewWithTimeNow creates a verifier that uses the time returned by `timeNow` to validate freshness of claims. Mainly used for testing (by faking the current time).

func (*Verifier) VerifyCredentialExistence

func (v *Verifier) VerifyCredentialExistence(credExist *proof.CredentialExistence) error

VerifyCredentialExistence verifies a credential of existence. That is, that the claim was issued by a particular identity.

func (*Verifier) VerifyCredentialValidity

func (v *Verifier) VerifyCredentialValidity(credValid *proof.CredentialValidity, freshness time.Duration) error

VerifyCredentialValidity verifies a credential of validity. That is, that the claim was issued by a particular identity, and that it has not been revoked passed the freshness time.

func (*Verifier) VerifyZkProofCredential added in v0.0.8

func (v *Verifier) VerifyZkProofCredential(
	zkProof *zktypes.Proof,
	pubSignals []*big.Int,
	issuerID *core.ID,
	idenStateBlockN uint64,
	zkFiles *zkutils.ZkFiles,
	freshness time.Duration) error

VerifyZkProofCredential verifies a zkp of a credential. For now expiration is not checked.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL