Skip to content

Commit

Permalink
Fix eventID and selector values verification
Browse files Browse the repository at this point in the history
  • Loading branch information
violog committed Jul 10, 2024
1 parent f28ffad commit 8e9ded7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions internal/config/passpor_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package config
import (
"fmt"

"github.com/rarimo/geo-auth-svc/internal/zkp"
zk "github.com/rarimo/zkverifier-kit"
"gitlab.com/distributed_lab/figure/v3"
"gitlab.com/distributed_lab/kit/kv"
)

const (
proofEventIDValue = "111186066134341633902189494613533900917417361106374681011849132651019822199"
proofSelectorValue = "219681"
proofSelectorValue = "236065"
maxIdentityCount = 1
documentTypeID = "ID"
)
Expand All @@ -37,7 +37,7 @@ func (c *config) PassportVerifier() *zk.Verifier {
zk.WithAgeAbove(cfg.AllowedAge),
zk.WithIdentityVerifier(c.ProvideVerifier()),
zk.WithProofSelectorValue(proofSelectorValue),
zk.WithEventID(proofEventIDValue),
zk.WithEventID(zkp.EventIDValue),
zk.WithIdentitiesCounter(maxIdentityCount),
zk.WithIdentitiesCreationTimestampLimit(cfg.AllowedIdentityTimestamp),
zk.WithDocumentType(documentTypeID),
Expand Down
4 changes: 2 additions & 2 deletions internal/zkp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func (v *AuthVerifier) VerifyProof(user string, proof *zkptypes.ZKProof) (err er
switch {
case proof.PubSignals[NullifierSignalsIndex] != user:
return fmt.Errorf("expected user=%s, got %s", user, proof.PubSignals[NullifierSignalsIndex])
case proof.PubSignals[EventIDSignalsIndex] != EventID:
return fmt.Errorf("expected eventID=%s, got %s", EventID, proof.PubSignals[EventIDSignalsIndex])
case proof.PubSignals[EventIDSignalsIndex] != EventIDValue:
return fmt.Errorf("expected eventID=%s, got %s", EventIDValue, proof.PubSignals[EventIDSignalsIndex])
case proof.PubSignals[EventDataSignalsIndex] != chalDec:
return fmt.Errorf("expected challenge=%s, got %s", chalDec, proof.PubSignals[EventDataSignalsIndex])
}
Expand Down
5 changes: 2 additions & 3 deletions internal/zkp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ const (
EventDataSignalsIndex = 3
)

const EventID = "211985299740800702300256033401632392934377086534111448880928528431996790315"

const ChallengeExpirationDelta = 5 * time.Minute

const EventIDValue = "111186066134341633902189494613533900917417361106374681011849132651019822199"

var NullifierRegexp = regexp.MustCompile("^0x[0-9a-fA-F]{64}$")
var AIDRegexp = regexp.MustCompile("^[0-9a-f]{64}$")

type Challenge struct {
Value string
Expand Down

0 comments on commit 8e9ded7

Please sign in to comment.