Skip to content

Commit

Permalink
update: config with allowed credentials info; add: verification optio…
Browse files Browse the repository at this point in the history
…ns to zkverifier, some description to fields in cfg
  • Loading branch information
mhrynenko committed May 14, 2024
1 parent cef6dbe commit 21c6670
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ verifier:
verification_key_path: "./verification_key.json"
allowed_age: 18
allowed_citizenships: ["UKR"]
# during proof verification allowed_credentials_count OR allowed_credential_timestamp will be checked in public signals
# allowed_credentials_count - amount of credentials that user may create if the credentials timestamp after airdrop starting
# allowed_credential_timestamp - timestamp that limits when user might create credentials if it has more than 1
allowed_credentials_count: 1
allowed_credential_timestamp: 1715698750

root_verifier:
rpc: evm_rpc_url
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/iden3/go-rapidsnark/types v0.0.3
github.com/rarimo/rarimo-core v0.0.0-20231004143803-6b209428ecbf
github.com/rarimo/zkverifier-kit v0.2.0
github.com/rarimo/zkverifier-kit v0.2.1-rc.1
github.com/rubenv/sql-migrate v1.6.1
gitlab.com/distributed_lab/ape v1.7.1
gitlab.com/distributed_lab/figure/v3 v3.1.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,8 @@ github.com/rarimo/rarimo-core v0.0.0-20231004143803-6b209428ecbf h1:NvYhOErW0d7o
github.com/rarimo/rarimo-core v0.0.0-20231004143803-6b209428ecbf/go.mod h1:Onkd0EJP94hw4dT/2KH7QXRwDG4eIGeaMffSjA1i6/s=
github.com/rarimo/zkverifier-kit v0.2.0 h1:FybrsDdpP/x/m0ZtEeU9lcHsztlPtCBLo67unAdbFGA=
github.com/rarimo/zkverifier-kit v0.2.0/go.mod h1:ROaCxusG9WLNwbqlTBKqZCm8tQrNdnwLyRWtS+yxO8o=
github.com/rarimo/zkverifier-kit v0.2.1-rc.1 h1:5xMm9CiXm7eD4A0In1lMnBUcdS84xmz4RFKZyvgGxhQ=
github.com/rarimo/zkverifier-kit v0.2.1-rc.1/go.mod h1:ROaCxusG9WLNwbqlTBKqZCm8tQrNdnwLyRWtS+yxO8o=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg=
Expand Down
10 changes: 7 additions & 3 deletions internal/config/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ const proofEventIDValue = "30435886288273153911282793098299938669170272771042148
func (c *Config) Verifier() *zk.Verifier {
return c.verifier.Do(func() interface{} {
var cfg struct {
VerificationKeyPath string `fig:"verification_key_path,required"`
AllowedAge int `fig:"allowed_age,required"`
AllowedCitizenships []string `fig:"allowed_citizenships,required"`
VerificationKeyPath string `fig:"verification_key_path,required"`
AllowedAge int `fig:"allowed_age,required"`
AllowedCitizenships []string `fig:"allowed_citizenships,required"`
AllowedCredentialsCount int64 `fig:"allowed_credentials_count,required"`
AllowedCredentialTimestamp int64 `fig:"allowed_credential_timestamp,required"`
}

err := figure.
Expand All @@ -33,6 +35,8 @@ func (c *Config) Verifier() *zk.Verifier {
zk.WithAgeAbove(cfg.AllowedAge),
zk.WithEventID(proofEventIDValue),
zk.WithRootVerifier(c.ProvideVerifier()),
zk.WithIdentitiesCounter(cfg.AllowedCredentialsCount),
zk.WithIdentitiesCreationTimestampLimit(cfg.AllowedCredentialTimestamp),
)

if err != nil {
Expand Down

0 comments on commit 21c6670

Please sign in to comment.