From 7cb664bbcbf65e4358154dc2a8673ee5029dea60 Mon Sep 17 00:00:00 2001 From: daveroga Date: Thu, 25 Apr 2024 11:36:51 +0200 Subject: [PATCH 1/6] add custom did methods and ipfs gateway in config --- .env.example | 3 +- README.md | 2 +- main.go | 9 ++-- packagemanager/packagemanager.go | 74 +++++++++++++++++++++++++++++++- service/refresh.go | 7 ++- 5 files changed, 87 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 9b31abf..73c9f9a 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ -IPFS_URL="" +IPFS_GATEWAY_URL="" SUPPORTED_RPC="" SUPPORTED_STATE_CONTRACTS="80001=0x134B1BE34911E39A8397ec6289782989729807a4" SUPPORTED_ISSUERS="" ISSUERS_BASIC_AUTH="" +SUPPORTED_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' \ No newline at end of file diff --git a/README.md b/README.md index eaa9d49..1dd6cb4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ To run this service, users should manage two configurations: one in a `.env` fil 1. `.env` file: ``` SUPPORTED_ISSUERS - A list of supported issuers in the format `issuerDID=issuerNodeURL`. You can also use `*` to set a default node. - IPFS_URL - The URL of the IPFS node. + IPFS_GATEWAY_URL - The URL of the IPFS gateway. SERVER_PORT - The server port. The default is 8002. HTTP_CONFIG_PATH - The path to the HTTP configuration. SUPPORTED_RPC - Supported RPC in the format `chainID=URL`. diff --git a/main.go b/main.go index f68a405..99bb3e6 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,6 @@ import ( "github.com/0xPolygonID/refresh-service/server" "github.com/0xPolygonID/refresh-service/service" "github.com/iden3/go-schema-processor/v2/loaders" - shell "github.com/ipfs/go-ipfs-api" "github.com/kelseyhightower/envconfig" "github.com/pkg/errors" ) @@ -46,13 +45,14 @@ func (c *KVstring) Decode(value string) error { type Config struct { SupportedIssuers KVstring `envconfig:"SUPPORTED_ISSUERS" required:"true"` - IPFSURL string `envconfig:"IPFS_URL" required:"true"` + IPFSGWURL string `envconfig:"IPFS_GATEWAY_URL"` ServerHost string `envconfig:"SERVER_HOST" default:"localhost:8002"` HTTPConfigPath string `envconfig:"HTTP_CONFIG_PATH" default:"config.yaml"` SupportedRPC KVstring `envconfig:"SUPPORTED_RPC" required:"true"` SupportedStateContracts KVstring `envconfig:"SUPPORTED_STATE_CONTRACTS" required:"true"` CircuitsFolderPath string `envconfig:"CIRCUITS_FOLDER_PATH" default:"circuits"` SupportedIssuersBasicAuth KVstring `envconfig:"ISSUERS_BASIC_AUTH"` + SupportedCustomDIDMethods string `envconfig:"SUPPORTED_CUSTOM_DID_METHODS"` } func (c *Config) getServerHost() string { @@ -77,6 +77,7 @@ func main() { cfg.SupportedRPC, cfg.SupportedStateContracts, packagemanager.WithVerificationKeyPath(cfg.CircuitsFolderPath), + packagemanager.WithCustomDIDMethods(cfg.SupportedCustomDIDMethods), ) if err != nil { log.Fatalf("failed init package manager: %v", err) @@ -93,8 +94,8 @@ func main() { if err != nil { log.Fatalf("failed init memory cache engine: %v", err) } - ipfsCli := shell.NewShell(cfg.IPFSURL) - documentLoader := loaders.NewDocumentLoader(ipfsCli, "", + + documentLoader := loaders.NewDocumentLoader(nil, cfg.IPFSGWURL, loaders.WithCacheEngine(memoryCacheEngine)) flexhttp, err := flexiblehttp.NewFactoryFlexibleHTTP( diff --git a/packagemanager/packagemanager.go b/packagemanager/packagemanager.go index 9cfd8fe..e08ccaf 100644 --- a/packagemanager/packagemanager.go +++ b/packagemanager/packagemanager.go @@ -25,6 +25,22 @@ type state struct { globalStateValidDuration time.Duration } +func registerCustomDIDMethods(cdm []CustomDIDMethods) error { + for _, network := range cdm { + params := core.DIDMethodNetworkParams{ + Method: core.DIDMethodPolygonID, + Blockchain: core.Blockchain(network.Blockchain), + Network: core.NetworkID(network.Network), + NetworkFlag: network.NetworkFlag, + } + err := core.RegisterDIDMethodNetwork(params, core.WithChainID(network.ChainID)) + if err != nil { + return errors.Errorf("did method can't be registered: %v", err) + } + } + return nil +} + func (s *state) verify(_ circuits.CircuitID, pubsignals []string) error { bytePubsig, err := json.Marshal(pubsignals) if err != nil { @@ -39,7 +55,7 @@ func (s *state) verify(_ circuits.CircuitID, pubsignals []string) error { userDID, err := core.ParseDIDFromID(*authPubSignals.UserID) if err != nil { - return errors.Errorf("error convertign userID '%s' to userDID: %v", + return errors.Errorf("error converting userID '%s' to userDID: %v", authPubSignals.UserID.String(), err) } @@ -81,10 +97,48 @@ func (s *state) verify(_ circuits.CircuitID, pubsignals []string) error { type Options struct { VerificationKeyPath string GlobalStateValidDuration time.Duration + CustomDIDMethods []CustomDIDMethods `mapstructure:"-"` } type Option func(*Options) +// CustomDIDMethods struct +// Example: SUPPORTED_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]' +type CustomDIDMethods struct { + Blockchain string `tip:"Identity blockchain for custom network"` + Network string `tip:"Identity network for custom network"` + NetworkFlag byte `tip:"Identity network flag for custom network"` + ChainID int `tip:"Chain id for custom network"` +} + +// UnmarshalJSON implements the Unmarshal interface for CustomDIDMethods +func (cn *CustomDIDMethods) UnmarshalJSON(data []byte) error { + aux := struct { + Blockchain string `json:"blockchain"` + Network string `json:"network"` + NetworkFlag string `json:"networkFlag"` + ChainID int `json:"chainId"` + }{} + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if len(aux.NetworkFlag) != 10 || aux.NetworkFlag[:2] != "0b" { + return errors.New("invalid NetworkFlag format") + } + flag, err := strconv.ParseUint(aux.NetworkFlag[2:], 2, 8) + if err != nil { + return err + } + + cn.Blockchain = aux.Blockchain + cn.Network = aux.Network + cn.NetworkFlag = byte(flag) + cn.ChainID = aux.ChainID + + return nil +} + func WithVerificationKeyPath(path string) Option { return func(o *Options) { o.VerificationKeyPath = path @@ -97,6 +151,18 @@ func WithGlobalStateValidDuration(duration time.Duration) Option { } } +func WithCustomDIDMethods(jsonStr string) Option { + return func(o *Options) { + var customDIDMethods []CustomDIDMethods + if jsonStr != "" { + if err := json.Unmarshal([]byte(jsonStr), &customDIDMethods); err != nil { + customDIDMethods = nil + } + } + o.CustomDIDMethods = customDIDMethods + } +} + func NewPackageManager( supportedRPC map[string]string, supportedStateContracts map[string]string, @@ -106,11 +172,17 @@ func NewPackageManager( options := &Options{ VerificationKeyPath: "/keys", GlobalStateValidDuration: time.Minute * 15, + CustomDIDMethods: []CustomDIDMethods{}, } for _, opt := range opts { opt(options) } + err := registerCustomDIDMethods(options.CustomDIDMethods) + if err != nil { + return nil, err + } + authV2VerificationKeyPath := fmt.Sprintf("%s/authV2.json", options.VerificationKeyPath) verificationKey, err := os.ReadFile(authV2VerificationKeyPath) if err != nil { diff --git a/service/refresh.go b/service/refresh.go index c95ae3c..893014b 100644 --- a/service/refresh.go +++ b/service/refresh.go @@ -10,6 +10,7 @@ import ( core "github.com/iden3/go-iden3-core/v2" jsonproc "github.com/iden3/go-schema-processor/v2/json" "github.com/iden3/go-schema-processor/v2/merklize" + "github.com/iden3/go-schema-processor/v2/processor" "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/piprate/json-gold/ld" "github.com/pkg/errors" @@ -179,7 +180,11 @@ func (rs *RefreshService) isUpdatedIndexSlots( credential *verifiable.W3CCredential, oldValues, newValues map[string]interface{}, ) error { - claim, err := jsonproc.Parser{}.ParseClaim(ctx, *credential, nil) + claim, err := jsonproc.Parser{}.ParseClaim(ctx, *credential, &processor.CoreClaimOptions{ + MerklizerOpts: []merklize.MerklizeOption{ + merklize.WithDocumentLoader(rs.documentLoader), + }, + }) if err != nil { return errors.Errorf("invalid w3c credential: %v", err) } From b86a9de573ed32ac0f5780ae5921294987108e51 Mon Sep 17 00:00:00 2001 From: daveroga Date: Thu, 25 Apr 2024 11:38:35 +0200 Subject: [PATCH 2/6] require ipfs gateway config --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 99bb3e6..3994de8 100644 --- a/main.go +++ b/main.go @@ -45,7 +45,7 @@ func (c *KVstring) Decode(value string) error { type Config struct { SupportedIssuers KVstring `envconfig:"SUPPORTED_ISSUERS" required:"true"` - IPFSGWURL string `envconfig:"IPFS_GATEWAY_URL"` + IPFSGWURL string `envconfig:"IPFS_GATEWAY_URL required: true"` ServerHost string `envconfig:"SERVER_HOST" default:"localhost:8002"` HTTPConfigPath string `envconfig:"HTTP_CONFIG_PATH" default:"config.yaml"` SupportedRPC KVstring `envconfig:"SUPPORTED_RPC" required:"true"` From cd2f2aef29685b7e34c175c9d472f83941a43d27 Mon Sep 17 00:00:00 2001 From: daveroga Date: Thu, 25 Apr 2024 12:24:52 +0200 Subject: [PATCH 3/6] error in config --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 3994de8..36370d8 100644 --- a/main.go +++ b/main.go @@ -45,7 +45,7 @@ func (c *KVstring) Decode(value string) error { type Config struct { SupportedIssuers KVstring `envconfig:"SUPPORTED_ISSUERS" required:"true"` - IPFSGWURL string `envconfig:"IPFS_GATEWAY_URL required: true"` + IPFSGWURL string `envconfig:"IPFS_GATEWAY_URL" required:"true"` ServerHost string `envconfig:"SERVER_HOST" default:"localhost:8002"` HTTPConfigPath string `envconfig:"HTTP_CONFIG_PATH" default:"config.yaml"` SupportedRPC KVstring `envconfig:"SUPPORTED_RPC" required:"true"` From d9c62bbc4c59c8cc1ea8b9884717f476555863e8 Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 25 Apr 2024 14:31:15 +0300 Subject: [PATCH 4/6] improvments --- .env.example | 9 +++-- README.md | 6 ++-- go.mod | 33 +++++------------- go.sum | 87 +++++++++++++++++++----------------------------- main.go | 30 +++++++++++------ pkg/ipfs/ipfs.go | 51 ++++++++++++++++++++++++++++ 6 files changed, 123 insertions(+), 93 deletions(-) create mode 100644 pkg/ipfs/ipfs.go diff --git a/.env.example b/.env.example index 9b31abf..6c68f19 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,8 @@ -IPFS_URL="" -SUPPORTED_RPC="" -SUPPORTED_STATE_CONTRACTS="80001=0x134B1BE34911E39A8397ec6289782989729807a4" SUPPORTED_ISSUERS="" +IPFS_URL_GATEWAY="" +SERVER_HOST="" +HTTP_CONFIG_PATH="" +SUPPORTED_RPC="" +SUPPORTED_STATE_CONTRACTS="80002=0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124" +CIRCUITS_FOLDER_PATH="" ISSUERS_BASIC_AUTH="" diff --git a/README.md b/README.md index eaa9d49..1698b77 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ To run this service, users should manage two configurations: one in a `.env` fil 1. `.env` file: ``` SUPPORTED_ISSUERS - A list of supported issuers in the format `issuerDID=issuerNodeURL`. You can also use `*` to set a default node. - IPFS_URL - The URL of the IPFS node. - SERVER_PORT - The server port. The default is 8002. + IPFS_URL_GATEWAY - The URL of the IPFS gateway. + SERVER_HOST - The server host. Format: address:port. The default is localhost:8002. HTTP_CONFIG_PATH - The path to the HTTP configuration. SUPPORTED_RPC - Supported RPC in the format `chainID=URL`. SUPPORTED_STATE_CONTRACTS - Supported state contracts in the format `chainID=contractAddress`. @@ -71,5 +71,5 @@ Example: ``` 2. Run the docker container: ```bash - docker run --env-file .env -v ./config.yaml:/app/config.yaml . + docker run --env-file .env -v ./config.yaml:/app/config.yaml -p 8002:8002 refresh-service:local ``` diff --git a/go.mod b/go.mod index b86d5c3..f11895e 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,10 @@ require ( github.com/google/uuid v1.3.0 github.com/iden3/contracts-abi/state/go/abi v1.0.1 github.com/iden3/go-circuits/v2 v2.0.0 - github.com/iden3/go-iden3-core/v2 v2.0.3 + github.com/iden3/go-iden3-core/v2 v2.1.1 github.com/iden3/go-jwz/v2 v2.0.0 github.com/iden3/go-schema-processor/v2 v2.2.0 github.com/iden3/iden3comm/v2 v2.0.1-0.20231030214854-7a0511d0e7cc - github.com/ipfs/go-ipfs-api v0.6.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/pkg/errors v0.9.1 @@ -25,12 +24,10 @@ require ( require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/benbjohnson/clock v1.3.5 // indirect github.com/bits-and-blooms/bitset v1.5.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.10.0 // indirect - github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/blake512 v1.0.0 // indirect @@ -42,6 +39,7 @@ require ( github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/holiman/uint256 v1.2.3 // indirect github.com/iden3/go-iden3-crypto v0.0.15 // indirect @@ -51,42 +49,30 @@ require ( github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 // indirect github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e // indirect - github.com/ipfs/boxo v0.8.0 // indirect - github.com/ipfs/go-cid v0.4.1 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/compress v1.16.5 // indirect github.com/lestrrat-go/blackmagic v1.0.1 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.4 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect github.com/lestrrat-go/jwx/v2 v2.0.12 // indirect github.com/lestrrat-go/option v1.0.1 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.28.1 // indirect - github.com/minio/sha256-simd v1.0.1 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect - github.com/multiformats/go-base32 v0.1.0 // indirect - github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.9.0 // indirect - github.com/multiformats/go-multibase v0.2.0 // indirect - github.com/multiformats/go-multicodec v0.9.0 // indirect - github.com/multiformats/go-multihash v0.2.2 // indirect - github.com/multiformats/go-multistream v0.4.1 // indirect - github.com/multiformats/go-varint v0.0.7 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect + github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/supranational/blst v0.3.11 // indirect github.com/tetratelabs/wazero v1.1.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect go.uber.org/atomic v1.11.0 // indirect + go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.12.0 // indirect golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect @@ -94,8 +80,7 @@ require ( golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/tools v0.9.1 // indirect - google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect - lukechampine.com/blake3 v1.2.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index b3b3da0..925c97c 100644 --- a/go.sum +++ b/go.sum @@ -5,7 +5,6 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8= github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= @@ -13,9 +12,7 @@ github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPx github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= @@ -26,8 +23,6 @@ github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= -github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -63,8 +58,10 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -83,10 +80,8 @@ github.com/iden3/contracts-abi/state/go/abi v1.0.1 h1:FsaLJSy3NSyJl5k1yfDxc5DhUH github.com/iden3/contracts-abi/state/go/abi v1.0.1/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= github.com/iden3/go-circuits/v2 v2.0.0 h1:Bw0mpsqeip06d6I2ktgfhTVB7Jk9mSHi8myHZWkoc6w= github.com/iden3/go-circuits/v2 v2.0.0/go.mod h1:VIFIp51+IH0hOzjnKhb84bCeyq7hq76zX/C14ua6zh4= -github.com/iden3/go-iden3-core/v2 v2.0.0 h1:sQEuuq3RLfyYSY8qPiqxQ6YBpGbiAwepHJD/vjf1adA= -github.com/iden3/go-iden3-core/v2 v2.0.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= -github.com/iden3/go-iden3-core/v2 v2.0.3 h1:ce9Jbw10zDsinWXFc05SiK2Hof/wu4zV4/ai5gQy29k= -github.com/iden3/go-iden3-core/v2 v2.0.3/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= +github.com/iden3/go-iden3-core/v2 v2.1.1 h1:WD14iWKZmnfHTl9Em/PfGssrFYXz8YNQPjPs/cn+eHc= +github.com/iden3/go-iden3-core/v2 v2.1.1/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4= github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-jwz/v2 v2.0.0 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= @@ -103,25 +98,19 @@ github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 h1:mkY6VDfwKVJc83QGKmwVXY2LYepi github.com/iden3/go-rapidsnark/witness/v2 v2.0.0/go.mod h1:3JRjqUfW1hgI9hzLDO0v8z/DUkR0ZUehhYLlnIfRxnA= github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e h1:WeiFCrpj5pLRtSA4Mg03yTrSZhHHqN/k5b6bwxd9/tY= github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e/go.mod h1:UEBifEzw62T6VzIHJeHuUgeLg2U/J9ttf7hOwQEqnYk= -github.com/iden3/go-schema-processor/v2 v2.1.0 h1:8/fA7IVkyVmpbJij9Ar0X2zWPQJMlCaaPP4hfTZqbqU= -github.com/iden3/go-schema-processor/v2 v2.1.0/go.mod h1:EogHwnFnxQKOGRVme6upCcisoAQeEIl+HuRAGa7w3+w= github.com/iden3/go-schema-processor/v2 v2.2.0 h1:sYPqLs72pEWXIfF0/MOv9AFm3+IGutRM3yClWRrjheg= github.com/iden3/go-schema-processor/v2 v2.2.0/go.mod h1:Ovsrk0839NZgHtoW4hVLAmHoOsHAQZuVNUXd7sIOkLQ= github.com/iden3/iden3comm/v2 v2.0.1-0.20231030214854-7a0511d0e7cc h1:VciWdH3N9hufuIn6w/SOys8+Bzjy8LD0l1f5aN2sghE= github.com/iden3/iden3comm/v2 v2.0.1-0.20231030214854-7a0511d0e7cc/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= -github.com/ipfs/boxo v0.8.0 h1:UdjAJmHzQHo/j3g3b1bAcAXCj/GM6iTwvSlBDvPBNBs= -github.com/ipfs/boxo v0.8.0/go.mod h1:RIsi4CnTyQ7AUsNn5gXljJYZlQrHBMnJp94p73liFiA= -github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= -github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= -github.com/ipfs/go-ipfs-api v0.6.0 h1:JARgG0VTbjyVhO5ZfesnbXv9wTcMvoKRBLF1SzJqzmg= -github.com/ipfs/go-ipfs-api v0.6.0/go.mod h1:iDC2VMwN9LUpQV/GzEeZ2zNqd8NUdRmWcFM+K/6odf0= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= @@ -138,20 +127,12 @@ github.com/lestrrat-go/jwx/v2 v2.0.12/go.mod h1:Mq4KN1mM7bp+5z/W5HS8aCNs5RKZ911G github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= -github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.28.1 h1:YurK+ZAI6cKfASLJBVFkpVBdl3wGhFi6fusOt725ii8= -github.com/libp2p/go-libp2p v0.28.1/go.mod h1:s3Xabc9LSwOcnv9UD4nORnXKTsWkPMkIMB/JIGXVnzk= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= -github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= @@ -159,22 +140,6 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= -github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= -github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= -github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.9.0 h1:3h4V1LHIk5w4hJHekMKWALPXErDfz/sggzwC/NcqbDQ= -github.com/multiformats/go-multiaddr v0.9.0/go.mod h1:mI67Lb1EeTOYb8GQfL/7wpIZwc46ElrvzhYnoJOmTT0= -github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= -github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= -github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= -github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= -github.com/multiformats/go-multihash v0.2.2 h1:Uu7LWs/PmWby1gkj1S1DXx3zyd3aVabA4FiMKn/2tAc= -github.com/multiformats/go-multihash v0.2.2/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= -github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= -github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f h1:HlPa7RcxTCrva5izPfTEfvYecO7LTahgmMRD1Qp13xg= github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f/go.mod h1:WZ501QQMbZZ+3pXFPhQKzNwS1+jls0oqov3uQ2WasLs= @@ -185,7 +150,9 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 h1:J9b7z+QKAmPf4YLrFg6oQUotqHQeUNWwkvo7jZp1GLU= github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= @@ -198,13 +165,12 @@ github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= @@ -220,46 +186,58 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b h1:wA3QeTsaAXybLL2kb2cKhCAQTHgYTMwuI8lBlJSv5V8= -github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b/go.mod h1:xT1Y5p2JR2PfSZihE0s4mjdJaRGp1waCTf5JzhQLBck= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -277,18 +255,23 @@ golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U= gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= @@ -296,7 +279,5 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= -lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/main.go b/main.go index f68a405..7c1dade 100644 --- a/main.go +++ b/main.go @@ -7,12 +7,13 @@ import ( _ "github.com/0xPolygonID/refresh-service/logger" "github.com/0xPolygonID/refresh-service/packagemanager" + "github.com/0xPolygonID/refresh-service/pkg/ipfs" "github.com/0xPolygonID/refresh-service/providers/flexiblehttp" "github.com/0xPolygonID/refresh-service/server" "github.com/0xPolygonID/refresh-service/service" "github.com/iden3/go-schema-processor/v2/loaders" - shell "github.com/ipfs/go-ipfs-api" "github.com/kelseyhightower/envconfig" + "github.com/piprate/json-gold/ld" "github.com/pkg/errors" ) @@ -46,13 +47,13 @@ func (c *KVstring) Decode(value string) error { type Config struct { SupportedIssuers KVstring `envconfig:"SUPPORTED_ISSUERS" required:"true"` - IPFSURL string `envconfig:"IPFS_URL" required:"true"` + IPFSURLGateway string `envconfig:"IPFS_URL_GATEWAY" default:"https://ipfs.io"` ServerHost string `envconfig:"SERVER_HOST" default:"localhost:8002"` HTTPConfigPath string `envconfig:"HTTP_CONFIG_PATH" default:"config.yaml"` SupportedRPC KVstring `envconfig:"SUPPORTED_RPC" required:"true"` SupportedStateContracts KVstring `envconfig:"SUPPORTED_STATE_CONTRACTS" required:"true"` - CircuitsFolderPath string `envconfig:"CIRCUITS_FOLDER_PATH" default:"circuits"` - SupportedIssuersBasicAuth KVstring `envconfig:"ISSUERS_BASIC_AUTH"` + CircuitsFolderPath string `envconfig:"CIRCUITS_FOLDER_PATH" default:"keys"` + SupportedIssuersBasicAuth KVstring `envconfig:"ISSUERS_BASIC_AUTH" required:"true"` } func (c *Config) getServerHost() string { @@ -88,14 +89,11 @@ func main() { nil, ) - opts := loaders.WithEmbeddedDocumentBytes(w3cSchemaURL, w3cSchemaBody) - memoryCacheEngine, err := loaders.NewMemoryCacheEngine(opts) + ipfsCli := ipfs.NewIPFSClient(cfg.IPFSURLGateway) + documentLoader, err := initDocumentLoaderWithCache(ipfsCli) if err != nil { - log.Fatalf("failed init memory cache engine: %v", err) + log.Fatalf("failed init ipfs loader: %v", err) } - ipfsCli := shell.NewShell(cfg.IPFSURL) - documentLoader := loaders.NewDocumentLoader(ipfsCli, "", - loaders.WithCacheEngine(memoryCacheEngine)) flexhttp, err := flexiblehttp.NewFactoryFlexibleHTTP( cfg.HTTPConfigPath, @@ -122,3 +120,15 @@ func main() { log.Fatal(h.Run(cfg.getServerHost())) } + +func initDocumentLoaderWithCache(ipfsCli loaders.IPFSClient) (ld.DocumentLoader, error) { + opts := loaders.WithEmbeddedDocumentBytes( + w3cSchemaURL, w3cSchemaBody, + ) + memoryCacheEngine, err := loaders.NewMemoryCacheEngine(opts) + if err != nil { + return nil, err + } + l := loaders.NewDocumentLoader(ipfsCli, "", loaders.WithCacheEngine(memoryCacheEngine)) + return l, nil +} diff --git a/pkg/ipfs/ipfs.go b/pkg/ipfs/ipfs.go new file mode 100644 index 0000000..35bc89b --- /dev/null +++ b/pkg/ipfs/ipfs.go @@ -0,0 +1,51 @@ +package ipfs + +import ( + "fmt" + "io" + "net/http" + "net/url" + "strings" +) + +type ipfsCli struct { + rpcURL string + httpCli *http.Client +} + +type IPFSCliOption func(*ipfsCli) + +func WithHTTPClient(httpCli *http.Client) IPFSCliOption { + return func(opts *ipfsCli) { + opts.httpCli = httpCli + } +} + +func NewIPFSClient(rpcURL string, opts ...IPFSCliOption) *ipfsCli { + c := &ipfsCli{ + rpcURL: rpcURL, + httpCli: http.DefaultClient, + } + + for _, opt := range opts { + opt(c) + } + + return c +} + +func (c *ipfsCli) Cat(path string) (io.ReadCloser, error) { + rpcURL := fmt.Sprintf("%s/ipfs/%s", + strings.TrimSuffix(c.rpcURL, "/"), url.QueryEscape(path), + ) + resp, err := c.httpCli.Get(rpcURL) + if err != nil { + return nil, fmt.Errorf("failed to send IPFS get request: %w", err) + } + if resp.StatusCode != http.StatusOK { + _ = resp.Body.Close() + return nil, fmt.Errorf("unexpected status code from IPFS getway: %d", + resp.StatusCode) + } + return resp.Body, nil +} From 4c396c26cbad4cf0e4916de4f744478523b59d5c Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 25 Apr 2024 17:24:49 +0300 Subject: [PATCH 5/6] trim " for host string --- server/handler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/handler.go b/server/handler.go index d4189de..cc1b91d 100644 --- a/server/handler.go +++ b/server/handler.go @@ -3,6 +3,7 @@ package server import ( "io" "net/http" + "strings" "time" "github.com/0xPolygonID/refresh-service/logger" @@ -64,6 +65,7 @@ func (h *Handlers) Run(host string) error { } }) + host = strings.Trim(host, "\"") logger.DefaultLogger.Infof("Server starting on host '%s'", host) httpServer := &http.Server{ Addr: host, From e8c2d939d1a267223d81992489a6325a48d2cae1 Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 25 Apr 2024 18:22:24 +0300 Subject: [PATCH 6/6] use docker-compose instead of docker --- README.md | 8 ++------ docker-compose.yaml | 12 ++++++++++++ server/handler.go | 2 -- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 docker-compose.yaml diff --git a/README.md b/README.md index ca0e53b..c80ac5c 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,7 @@ Example: ``` ## How to run: -1. Build the docker container: +1. Run docker-compose file: ```bash - docker build -t refresh-service:local . - ``` -2. Run the docker container: - ```bash - docker run --env-file .env -v ./config.yaml:/app/config.yaml -p 8002:8002 refresh-service:local + docker-compose up -d ``` diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..0d6bfcb --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: '3' +services: + refresh-service: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./config.yaml:/app/config.yaml:ro + ports: + - 8002:8002 + env_file: + - .env \ No newline at end of file diff --git a/server/handler.go b/server/handler.go index cc1b91d..d4189de 100644 --- a/server/handler.go +++ b/server/handler.go @@ -3,7 +3,6 @@ package server import ( "io" "net/http" - "strings" "time" "github.com/0xPolygonID/refresh-service/logger" @@ -65,7 +64,6 @@ func (h *Handlers) Run(host string) error { } }) - host = strings.Trim(host, "\"") logger.DefaultLogger.Infof("Server starting on host '%s'", host) httpServer := &http.Server{ Addr: host,