root

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRoot = errors.New("invalid identity root")

ErrInvalidRoot shows that identity root verification flow completed without internal errors, but the root itself is invalid

Functions

This section is empty.

Types

type DisabledVerifier

type DisabledVerifier struct{}

DisabledVerifier returns nil error on verification

func (DisabledVerifier) VerifyRoot

func (v DisabledVerifier) VerifyRoot(_ string) error

type PoseidonSMTVerifier

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

PoseidonSMTVerifier is a wrapper around PoseidonSMT binding which calls IsRootValid on the contract. Currently used for GlobalPassport and GeorgianPassport proof types.

func NewPoseidonSMTVerifier

func NewPoseidonSMTVerifier(rpcURL, contract string, timeout time.Duration) (*PoseidonSMTVerifier, error)

func (*PoseidonSMTVerifier) VerifyRoot

func (v *PoseidonSMTVerifier) VerifyRoot(root string) error

type ProposalSMTVerifier

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

ProposalSMTVerifier performs validation with filtering RootUpdated events of ProposalSMT contract by root value. Currently used for PollParticipation proof type.

func NewProposalSMTVerifier

func NewProposalSMTVerifier(rpcURL string, timeout time.Duration) *ProposalSMTVerifier

NewProposalSMTVerifier creates basic ProposalSMTVerifier with RPC only. You must call WithContract to use it.

func (*ProposalSMTVerifier) VerifyRoot

func (v *ProposalSMTVerifier) VerifyRoot(root string) error

func (*ProposalSMTVerifier) WithContract

func (v *ProposalSMTVerifier) WithContract(addr string) Verifier

WithContract returns new instance of ProposalSMTVerifier which will call the provided contract. Provided address must be a valid 20-byte hex.

type Verifier

type Verifier interface {
	VerifyRoot(root string) error
}

Verifier is an abstraction to verify the root value against some state. Root must be provided as decimal string, acquired from ZK-proof public signals, which is then converted tot 32-byte array.

type VerifierProvider

type VerifierProvider interface {
	ProvideVerifier() Verifier
}

VerifierProvider provides a Verifier based on the given VerifierType from config map.

Specifying "disabled: true" in config allows to skip other map fields.

func NewVerifierProvider

func NewVerifierProvider(getter kv.Getter, typ VerifierType) VerifierProvider

NewVerifierProvider creates a new provider with given VerifierType. You must specify the name equal to VerifierType in map: this allows to have multiple verifiers in the same app. For custom name or logic write your own config map handler.

type VerifierType

type VerifierType string
const (
	PoseidonSMT VerifierType = "poseidonsmt_root_verifier"
	ProposalSMT              = "proposalsmt_root_verifier"
)

Jump to

Keyboard shortcuts

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