diff --git a/docs/spec/components/schemas/User.yaml b/docs/spec/components/schemas/User.yaml index d526895..656a4a5 100644 --- a/docs/spec/components/schemas/User.yaml +++ b/docs/spec/components/schemas/User.yaml @@ -6,10 +6,6 @@ allOf: - attributes properties: attributes: - required: - - age_lower_bound - - uniqueness - - nationality properties: age_lower_bound: type: integer diff --git a/internal/assets/migrations/001_initial.sql b/internal/assets/migrations/001_initial.sql index 8d57086..c5a35b4 100644 --- a/internal/assets/migrations/001_initial.sql +++ b/internal/assets/migrations/001_initial.sql @@ -4,11 +4,11 @@ CREATE TABLE verify_users ( user_id TEXT PRIMARY KEY NOT NULL, user_id_hash TEXT NOT NULL, - age_lower_bound INT NOT NULL, - nationality TEXT NOT NULL, + age_lower_bound INT, + nationality TEXT, created_at TIMESTAMP NOT NULL DEFAULT (NOW() AT TIME ZONE 'utc'), uniqueness BOOLEAN NOT NULL, - event_id TEXT NOT NULL, + event_id TEXT, status TEXT NOT NULL, proof JSON NOT NULL ); diff --git a/internal/config/verifier.go b/internal/config/verifier.go index 96610c4..2f9f0f3 100644 --- a/internal/config/verifier.go +++ b/internal/config/verifier.go @@ -32,7 +32,6 @@ func (c *config) Verifiers() Verifiers { zk.WithVerificationKeyFile(cfg.VerificationKeyPath), zk.WithPassportRootVerifier(c.passport.ProvideVerifier()), zk.WithIdentitiesCreationTimestampLimit(cfg.AllowedIdentityTimestamp), - zk.WithEventID(c.ProofParametersConfig().EventID), ) if err != nil { panic(fmt.Errorf("failed to initialize passport verifier: %w", err)) diff --git a/internal/service/handlers/get_proof.go b/internal/service/handlers/get_proof.go index 02a03d5..ddcea00 100644 --- a/internal/service/handlers/get_proof.go +++ b/internal/service/handlers/get_proof.go @@ -44,7 +44,7 @@ func NewProofByUserIDResponse(user data.VerifyUsers) resources.GetProofRequest { Type: resources.GET_PROOF, }, Attributes: resources.GetProofAttributes{ - Proof: &proof, + Proof: proof, }, }, } diff --git a/internal/service/handlers/proof_params.go b/internal/service/handlers/proof_params.go index 5939faf..caabe69 100644 --- a/internal/service/handlers/proof_params.go +++ b/internal/service/handlers/proof_params.go @@ -47,6 +47,11 @@ func GetProofParamsById(w http.ResponseWriter, r *http.Request) { eventID = existingUser.EventId } + birthDateUpperBound := CalculateBirthDateHex(existingUser.AgeLowerBound) + if existingUser.AgeLowerBound == 0 { + birthDateUpperBound = "0x303030303030" + } + proofSelector := CalculateProofSelector(existingUser.Uniqueness) if proofSelector&(1<