diff --git a/internal/config/verifier.go b/internal/config/verifier.go index 2f9f0f3..1356492 100644 --- a/internal/config/verifier.go +++ b/internal/config/verifier.go @@ -10,6 +10,7 @@ import ( type Verifiers struct { Passport *zk.Verifier + Age int64 } func (c *config) Verifiers() Verifiers { @@ -31,7 +32,7 @@ func (c *config) Verifiers() Verifiers { zk.WithProofType(zk.GlobalPassport), zk.WithVerificationKeyFile(cfg.VerificationKeyPath), zk.WithPassportRootVerifier(c.passport.ProvideVerifier()), - zk.WithIdentitiesCreationTimestampLimit(cfg.AllowedIdentityTimestamp), + //zk.WithIdentitiesCreationTimestampLimit(cfg.AllowedIdentityTimestamp), ) if err != nil { panic(fmt.Errorf("failed to initialize passport verifier: %w", err)) @@ -39,6 +40,7 @@ func (c *config) Verifiers() Verifiers { return Verifiers{ Passport: pass, + Age: cfg.AllowedIdentityTimestamp, } }).(Verifiers) } diff --git a/internal/service/handlers/verification-link.go b/internal/service/handlers/verification-link.go index a50034c..1b22e6d 100644 --- a/internal/service/handlers/verification-link.go +++ b/internal/service/handlers/verification-link.go @@ -26,11 +26,12 @@ func VerificationLink(w http.ResponseWriter, r *http.Request) { } user := &data.VerifyUsers{ - UserID: req.Data.ID, - UserIDHash: userIdHash, - CreatedAt: time.Now().UTC(), - Status: "not_verified", - Proof: []byte{}, + UserID: req.Data.ID, + UserIDHash: userIdHash, + CreatedAt: time.Now().UTC(), + Status: "not_verified", + Proof: []byte{}, + AgeLowerBound: -1, } if req.Data.Attributes.Nationality != nil && *req.Data.Attributes.Nationality != "" { diff --git a/internal/service/handlers/verification_callback.go b/internal/service/handlers/verification_callback.go index c335235..c44f702 100644 --- a/internal/service/handlers/verification_callback.go +++ b/internal/service/handlers/verification_callback.go @@ -77,6 +77,15 @@ func VerificationCallback(w http.ResponseWriter, r *http.Request) { return } + var verifyOpts = []zk.VerifyOption{ + zk.WithProofSelectorValue(getter.Get(zk.Selector)), + zk.WithAgeAbove(verifiedUser.AgeLowerBound), // if not required -1 + zk.WithEventID(eventID), + } + if verifiedUser.Nationality != "" { + verifyOpts = append(verifyOpts, zk.WithCitizenships(verifiedUser.Nationality)) + } + // uniqueness check timestampUpperBoundMatches := getter.Get(zk.TimestampUpperBound) == ProofParameters(r).TimestampUpperBound timestampUpperBoundCheckRequired := selectorInt&(1<