diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index fb98820..6d1c064 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -13,7 +13,7 @@ jobs: - name: Install Go uses: actions/setup-go@v1 with: - go-version: 1.18.2 + go-version: 1.19 - name: Checkout code uses: actions/checkout@v2 - name: golangci-lint diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index cd68659..7a8202e 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -12,7 +12,7 @@ jobs: test: strategy: matrix: - containers: [ 1.18.3-bullseye ] + containers: [ 1.19-bullseye ] runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/Dockerfile b/Dockerfile index 130d0d0..cdf6be7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ## ## Build did driver ## -FROM golang:1.18-alpine AS base +FROM golang:1.19-alpine AS base WORKDIR /build diff --git a/cmd/driver/main.go b/cmd/driver/main.go index 3a7c7eb..8e1de80 100644 --- a/cmd/driver/main.go +++ b/cmd/driver/main.go @@ -7,6 +7,7 @@ import ( "os" "time" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "github.com/iden3/driver-did-iden3/pkg/app" "github.com/iden3/driver-did-iden3/pkg/app/configs" @@ -15,6 +16,8 @@ import ( "github.com/iden3/driver-did-iden3/pkg/services/blockchain/eth" "github.com/iden3/driver-did-iden3/pkg/services/ens" "github.com/iden3/driver-did-iden3/pkg/services/provers" + core "github.com/iden3/go-iden3-core/v2" + revocationReolver "github.com/iden3/merkletree-proof/resolvers" ) func main() { @@ -42,8 +45,9 @@ func main() { } } + resolvers, revocationResolvers := initResolvers() mux := app.Handlers{DidDocumentHandler: &app.DidDocumentHandler{ - DidDocumentService: services.NewDidDocumentServices(initResolvers(), r, services.WithProvers(proverRegistry))}, + DidDocumentService: services.NewDidDocumentServices(resolvers, r, revocationResolvers, services.WithProvers(proverRegistry))}, } server := http.Server{ @@ -58,7 +62,7 @@ func main() { } } -func initResolvers() *services.ResolverRegistry { +func initResolvers() (*services.ResolverRegistry, *revocationReolver.OnChainResolver) { var path string if len(os.Args) > 2 { path = os.Args[1] @@ -68,6 +72,12 @@ func initResolvers() *services.ResolverRegistry { log.Fatal("can't read resolver settings:", err) } resolvers := services.NewChainResolvers() + var ( + ethClients map[core.ChainID]*ethclient.Client + stateContractAddresses map[core.ChainID]common.Address + ) + ethClients = make(map[core.ChainID]*ethclient.Client) + stateContractAddresses = make(map[core.ChainID]common.Address) for chainName, chainSettings := range rs { for networkName, networkSettings := range chainSettings { prefix := fmt.Sprintf("%s:%s", chainName, networkName) @@ -76,10 +86,20 @@ func initResolvers() *services.ResolverRegistry { log.Fatalf("failed configure resolver for network '%s': %v", prefix, err) } resolvers.Add(prefix, resolver) + + ethClient, err := ethclient.Dial(networkSettings.NetworkURL) + if err != nil { + log.Fatalf("failed configure resolver for network '%s': %v", prefix, err) + } + chainID, err := core.GetChainID(core.Blockchain(chainName), core.NetworkID(networkName)) + if err != nil { + log.Fatalf("failed configure resolver for network '%s': %v", prefix, err) + } + ethClients[chainID] = ethClient + stateContractAddresses[chainID] = common.HexToAddress(networkSettings.ContractAddress) } } - - return resolvers + return resolvers, revocationReolver.NewOnChainResolver(ethClients, stateContractAddresses) } func initDIDResolutionProverRegistry(cfg configs.Config) (*services.DIDResolutionProverRegistry, error) { @@ -98,7 +118,7 @@ func initDIDResolutionProverRegistry(cfg configs.Config) (*services.DIDResolutio func addCORSHeaders(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") + w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS, POST") if r.Method == http.MethodOptions { w.WriteHeader(http.StatusOK) diff --git a/go.mod b/go.mod index ecd598b..0cc86cc 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/iden3/driver-did-iden3 -go 1.18 +go 1.19 require ( - github.com/ethereum/go-ethereum v1.11.5 + github.com/ethereum/go-ethereum v1.12.2 github.com/golang/mock v1.6.0 github.com/iden3/contracts-abi/state/go/abi v1.0.1 github.com/iden3/go-iden3-core/v2 v2.3.1 - github.com/iden3/go-schema-processor/v2 v2.4.2 + github.com/iden3/merkletree-proof v0.3.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.9.0 @@ -18,14 +18,15 @@ require ( ) require ( - github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect - github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.2.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/holiman/uint256 v1.2.0 // indirect + github.com/holiman/uint256 v1.2.3 // indirect + github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 // indirect + github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118132742-9f041ef05b49 // indirect github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f // indirect github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect + golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect ) require ( @@ -33,7 +34,7 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cespare/cp v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -57,8 +58,6 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect - github.com/tyler-smith/go-bip32 v1.0.0 - github.com/tyler-smith/go-bip39 v1.1.0 github.com/wealdtech/go-multicodec v1.4.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/sys v0.15.0 // indirect diff --git a/go.sum b/go.sum index 6bc5d7b..ad6249e 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,8 @@ github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= -github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25YnZWly5Gq1ekg6jcmWaGj/vG/MhF4aisoc= -github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw= -github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= -github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec/go.mod h1:CD8UlnlLDiqb36L110uqiP2iSflVjx9g/3U9hCI4q2U= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= @@ -24,12 +21,14 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:P13beTBKr5Q18lJe1rIoLUqjM+CB1zYrRg44ZqGuQSA= github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -38,13 +37,13 @@ github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI= github.com/deckarep/golang-set/v2 v2.2.0 h1:2pMQd3Soi6qfw7E5MMKaEh5W5ES18bW3AbFFnGl6LgQ= github.com/deckarep/golang-set/v2 v2.2.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/ethereum/go-ethereum v1.11.5 h1:3M1uan+LAUvdn+7wCEFrcMM4LJTeuxDrPTg/f31a5QQ= -github.com/ethereum/go-ethereum v1.11.5/go.mod h1:it7x0DWnTDMfVFdXcU6Ti4KEFQynLHVRarcSlPr0HBo= +github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= +github.com/ethereum/go-ethereum v1.12.2 h1:eGHJ4ij7oyVqUQn48LBz3B7pvQ8sV0wGJiIE6gDq/6Y= +github.com/ethereum/go-ethereum v1.12.2/go.mod h1:1cRAEV+rp/xX0zraSCBnu9Py3HQ+geRMj3HdR+k0wfI= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -62,42 +61,64 @@ github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoB github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= -github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= +github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= +github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 h1:Fu1/tAINi9FzZ0nKoEVOGXWzL1l15tR1loJx5sQEQ8k= +github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0/go.mod h1:8fkd2xyUG/V7ovpvZRyD2LyK2zZ4ALbgf5vJGyhzKdg= github.com/iden3/contracts-abi/state/go/abi v1.0.1 h1:FsaLJSy3NSyJl5k1yfDxc5DhUHRY7Z/UCj0/1YueMrY= github.com/iden3/contracts-abi/state/go/abi v1.0.1/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= -github.com/iden3/go-iden3-core/v2 v2.2.0 h1:PcMSxJRLAoJausj1gKstzgt25HS18K+IHLaSPeI9p8Q= -github.com/iden3/go-iden3-core/v2 v2.2.0/go.mod h1:L9PxhWPvoS9qTb3inEkZBm1RpjHBt+VTwvxssdzbAdw= github.com/iden3/go-iden3-core/v2 v2.3.1 h1:ytQqiclnVAIWyRKR2LF31hfz4DGRBD6nMjiPILXGSKk= github.com/iden3/go-iden3-core/v2 v2.3.1/go.mod h1:8vmG6y8k9VS7iNoxuiKukKbRQFsMyabCc+i8er07zOs= -github.com/iden3/go-iden3-crypto v0.0.16 h1:zN867xiz6HgErXVIV/6WyteGcOukE9gybYTorBMEdsk= -github.com/iden3/go-iden3-crypto v0.0.16/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-iden3-crypto v0.0.17 h1:NdkceRLJo/pI4UpcjVah4lN/a3yzxRUGXqxbWcYh9mY= github.com/iden3/go-iden3-crypto v0.0.17/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= github.com/iden3/go-merkletree-sql/v2 v2.0.4 h1:Dp089P3YNX1BE8+T1tKQHWTtnk84Y/Kr7ZAGTqwscoY= github.com/iden3/go-merkletree-sql/v2 v2.0.4/go.mod h1:kRhHKYpui5DUsry5RpveP6IC4XMe6iApdV9VChRYuEk= -github.com/iden3/go-schema-processor/v2 v2.4.2 h1:t9pMxSpyMDAU3xSpn2dTvnTUUAtPlwOcNavbgXEFiJk= -github.com/iden3/go-schema-processor/v2 v2.4.2/go.mod h1:eBtILnPjh4wnsAg3LWnvcZlGG+5IkAJaRqhVBnDjerg= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241113162104-5dbe5dad6b88 h1:N3rYFMBeRZODJfL4lrhfXTBuu2P+umTD1Zw5bEMDh3c= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241113162104-5dbe5dad6b88/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115111117-74adfd680389 h1:pZWnB0J9h3mCKclqMtNG4MS1Ce+1++ezqAIzPZS/4Kw= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115111117-74adfd680389/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115135152-f7aba5c8ea0f h1:ocJvFD7WANhjLjnUiu7ct7eWKCev+JAcfYVi5BqLBRs= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115135152-f7aba5c8ea0f/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115140032-3c6d00e10e39 h1:nyV5fyKBWudE/QVTOOo9W0Iy85btAw4/KQpDoRGVLYE= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115140032-3c6d00e10e39/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115142927-28e0b310c9f1 h1:horz6KSKZ8K2AY4DABIhxdj54Fnj8nbk14u8mHRxUoM= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115142927-28e0b310c9f1/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115144905-4b99f46f2c93 h1:4ajyeSLl1Xb6v582dYqaF+isi5Nv/+rMjPncffBhJ1Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115144905-4b99f46f2c93/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115154532-958b682f9a82 h1:A06SGanhVTsVfaPk9mTb/hEugzfBsMBnIBFnAf9Xb5U= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241115154532-958b682f9a82/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118104325-cad1ed670f2f h1:v/MvoN0TKeu/+tM8xbB9Lnyz63yVX/AFVZFosa4amYQ= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118104325-cad1ed670f2f/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118112226-85f13b328a6d h1:8eeAhV54Ra2I40W3fFPd46OYtEWkhMAdV5dfJaQ2J8w= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118112226-85f13b328a6d/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118112443-0657c0326876 h1:1TglvlfYclTk8tHUc6b6/lgIJjzSGo6wayhmjH5YJP0= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118112443-0657c0326876/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118132742-9f041ef05b49 h1:uAZmYb22761RwpD4Yeqb2dMJq4y3kJoPi42hVe45R7w= +github.com/iden3/go-schema-processor/v2 v2.5.1-0.20241118132742-9f041ef05b49/go.mod h1:hMqYi4lKOzEGkmCRks/r4Crj8H4G8YaTt8H4jZHzX9Y= +github.com/iden3/merkletree-proof v0.3.0 h1:NVlvtUBEgn4Etxxn+RsOmXP/qlI+85BdN8oUDTf3mxI= +github.com/iden3/merkletree-proof v0.3.0/go.mod h1:+E2sBxMqhcn/fcu0LDGjmk3us+Vr+fxQUiZMxdpbgUE= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= @@ -107,7 +128,7 @@ 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= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= @@ -116,6 +137,7 @@ github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= 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= @@ -142,7 +164,7 @@ 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_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= @@ -156,22 +178,17 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b 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/testify v1.1.5-0.20170601210322-f6abca593680/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= -github.com/tyler-smith/go-bip32 v1.0.0 h1:sDR9juArbUgX+bO/iblgZnMPeWY1KZMUC2AFUJdv5KE= -github.com/tyler-smith/go-bip32 v1.0.0/go.mod h1:onot+eHknzV4BVPwrzqY5OoVpyCvnwD7lMawL5aQupE= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= +github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU= github.com/wealdtech/go-ens/v3 v3.5.5 h1:/jq3CDItK0AsFnZtiFJK44JthkAMD5YE3WAJOh4i7lc= github.com/wealdtech/go-ens/v3 v3.5.5/go.mod h1:w0EDKIm0dIQnqEKls6ORat/or+AVfPEdEXVfN71EeEE= github.com/wealdtech/go-multicodec v1.4.0 h1:iq5PgxwssxnXGGPTIK1srvt6U5bJwIp7k6kBrudIWxg= @@ -181,16 +198,15 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRT github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -golang.org/x/crypto v0.0.0-20170613210332-850760c427c5/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 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-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 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-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= +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/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -202,7 +218,7 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= @@ -220,23 +236,24 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= +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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 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-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= diff --git a/pkg/app/handler.go b/pkg/app/handler.go index 1807b1b..06921c9 100644 --- a/pkg/app/handler.go +++ b/pkg/app/handler.go @@ -11,6 +11,7 @@ import ( "github.com/iden3/driver-did-iden3/pkg/services" core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-merkletree-sql/v2" + "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/pkg/errors" ) @@ -112,6 +113,38 @@ func (d *DidDocumentHandler) GetGist(w http.ResponseWriter, r *http.Request) { } } +func (d *DidDocumentHandler) ResolveCredentialStatus(w http.ResponseWriter, r *http.Request) { + var credentialStatus verifiable.CredentialStatus + decoder := json.NewDecoder(r.Body) + err := decoder.Decode(&credentialStatus) + if err != nil { + log.Printf("failed decode credential status body: %v\n", err) + w.WriteHeader(http.StatusInternalServerError) + return + } + defer func() { + err := r.Body.Close() + if err != nil { + log.Printf("cannot close http body %v\n", err) + } + }() + + rawURL := strings.Split(r.URL.Path, "/") + issuerDID := rawURL[len(rawURL)-1] + status, err := d.DidDocumentService.ResolveCredentialStatus(r.Context(), issuerDID, credentialStatus) + if err != nil { + log.Printf("failed get credential status: %v\n", err) + w.WriteHeader(http.StatusInternalServerError) + return + } + + w.Header().Set("Content-type", "application/json") + w.WriteHeader(http.StatusOK) + if err := json.NewEncoder(w).Encode(status); err != nil { + log.Println("failed write response") + } +} + func getResolverOpts(state, gistRoot, signature string) (ro services.ResolverOpts, err error) { if state != "" && gistRoot != "" { return ro, errors.New("'state' and 'gist root' cannot be used together") diff --git a/pkg/app/router.go b/pkg/app/router.go index 9ecd366..6698a16 100644 --- a/pkg/app/router.go +++ b/pkg/app/router.go @@ -14,6 +14,7 @@ func (s *Handlers) Routes() *http.ServeMux { mux.HandleFunc("/1.0/identifiers/", s.DidDocumentHandler.Get) mux.HandleFunc("/1.0/gist", s.DidDocumentHandler.GetGist) + mux.HandleFunc("/1.0/credential-status/", s.DidDocumentHandler.ResolveCredentialStatus) mux.HandleFunc("/dns/", s.DidDocumentHandler.GetByDNSDomain) mux.HandleFunc("/ens/", s.DidDocumentHandler.GetByENSDomain) mux.HandleFunc("/status", func(w http.ResponseWriter, _ *http.Request) { diff --git a/pkg/document/did.go b/pkg/document/did.go index c4154c7..8d79d12 100644 --- a/pkg/document/did.go +++ b/pkg/document/did.go @@ -23,6 +23,7 @@ const ( defaultContext = "https://w3id.org/did-resolution/v1" defaultDidDocContext = "https://www.w3.org/ns/did/v1" iden3Context = "https://schema.iden3.io/core/jsonld/auth.jsonld" + Iden3proofsContext = "https://schema.iden3.io/core/jsonld/iden3proofs.jsonld" EcdsaSecp256k1RecoveryContext = "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld" defaultContentType = "application/did+ld+json" iden3ResolutionContext = "https://schema.iden3.io/core/jsonld/resolution.jsonld" diff --git a/pkg/services/blockchain/eth/contract/mock/contract.go b/pkg/services/blockchain/eth/contract/mock/contract.go index 9a03643..4a4e583 100644 --- a/pkg/services/blockchain/eth/contract/mock/contract.go +++ b/pkg/services/blockchain/eth/contract/mock/contract.go @@ -45,6 +45,21 @@ func (m *MockStateContract) GetGISTProofByRoot(arg0 *bind.CallOpts, arg1, arg2 * return ret0, ret1 } +// GetGISTProof mocks base method. +func (m *MockStateContract) GetGISTProof(arg0 *bind.CallOpts, arg1 *big.Int) (contract.IStateGistProof, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGISTProof", arg0, arg1) + ret0, _ := ret[0].(contract.IStateGistProof) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGISTProof indicates an expected call of GetGISTProof. +func (mr *MockStateContractMockRecorder) GetGISTProof(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGISTProof", reflect.TypeOf((*MockStateContract)(nil).GetGISTProof), arg0, arg1) +} + // GetGISTProofByRoot indicates an expected call of GetGISTProofByRoot. func (mr *MockStateContractMockRecorder) GetGISTProofByRoot(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() diff --git a/pkg/services/blockchain/eth/resolver.go b/pkg/services/blockchain/eth/resolver.go index f530d51..8f300f7 100644 --- a/pkg/services/blockchain/eth/resolver.go +++ b/pkg/services/blockchain/eth/resolver.go @@ -19,6 +19,7 @@ import ( type StateContract interface { GetGISTRoot(opts *bind.CallOpts) (*big.Int, error) GetGISTRootInfo(opts *bind.CallOpts, root *big.Int) (contract.IStateGistRootInfo, error) + GetGISTProof(opts *bind.CallOpts, id *big.Int) (contract.IStateGistProof, error) GetGISTProofByRoot(opts *bind.CallOpts, id *big.Int, root *big.Int) (contract.IStateGistProof, error) GetStateInfoById(opts *bind.CallOpts, id *big.Int) (contract.IStateStateInfo, error) @@ -110,6 +111,7 @@ func (r *Resolver) Resolve( var ( stateInfo *contract.IStateStateInfo gistInfo *contract.IStateGistRootInfo + gistProof *contract.IStateGistProof err error ) @@ -121,11 +123,11 @@ func (r *Resolver) Resolve( switch { case opts.GistRoot != nil: - stateInfo, gistInfo, err = r.resolveStateByGistRoot(ctx, userID, opts.GistRoot) + stateInfo, gistInfo, gistProof, err = r.resolveStateByGistRoot(ctx, userID, opts.GistRoot) case opts.State != nil: stateInfo, err = r.resolveState(ctx, userID, opts.State) default: - stateInfo, gistInfo, err = r.resolveLatest(ctx, userID) + stateInfo, gistInfo, gistProof, err = r.resolveLatest(ctx, userID) } if err != nil && !errors.Is(err, services.ErrNotFound) { @@ -152,6 +154,7 @@ func (r *Resolver) Resolve( ReplacedAtTimestamp: gistInfo.ReplacedAtTimestamp, CreatedAtBlock: gistInfo.CreatedAtBlock, ReplacedAtBlock: gistInfo.ReplacedAtBlock, + Proof: gistProof, } } @@ -161,22 +164,26 @@ func (r *Resolver) Resolve( func (r *Resolver) resolveLatest( ctx context.Context, id core.ID, -) (*contract.IStateStateInfo, *contract.IStateGistRootInfo, error) { +) (*contract.IStateStateInfo, *contract.IStateGistRootInfo, *contract.IStateGistProof, error) { latestRootGist, err := r.state.GetGISTRoot(&bind.CallOpts{Context: ctx}) if err != nil { - return nil, nil, err + return nil, nil, nil, err + } + gistProof, err := r.state.GetGISTProof(&bind.CallOpts{Context: ctx}, id.BigInt()) + if err != nil { + return nil, nil, nil, err } gistInfo, err := r.state.GetGISTRootInfo(&bind.CallOpts{Context: ctx}, latestRootGist) if err != nil { - return nil, nil, err + return nil, nil, nil, err } stateInfo, err := r.state.GetStateInfoById(&bind.CallOpts{Context: ctx}, id.BigInt()) if err = notFoundErr(err); err != nil { - return nil, &gistInfo, err + return nil, &gistInfo, &gistProof, err } - return &stateInfo, &gistInfo, verifyContractState(id, stateInfo) + return &stateInfo, &gistInfo, &gistProof, verifyContractState(id, stateInfo) } func (r *Resolver) resolveState( @@ -196,30 +203,30 @@ func (r *Resolver) resolveStateByGistRoot( ctx context.Context, id core.ID, gistRoot *big.Int, -) (*contract.IStateStateInfo, *contract.IStateGistRootInfo, error) { +) (*contract.IStateStateInfo, *contract.IStateGistRootInfo, *contract.IStateGistProof, error) { proof, err := r.state.GetGISTProofByRoot( &bind.CallOpts{Context: ctx}, id.BigInt(), gistRoot, ) if err := notFoundErr(err); err != nil { - return nil, nil, err + return nil, nil, nil, err } gistInfo, err := r.state.GetGISTRootInfo(&bind.CallOpts{Context: ctx}, proof.Root) if err = notFoundErr(err); err != nil { - return nil, nil, err + return nil, nil, nil, err } if !proof.Existence { - return nil, &gistInfo, nil + return nil, &gistInfo, &proof, nil } stateInfo, err := r.state.GetStateInfoByIdAndState(&bind.CallOpts{Context: ctx}, id.BigInt(), proof.Value) if err = notFoundErr(err); err != nil { - return nil, &gistInfo, err + return nil, nil, nil, err } - return &stateInfo, &gistInfo, verifyContractState(id, stateInfo) + return &stateInfo, &gistInfo, &proof, verifyContractState(id, stateInfo) } func verifyContractState(id core.ID, state contract.IStateStateInfo) error { diff --git a/pkg/services/blockchain/eth/resolver_test.go b/pkg/services/blockchain/eth/resolver_test.go index d497031..5be5dc2 100644 --- a/pkg/services/blockchain/eth/resolver_test.go +++ b/pkg/services/blockchain/eth/resolver_test.go @@ -70,6 +70,11 @@ func TestResolveGist_Success(t *testing.T) { } func TestResolve_Success(t *testing.T) { + proof := contract.IStateGistProof{ + Root: big.NewInt(4), + Existence: true, + Value: big.NewInt(5), + } tests := []struct { name string opts *services.ResolverOpts @@ -84,11 +89,6 @@ func TestResolve_Success(t *testing.T) { }, userDID: userDID, contractMock: func(c *cm.MockStateContract) { - proof := contract.IStateGistProof{ - Root: big.NewInt(4), - Existence: true, - Value: big.NewInt(5), - } userID, _ := core.IDFromDID(*userDID) c.EXPECT().GetGISTProofByRoot(gomock.Any(), userID.BigInt(), big.NewInt(1)).Return(proof, nil) gistInfo := contract.IStateGistRootInfo{Root: big.NewInt(555)} @@ -102,7 +102,8 @@ func TestResolve_Success(t *testing.T) { State: big.NewInt(444), }, GistInfo: &services.GistInfo{ - Root: big.NewInt(555), + Root: big.NewInt(555), + Proof: &proof, }, }, }, @@ -133,6 +134,7 @@ func TestResolve_Success(t *testing.T) { userID, _ := core.IDFromDID(*userDID) latestGist := big.NewInt(100) c.EXPECT().GetGISTRoot(gomock.Any()).Return(latestGist, nil) + c.EXPECT().GetGISTProof(gomock.Any(), userID.BigInt()).Return(proof, nil) latestGistInfo := contract.IStateGistRootInfo{Root: big.NewInt(400)} c.EXPECT().GetGISTRootInfo(gomock.Any(), latestGist).Return(latestGistInfo, nil) stateInfo := contract.IStateStateInfo{Id: userID.BigInt(), State: big.NewInt(555)} @@ -144,7 +146,8 @@ func TestResolve_Success(t *testing.T) { State: big.NewInt(555), }, GistInfo: &services.GistInfo{ - Root: big.NewInt(400), + Root: big.NewInt(400), + Proof: &proof, }, }, }, diff --git a/pkg/services/did.go b/pkg/services/did.go index 180a0cf..a09780b 100644 --- a/pkg/services/did.go +++ b/pkg/services/did.go @@ -12,6 +12,7 @@ import ( core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/merkletree-proof/resolvers" "github.com/pkg/errors" ) @@ -20,9 +21,10 @@ const ( ) type DidDocumentServices struct { - resolvers *ResolverRegistry - ens *ens.Registry - provers *DIDResolutionProverRegistry + resolvers *ResolverRegistry + ens *ens.Registry + provers *DIDResolutionProverRegistry + revStatusOnChainResolver *resolvers.OnChainResolver } type ResolverOpts struct { @@ -39,8 +41,8 @@ func WithProvers(provers *DIDResolutionProverRegistry) DidDocumentOption { } } -func NewDidDocumentServices(resolvers *ResolverRegistry, registry *ens.Registry, opts ...DidDocumentOption) *DidDocumentServices { - didDocumentService := &DidDocumentServices{resolvers, registry, nil} +func NewDidDocumentServices(resolverRegistry *ResolverRegistry, registry *ens.Registry, revStatusOnChainResolver *resolvers.OnChainResolver, opts ...DidDocumentOption) *DidDocumentServices { + didDocumentService := &DidDocumentServices{resolverRegistry, registry, nil, revStatusOnChainResolver} for _, opt := range opts { opt(didDocumentService) @@ -145,6 +147,10 @@ func (d *DidDocumentServices) GetDidDocument(ctx context.Context, did string, op }, ) + if gist != nil && gist.Proof != nil { + didResolution.DidDocument.Context = append(didResolution.DidDocument.Context.([]string), document.Iden3proofsContext) + } + if opts.Signature != "" { if d.provers == nil { return nil, errors.New("provers are not initialized") @@ -253,6 +259,16 @@ func (d *DidDocumentServices) GetGist(ctx context.Context, chain, network string return gistInfo.ToDidRepresentation() } +// ResolveCredentialStatus return revocation status. +func (d *DidDocumentServices) ResolveCredentialStatus(ctx context.Context, issuerDid string, credentialStatus verifiable.CredentialStatus) (verifiable.RevocationStatus, error) { + did, err := w3c.ParseDID(issuerDid) + if err != nil { + return verifiable.RevocationStatus{}, err + } + ctx = verifiable.WithIssuerDID(ctx, did) + return d.revStatusOnChainResolver.Resolve(ctx, credentialStatus) +} + func isPublished(si *StateInfo) bool { if si == nil || si.State == nil { return false diff --git a/pkg/services/registry.go b/pkg/services/registry.go index 80eed33..a2f6fe1 100644 --- a/pkg/services/registry.go +++ b/pkg/services/registry.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" + contract "github.com/iden3/contracts-abi/state/go/abi" "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-merkletree-sql/v2" "github.com/iden3/go-schema-processor/v2/verifiable" @@ -66,6 +67,7 @@ type GistInfo struct { ReplacedAtTimestamp *big.Int CreatedAtBlock *big.Int ReplacedAtBlock *big.Int + Proof *contract.IStateGistProof } func (gi *GistInfo) ToDidRepresentation() (*verifiable.GistInfo, error) { @@ -83,14 +85,51 @@ func (gi *GistInfo) ToDidRepresentation() (*verifiable.GistInfo, error) { return nil, err } - return &verifiable.GistInfo{ + gistInfo := &verifiable.GistInfo{ Root: rootHash.Hex(), ReplacedByRoot: replacedHash.Hex(), CreatedAtTimestamp: gi.CreatedAtTimestamp.String(), ReplacedAtTimestamp: gi.ReplacedAtTimestamp.String(), CreatedAtBlock: gi.CreatedAtBlock.String(), ReplacedAtBlock: gi.ReplacedAtBlock.String(), - }, nil + } + + if gi.Proof != nil { + siblingsStrArr := make([]*merkletree.Hash, len(gi.Proof.Siblings)) + for i, bi := range &gi.Proof.Siblings { + hash, err := merkletree.NewHashFromBigInt(bi) + if err != nil { + return nil, err + } + siblingsStrArr[i] = hash + } + + var nodeAux *merkletree.NodeAux + if !gi.Proof.Existence && gi.Proof.AuxExistence { + val, err := merkletree.NewHashFromBigInt(gi.Proof.AuxValue) + if err != nil { + return nil, err + } + indx, err := merkletree.NewHashFromBigInt(gi.Proof.AuxIndex) + if err != nil { + return nil, err + } + nodeAux = &merkletree.NodeAux{ + Key: indx, + Value: val, + } + } + mkProof, err := merkletree.NewProofFromData(gi.Proof.Existence, siblingsStrArr, nodeAux) + if err != nil { + return nil, err + } + + gistInfo.Proof = &verifiable.GistInfoProof{ + Proof: *mkProof, + Type: verifiable.Iden3SparseMerkleTreeProofType, + } + } + return gistInfo, nil } type Resolver interface {