diff --git a/README.md b/README.md index a2fb0f8..df89f74 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ > -`go get github.com/iden3/go-iden3-auth` +`go get github.com/iden3/go-iden3-auth/v2` ### General description: @@ -62,7 +62,7 @@ The blockchain verification algorithm is used 1. A non-empty GIST is returned, equal to the GIST is provided by the user, it means the user is using the latest state. 2. The non-empty GIST is returned and it’s not equal to the GIST is provided by a user. Gets the transition time of the GIST. The verification party can make a decision if it can accept this state based on that time frame. ## How to use: -1. `go get https://github.com/iden3/go-iden3-auth` +1. `go get https://github.com/iden3/go-iden3-auth/v2` 2. Request generation: basic auth: diff --git a/auth.go b/auth.go index bf8e975..e432e76 100644 --- a/auth.go +++ b/auth.go @@ -11,14 +11,14 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/google/uuid" "github.com/iden3/contracts-abi/state/go/abi" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - "github.com/iden3/go-iden3-auth/proofs" - "github.com/iden3/go-iden3-auth/pubsignals" - "github.com/iden3/go-iden3-auth/state" - "github.com/iden3/go-jwz" - "github.com/iden3/iden3comm/packers" - "github.com/iden3/iden3comm/protocol" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + "github.com/iden3/go-iden3-auth/v2/proofs" + "github.com/iden3/go-iden3-auth/v2/pubsignals" + "github.com/iden3/go-iden3-auth/v2/state" + "github.com/iden3/go-jwz/v2" + "github.com/iden3/iden3comm/v2/packers" + "github.com/iden3/iden3comm/v2/protocol" "github.com/pkg/errors" ) diff --git a/auth_test.go b/auth_test.go index 6a774cf..23c0f7a 100644 --- a/auth_test.go +++ b/auth_test.go @@ -6,13 +6,13 @@ import ( "testing" "github.com/google/uuid" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - "github.com/iden3/go-iden3-auth/pubsignals" - "github.com/iden3/go-iden3-auth/state" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + "github.com/iden3/go-iden3-auth/v2/pubsignals" + "github.com/iden3/go-iden3-auth/v2/state" "github.com/iden3/go-rapidsnark/types" - "github.com/iden3/iden3comm/packers" - "github.com/iden3/iden3comm/protocol" + "github.com/iden3/iden3comm/v2/packers" + "github.com/iden3/iden3comm/v2/protocol" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/go.mod b/go.mod index b5d4392..99360f0 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/iden3/go-iden3-auth +module github.com/iden3/go-iden3-auth/v2 go 1.18 @@ -8,13 +8,13 @@ require ( github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/iden3/contracts-abi/state/go/abi v1.0.0-beta.3 - github.com/iden3/go-circuits v1.0.3 - github.com/iden3/go-iden3-core v1.0.2 - github.com/iden3/go-jwz v1.0.0 + github.com/iden3/go-circuits/v2 v2.0.0-20230509170938-87ec0426a872 + github.com/iden3/go-iden3-core/v2 v2.0.0-20230505110120-f4681972ad45 + github.com/iden3/go-jwz/v2 v2.0.0-20230509174319-3791b6c3e946 github.com/iden3/go-rapidsnark/types v0.0.3 github.com/iden3/go-rapidsnark/verifier v0.0.5 - github.com/iden3/go-schema-processor v1.1.5 - github.com/iden3/iden3comm v1.0.0 + github.com/iden3/go-schema-processor/v2 v2.0.0-20230509182548-f9ee518c3f71 + github.com/iden3/iden3comm/v2 v2.0.0-20230515074208-5d7e585b04cc github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.2 @@ -29,10 +29,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.3.0 // 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/fsnotify/fsnotify v1.6.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect github.com/iden3/go-iden3-crypto v0.0.15 // indirect @@ -45,6 +46,12 @@ require ( github.com/ipfs/go-ipfs-files v0.3.0 // indirect github.com/ipfs/go-libipfs v0.6.1 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // 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.9-0.20230429214153-5090ec1bd2cd // 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.26.2 // indirect @@ -69,11 +76,11 @@ require ( github.com/tklauser/numcpus v0.6.0 // indirect github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/crypto v0.8.0 // indirect + golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.29.1 // indirect + gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.1.7 // indirect ) diff --git a/go.sum b/go.sum index 05ef34d..7d8bdb7 100644 --- a/go.sum +++ b/go.sum @@ -48,11 +48,12 @@ 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.3.0 h1:qs18EKUfHm2X9fA50Mr/M5hccg2tNnVqsiBImnyDs0g= github.com/deckarep/golang-set/v2 v2.3.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -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/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= @@ -68,6 +69,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -102,14 +105,14 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/iden3/contracts-abi/state/go/abi v1.0.0-beta.3 h1:ZHFnK2dU3NJglY+igY48JLHWtNGN/Vhf5/L/qrFk/tM= github.com/iden3/contracts-abi/state/go/abi v1.0.0-beta.3/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= -github.com/iden3/go-circuits v1.0.3 h1:mZqHvuXIAjCQdwRFiq2472KYfKHtzomYoKu0BtF3+5c= -github.com/iden3/go-circuits v1.0.3/go.mod h1:YbuzfvSyr8BwNHnjRJEvnRQ2lJKzVQ9Sgz3OAdqv5Is= -github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= -github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= +github.com/iden3/go-circuits/v2 v2.0.0-20230509170938-87ec0426a872 h1:7GqDE4fietp4tL9dWWpdu4Ml82P88mD1G70eQ14J8No= +github.com/iden3/go-circuits/v2 v2.0.0-20230509170938-87ec0426a872/go.mod h1:xqXarAGueeu+75Z/f/liAq2DYmQJQ6PrQbgVqdTxPyQ= +github.com/iden3/go-iden3-core/v2 v2.0.0-20230505110120-f4681972ad45 h1:0XwrQksyOrKz86bDZSuYbGGJLIvGQyTHGEhFP4QWqq4= +github.com/iden3/go-iden3-core/v2 v2.0.0-20230505110120-f4681972ad45/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 v1.0.0 h1:tRyAMK9unf21z8uNvJ8V2LFvXdlYZe7pgRE7V19Q/vs= -github.com/iden3/go-jwz v1.0.0/go.mod h1:vX0kANbDvoNUAevlWyU1UDVQ0PWgplOK0YK1+8BaOz4= +github.com/iden3/go-jwz/v2 v2.0.0-20230509174319-3791b6c3e946 h1:F9oOe1ZMlJ8rZ/1kraznp714T4DBY5dRiFCkhgDFZgo= +github.com/iden3/go-jwz/v2 v2.0.0-20230509174319-3791b6c3e946/go.mod h1:XSQlWuAYnFmp7LVeTC4T+airr8ccEPuaF4pUh0A9sLE= 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-rapidsnark/prover v0.0.10 h1:NvOfRPpex/k646UsqOcUy7a7uVl17t4ok9kWvpQg4+k= @@ -120,10 +123,10 @@ github.com/iden3/go-rapidsnark/verifier v0.0.5 h1:J7y0ovrEjDQoWtZmlrp4tgGng1A9fa github.com/iden3/go-rapidsnark/verifier v0.0.5/go.mod h1:KgL3Yr9NehlFDI4EIWVLE3UDUi8ulyjbp7HcXSBfiGI= github.com/iden3/go-rapidsnark/witness v0.0.6 h1:p+6QBymSV3XWm1kB2PL2vlXxKXJN8GyWuqNJv/0PGGU= github.com/iden3/go-rapidsnark/witness v0.0.6/go.mod h1:57IHQpnvx0CeS6cAT07oN/lqwT5LRc4zicYoZ1cnAPE= -github.com/iden3/go-schema-processor v1.1.5 h1:nhK4xNMlNdnNmPT/WlNZgmbrHL9ifXn9QgPp87L+G7U= -github.com/iden3/go-schema-processor v1.1.5/go.mod h1:OoxGutmHbpU42/mYCkzYSf4nhsEZ0Ws0ouBpWxcjp0w= -github.com/iden3/iden3comm v1.0.0 h1:ZF796O5oftSFZDhPG5hTcBjY9Yw2faSajD47cjYdSJA= -github.com/iden3/iden3comm v1.0.0/go.mod h1:2rEv35F6gE0XJjP89sCOR0Im4/r6uG2jo8Ui5p5bzE4= +github.com/iden3/go-schema-processor/v2 v2.0.0-20230509182548-f9ee518c3f71 h1:Tix/kH7NWOXjzZgS7TTwNaAjvWNHFx4RAVqeYTXXsSY= +github.com/iden3/go-schema-processor/v2 v2.0.0-20230509182548-f9ee518c3f71/go.mod h1:NVz+rOZjWWH6rySnjJ4kzlyGiKXwkpUyXK1Kgbw7Yzc= +github.com/iden3/iden3comm/v2 v2.0.0-20230515074208-5d7e585b04cc h1:xN2Kar3mhrV1/AsKpZl553N/xFjm/wHSdY2Y74rL0u0= +github.com/iden3/iden3comm/v2 v2.0.0-20230515074208-5d7e585b04cc/go.mod h1:UdfQKrMA/uh5E2226XMLKTjoAI2PXJNqitbmE3LsYMw= github.com/iden3/wasmer-go v0.0.1 h1:TZKh8Se8B/73PvWrcu+FTU9L1k5XYAmtFbioj7l0Uog= github.com/iden3/wasmer-go v0.0.1/go.mod h1:ZnZBAO012M7o+Q1INXLRIxKQgEcH2FuwL0Iga8A4ufg= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= @@ -148,6 +151,19 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 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/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= +github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= +github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx/v2 v2.0.9-0.20230429214153-5090ec1bd2cd h1:jzU4xunmLFc7uF97O5PhEFmAuiRSuG7/RKrX2gkKWeY= +github.com/lestrrat-go/jwx/v2 v2.0.9-0.20230429214153-5090ec1bd2cd/go.mod h1:6etqt12jS77WEY6WPM9nmnIaG6fMo5yQmtTSqB2eLk4= +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= @@ -240,27 +256,37 @@ github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b h1:wA3QeTs 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= 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-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-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= 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/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= 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-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +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.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= 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.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= @@ -274,20 +300,32 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w 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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/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.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= 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/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/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= @@ -304,10 +342,10 @@ google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw 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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +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/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/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= -gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= 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.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/loaders/key.go b/loaders/key.go index 4a4eb8c..c789097 100644 --- a/loaders/key.go +++ b/loaders/key.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/iden3/go-circuits" + "github.com/iden3/go-circuits/v2" ) // VerificationKeyLoader load verification key bytes for specific circuit diff --git a/loaders/schema.go b/loaders/schema.go index 04c8f23..5c4c707 100644 --- a/loaders/schema.go +++ b/loaders/schema.go @@ -5,8 +5,8 @@ import ( "fmt" "net/url" - "github.com/iden3/go-schema-processor/loaders" - "github.com/iden3/go-schema-processor/processor" + "github.com/iden3/go-schema-processor/v2/loaders" + "github.com/iden3/go-schema-processor/v2/processor" ) // SchemaLoader is an interface for schema loading diff --git a/proofs/zk.go b/proofs/zk.go index c15ac02..fede73f 100644 --- a/proofs/zk.go +++ b/proofs/zk.go @@ -2,7 +2,7 @@ package proofs import ( "github.com/iden3/go-rapidsnark/verifier" - "github.com/iden3/iden3comm/protocol" + "github.com/iden3/iden3comm/v2/protocol" "github.com/pkg/errors" ) diff --git a/proofs/zk_test.go b/proofs/zk_test.go index 838f3c1..b1437a2 100644 --- a/proofs/zk_test.go +++ b/proofs/zk_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - "github.com/iden3/go-circuits" + "github.com/iden3/go-circuits/v2" "github.com/iden3/go-rapidsnark/types" - "github.com/iden3/iden3comm/protocol" + "github.com/iden3/iden3comm/v2/protocol" "github.com/stretchr/testify/assert" ) diff --git a/pubsignals/atomicMtpV2.go b/pubsignals/atomicMtpV2.go index 7fa99d5..61f2df9 100644 --- a/pubsignals/atomicMtpV2.go +++ b/pubsignals/atomicMtpV2.go @@ -7,9 +7,9 @@ import ( "math/big" "time" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - core "github.com/iden3/go-iden3-core" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + core "github.com/iden3/go-iden3-core/v2" "github.com/pkg/errors" ) @@ -41,12 +41,18 @@ func (c *AtomicQueryMTPV2) VerifyQuery( } // VerifyStates verifies user state and issuer claim issuance state in the smart contract. -func (c *AtomicQueryMTPV2) VerifyStates(ctx context.Context, stateResolvers map[string]StateResolver, opts ...VerifyOpt) error { - issuerDID, err := core.ParseDIDFromID(*c.IssuerID) +func (c *AtomicQueryMTPV2) VerifyStates(ctx context.Context, + stateResolvers map[string]StateResolver, opts ...VerifyOpt) error { + + blockchain, err := core.BlockchainFromID(*c.IssuerID) + if err != nil { + return err + } + networkID, err := core.NetworkIDFromID(*c.IssuerID) if err != nil { return err } - resolver, ok := stateResolvers[fmt.Sprintf("%s:%s", issuerDID.Blockchain, issuerDID.NetworkID)] + resolver, ok := stateResolvers[fmt.Sprintf("%s:%s", blockchain, networkID)] if !ok { return errors.Errorf("%s resolver not found", resolver) } @@ -92,7 +98,8 @@ func (c *AtomicQueryMTPV2) VerifyIDOwnership(sender string, requestID *big.Int) return err } if sender != userDID.String() { - return fmt.Errorf("sender is not used for proof creation, expected %s, user from public signals: %s}", sender, c.UserID.String()) + return fmt.Errorf("sender is not used for proof creation, expected %s, user from public signals: %s}", sender, + c.UserID.String()) } return nil } diff --git a/pubsignals/atomicSigV2.go b/pubsignals/atomicSigV2.go index 8a4243c..4be4ae5 100644 --- a/pubsignals/atomicSigV2.go +++ b/pubsignals/atomicSigV2.go @@ -7,9 +7,9 @@ import ( "math/big" "time" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - core "github.com/iden3/go-iden3-core" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + core "github.com/iden3/go-iden3-core/v2" "github.com/pkg/errors" ) @@ -46,11 +46,15 @@ func (c *AtomicQuerySigV2) VerifyQuery( // VerifyStates verifies user state and issuer auth claim state in the smart contract. func (c *AtomicQuerySigV2) VerifyStates(ctx context.Context, stateResolvers map[string]StateResolver, opts ...VerifyOpt) error { - issuerDID, err := core.ParseDIDFromID(*c.IssuerID) + blockchain, err := core.BlockchainFromID(*c.IssuerID) if err != nil { return err } - resolver, ok := stateResolvers[fmt.Sprintf("%s:%s", issuerDID.Blockchain, issuerDID.NetworkID)] + networkID, err := core.NetworkIDFromID(*c.IssuerID) + if err != nil { + return err + } + resolver, ok := stateResolvers[fmt.Sprintf("%s:%s", blockchain, networkID)] if !ok { return errors.Errorf("%s resolver not found", resolver) } diff --git a/pubsignals/authV2.go b/pubsignals/authV2.go index c20c242..5fe83d4 100644 --- a/pubsignals/authV2.go +++ b/pubsignals/authV2.go @@ -7,9 +7,9 @@ import ( "math/big" "time" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - core "github.com/iden3/go-iden3-core" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + core "github.com/iden3/go-iden3-core/v2" "github.com/pkg/errors" ) @@ -29,11 +29,15 @@ func (c *AuthV2) VerifyQuery( // VerifyStates verify AuthV2 tests. func (c *AuthV2) VerifyStates(ctx context.Context, stateResolvers map[string]StateResolver, opts ...VerifyOpt) error { - userDID, err := core.ParseDIDFromID(*c.UserID) + blockchain, err := core.BlockchainFromID(*c.UserID) + if err != nil { + return err + } + networkID, err := core.NetworkIDFromID(*c.UserID) if err != nil { return err } - chainInfo := fmt.Sprintf("%s:%s", userDID.Blockchain, userDID.NetworkID) + chainInfo := fmt.Sprintf("%s:%s", blockchain, networkID) resolver, ok := stateResolvers[chainInfo] if !ok { return errors.Errorf("%s resolver not found", chainInfo) diff --git a/pubsignals/circuitVerifier.go b/pubsignals/circuitVerifier.go index 67b1da6..95b529f 100644 --- a/pubsignals/circuitVerifier.go +++ b/pubsignals/circuitVerifier.go @@ -5,9 +5,9 @@ import ( "encoding/json" "math/big" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - "github.com/iden3/go-iden3-auth/state" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + "github.com/iden3/go-iden3-auth/v2/state" ) // StateResolver is a state resolver interface diff --git a/pubsignals/query.go b/pubsignals/query.go index 90c8fb2..877f37a 100644 --- a/pubsignals/query.go +++ b/pubsignals/query.go @@ -8,12 +8,12 @@ import ( "math/big" "strconv" - "github.com/iden3/go-circuits" - "github.com/iden3/go-iden3-auth/loaders" - core "github.com/iden3/go-iden3-core" - jsonSuite "github.com/iden3/go-schema-processor/json" - "github.com/iden3/go-schema-processor/merklize" - "github.com/iden3/go-schema-processor/utils" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-auth/v2/loaders" + core "github.com/iden3/go-iden3-core/v2" + jsonSuite "github.com/iden3/go-schema-processor/v2/json" + "github.com/iden3/go-schema-processor/v2/merklize" + "github.com/iden3/go-schema-processor/v2/utils" "github.com/piprate/json-gold/ld" "github.com/pkg/errors" ) diff --git a/pubsignals/query_test.go b/pubsignals/query_test.go index 77fa28f..33551e3 100644 --- a/pubsignals/query_test.go +++ b/pubsignals/query_test.go @@ -8,7 +8,7 @@ import ( "math/big" "testing" - core "github.com/iden3/go-iden3-core" + core "github.com/iden3/go-iden3-core/v2" "github.com/stretchr/testify/require" ) diff --git a/pubsignals/signals.go b/pubsignals/signals.go index d536736..590522c 100644 --- a/pubsignals/signals.go +++ b/pubsignals/signals.go @@ -4,7 +4,7 @@ import ( "reflect" "sync" - "github.com/iden3/go-circuits" + "github.com/iden3/go-circuits/v2" "github.com/pkg/errors" ) diff --git a/state/state.go b/state/state.go index 9a84855..9b7a2c1 100644 --- a/state/state.go +++ b/state/state.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/iden3/contracts-abi/state/go/abi" - core "github.com/iden3/go-iden3-core" + core "github.com/iden3/go-iden3-core/v2" "github.com/pkg/errors" ) diff --git a/state/state_test.go b/state/state_test.go index 0c26971..4f6ade2 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -7,9 +7,10 @@ import ( "github.com/golang/mock/gomock" "github.com/iden3/contracts-abi/state/go/abi" - "github.com/iden3/go-iden3-auth/state" - mock "github.com/iden3/go-iden3-auth/state/mock" - core "github.com/iden3/go-iden3-core" + "github.com/iden3/go-iden3-auth/v2/state" + mock "github.com/iden3/go-iden3-auth/v2/state/mock" + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/did" "github.com/pkg/errors" "github.com/stretchr/testify/require" ) @@ -303,19 +304,26 @@ func TestResolveGlobalRoot_Error(t *testing.T) { } func TestCheckGenesisStateID(t *testing.T) { - userDID, err := core.ParseDID("did:iden3:polygon:mumbai:x6suHR8HkEYczV9yVeAKKiXCZAd25P8WS6QvNhszk") + userDID, err := did.Parse("did:iden3:polygon:mumbai:x6suHR8HkEYczV9yVeAKKiXCZAd25P8WS6QvNhszk") require.NoError(t, err) - genesisID, ok := big.NewInt(0).SetString("7521024223205616003431860562270429547098131848980857190502964780628723574810", 10) + genesisID, ok := big.NewInt(0).SetString( + "7521024223205616003431860562270429547098131848980857190502964780628723574810", + 10) require.True(t, ok) - isGenesis, err := state.CheckGenesisStateID(userDID.ID.BigInt(), genesisID) + uID, err := core.IDFromDID(*userDID) + require.NoError(t, err) + + isGenesis, err := state.CheckGenesisStateID(uID.BigInt(), genesisID) require.NoError(t, err) require.True(t, isGenesis) - notGenesisState, ok := big.NewInt(0).SetString("6017654403209798611575982337826892532952335378376369712724079246845524041042", 10) + notGenesisState, ok := big.NewInt(0).SetString( + "6017654403209798611575982337826892532952335378376369712724079246845524041042", + 10) require.True(t, ok) - isGenesis, err = state.CheckGenesisStateID(userDID.ID.BigInt(), notGenesisState) + isGenesis, err = state.CheckGenesisStateID(uID.BigInt(), notGenesisState) require.NoError(t, err) require.False(t, isGenesis) }