pubsignals

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIssuerClaimStateIsNotValid = errors.New("issuer state is not valid")

ErrIssuerClaimStateIsNotValid declares that issuer state is invalid

View Source
var ErrUserStateIsNotValid = errors.New("user state is not valid")

ErrUserStateIsNotValid declares that issuer state is invalid

Functions

func RegisterVerifier

func RegisterVerifier(id circuits.CircuitID, t reflect.Type)

RegisterVerifier is factory for public signals init. This is done during init() in the method's implementation

Types

type AtomicQueryMTP

type AtomicQueryMTP struct {
	circuits.AtomicQueryMTPPubSignals
}

AtomicQueryMTP is a wrapper for circuits.AtomicQueryMTPPubSignals

func (*AtomicQueryMTP) VerifyIDOwnership

func (c *AtomicQueryMTP) VerifyIDOwnership(sender string, challenge *big.Int) error

VerifyIDOwnership returns error if ownership id wasn't verified in circuit

func (*AtomicQueryMTP) VerifyQuery

func (c *AtomicQueryMTP) VerifyQuery(ctx context.Context, query Query, schemaLoader loaders.SchemaLoader) error

VerifyQuery verifies query for atomic query mtp circuit

func (*AtomicQueryMTP) VerifyStates

func (c *AtomicQueryMTP) VerifyStates(ctx context.Context, stateResolver StateResolver) error

VerifyStates verifies user state and issuer claim issuance state in the smart contract

type AtomicQuerySig

type AtomicQuerySig struct {
	circuits.AtomicQuerySigPubSignals
}

AtomicQuerySig is a wrapper for circuits.AtomicQuerySigPubSignals

func (*AtomicQuerySig) VerifyIDOwnership

func (c *AtomicQuerySig) VerifyIDOwnership(sender string, challenge *big.Int) error

VerifyIDOwnership returns error if ownership id wasn't verified in circuit

func (*AtomicQuerySig) VerifyQuery

func (c *AtomicQuerySig) VerifyQuery(ctx context.Context, query Query, schemaLoader loaders.SchemaLoader) error

VerifyQuery verifies query for atomic query mtp circuit

func (*AtomicQuerySig) VerifyStates

func (c *AtomicQuerySig) VerifyStates(ctx context.Context, stateResolver StateResolver) error

VerifyStates verifies user state and issuer auth claim state in the smart contract

type Auth

type Auth struct {
	circuits.AuthPubSignals
}

Auth is a wrapper for circuits.AuthPubSignals

func (*Auth) VerifyIDOwnership

func (c *Auth) VerifyIDOwnership(sender string, challenge *big.Int) error

VerifyIDOwnership returns error if ownership id wasn't verified in circuit

func (*Auth) VerifyQuery

func (c *Auth) VerifyQuery(_ context.Context, _ Query, _ loaders.SchemaLoader) error

VerifyQuery is not implemented for auth circuit

func (*Auth) VerifyStates

func (c *Auth) VerifyStates(ctx context.Context, stateResolver StateResolver) error

VerifyStates verify auth tests

type ClaimOutputs

type ClaimOutputs struct {
	IssuerID   *core.ID
	SchemaHash core.SchemaHash
	SlotIndex  int
	Operator   int
	Value      []*big.Int
}

ClaimOutputs fields that are used in proof generation

type Query

type Query struct {
	AllowedIssuers []string               `json:"allowed_issuers"`
	Req            map[string]interface{} `json:"req"`
	Schema         protocol.Schema        `json:"schema"`
	ClaimID        string                 `json:"claimId,omitempty"`
}

Query represents structure for query to atomic circuit

func (Query) CheckRequest

func (q Query) CheckRequest(ctx context.Context, loader loaders.SchemaLoader,
	out ClaimOutputs) error

CheckRequest checks request

type StateResolver

type StateResolver interface {
	Resolve(ctx context.Context, id *big.Int, state *big.Int) (*state.ResolvedState, error)
}

StateResolver is a state resolver interface

type Verifier

type Verifier interface {
	VerifyQuery(ctx context.Context, query Query, schemaLoader loaders.SchemaLoader) error
	VerifyStates(ctx context.Context, resolver StateResolver) error
	VerifyIDOwnership(userIdentifier string, challenge *big.Int) error

	circuits.PubSignalsUnmarshaller
}

Verifier is interface for verification of public signals of zkp

func GetVerifier

func GetVerifier(id circuits.CircuitID) (Verifier, error)

GetVerifier return specific public signals verifier

Jump to

Keyboard shortcuts

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