diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index 1b29c5e..14f78f2 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -10,16 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.21.0 - name: Checkout code - uses: actions/checkout@v2 - - name: install golangci-lint - run: - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.52.2 - - name: lint - run: | - go version - $GITHUB_WORKSPACE/golangci-lint version - $GITHUB_WORKSPACE/golangci-lint --config .golangci.yml run + uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.2 diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index 629208f..607ab68 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -13,13 +13,13 @@ jobs: test: strategy: matrix: - containers: [ 1.19, 1.18 ] + containers: [ 1.20.4, 1.19, 1.18 ] runs-on: ubuntu-latest container: golang:${{ matrix.containers }} steps: - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/cache@v2 + uses: actions/checkout@v3 + - uses: actions/cache@v3 with: path: | ~/.cache/go-build @@ -30,4 +30,4 @@ jobs: - name: Update go modules run: go mod tidy - name: Unit Tests - run: make test + run: go test -v -race -timeout=60s ./... diff --git a/go.mod b/go.mod index e9eaed1..a8261a0 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,26 @@ -module github.com/iden3/iden3comm +module github.com/iden3/iden3comm/v2 go 1.18 require ( github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 - github.com/gofrs/uuid v3.3.0+incompatible - github.com/iden3/go-circuits v1.0.3 - github.com/iden3/go-iden3-core v1.0.2 + github.com/gofrs/uuid/v5 v5.0.0 + github.com/iden3/go-circuits/v2 v2.0.0 + github.com/iden3/go-iden3-core/v2 v2.0.0 github.com/iden3/go-iden3-crypto v0.0.15 - github.com/iden3/go-jwz v1.0.0 + github.com/iden3/go-jwz/v2 v2.0.0 github.com/iden3/go-rapidsnark/types v0.0.3 - github.com/iden3/go-schema-processor v1.2.0 - github.com/lestrrat-go/jwx/v2 v2.0.9-0.20230429214153-5090ec1bd2cd + github.com/iden3/go-schema-processor/v2 v2.0.0 + github.com/lestrrat-go/jwx/v2 v2.0.12 github.com/mr-tron/base58 v1.2.0 github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.4 gopkg.in/go-jose/go-jose.v2 v2.6.1 ) require ( + github.com/benbjohnson/clock v1.3.5 // indirect + github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/blake512 v1.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect @@ -27,17 +29,40 @@ require ( github.com/iden3/go-merkletree-sql/v2 v2.0.4 // indirect github.com/iden3/go-rapidsnark/prover v0.0.10 // indirect github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect - github.com/iden3/go-rapidsnark/witness v0.0.6 // indirect - github.com/iden3/wasmer-go v0.0.1 // 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/ipfs/go-ipfs-api v0.6.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.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/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/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/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect - golang.org/x/crypto v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + github.com/segmentio/asm v1.2.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/tetratelabs/wazero v1.1.0 // indirect + github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/sys v0.11.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect ) diff --git a/go.sum b/go.sum index fc7b361..c815564 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,14 @@ +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/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= +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/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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA= github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI= +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.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= @@ -10,18 +16,20 @@ github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 h1:I6KUy4CI6hHjqnyJL github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564/go.mod h1:yekO+3ZShy19S+bsmnERmznGy9Rfg6dWWWpiGJjNAz8= 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/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +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= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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 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-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 h1:VsU2PrmcchPMx/V0IhamMZRNjiQYZoyJopO8K8uSZOY= +github.com/iden3/go-jwz/v2 v2.0.0/go.mod h1:JBJ58Cef8h+4Uz8qaVRsNjiT/Ubqb800dGKTZt66NkU= 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= @@ -30,12 +38,20 @@ github.com/iden3/go-rapidsnark/types v0.0.3 h1:f0s1Qdut1qHe1O67+m+xUVRBPwSXnq5j0 github.com/iden3/go-rapidsnark/types v0.0.3/go.mod h1:ApgcaUxKIgSRA6fAeFxK7p+lgXXfG4oA2HN5DhFlfF4= github.com/iden3/go-rapidsnark/verifier v0.0.5 h1:J7y0ovrEjDQoWtZmlrp4tgGng1A9faMeYsQH4igAEqA= 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.2.0 h1:kcT8zfIx0U7M2j/sOXUPdTcn9hdy7WwRhR+0yQlV4nQ= -github.com/iden3/go-schema-processor v1.2.0/go.mod h1:OoxGutmHbpU42/mYCkzYSf4nhsEZ0Ws0ouBpWxcjp0w= -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/iden3/go-rapidsnark/witness/v2 v2.0.0 h1:mkY6VDfwKVJc83QGKmwVXY2LYepidPrFAxskrjr8UCs= +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.0.0 h1:izbC5+rd7rV1np+tjCqDe016qlOKu6JF7r8LQvdObWM= +github.com/iden3/go-schema-processor/v2 v2.0.0/go.mod h1:eWRQDbxixZ/9k/uPlciKIy6TUYlKX/6hdqyTuAQi3wE= +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/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/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= @@ -45,13 +61,39 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG 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/jwx/v2 v2.0.12 h1:3d589+5w/b9b7S3DneICPW16AqTyYXB7VRjgluSDWeA= +github.com/lestrrat-go/jwx/v2 v2.0.12/go.mod h1:Mq4KN1mM7bp+5z/W5HS8aCNs5RKZ911G/0y2qUjAQuQ= 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/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/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/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= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -60,51 +102,67 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= +github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +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/tetratelabs/wazero v1.1.0 h1:EByoAhC+QcYpwSZJSs/aV0uokxPwBgKxfiokSUwAknQ= +github.com/tetratelabs/wazero v1.1.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= +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/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 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/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= 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-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-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/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/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/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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.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/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= 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/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= 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.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/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 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.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-20191204190536-9bdfabe68543/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.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/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U= @@ -112,3 +170,5 @@ gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEI 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= diff --git a/mock/proving.go b/mock/proving.go index fd1ce30..8c83f95 100644 --- a/mock/proving.go +++ b/mock/proving.go @@ -8,10 +8,10 @@ import ( "encoding/json" "math/big" - "github.com/iden3/go-circuits" - core "github.com/iden3/go-iden3-core" + "github.com/iden3/go-circuits/v2" + "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-iden3-crypto/babyjub" - "github.com/iden3/go-jwz" + "github.com/iden3/go-jwz/v2" "github.com/iden3/go-rapidsnark/types" "gopkg.in/go-jose/go-jose.v2" ) @@ -55,9 +55,10 @@ func (m *ProvingMethodGroth16AuthV2) Prove(_, _, _ []byte) (*types.ZKProof, erro } // PrepareAuthInputs returns mocked inputs for auth circuit -func PrepareAuthInputs(hash []byte, _ *core.DID, _ circuits.CircuitID) ([]byte, error) { +func PrepareAuthInputs(hash []byte, _ *w3c.DID, _ circuits.CircuitID) ([]byte, error) { challenge := new(big.Int).SetBytes(hash) + // nolint:gosec // intentionally hardcoded key userMockedPK := "28156abe7fe2fd433dc9df969286b96666489bac508612d0e16593e944c4f69f" mockedInputs := []byte(`{"genesisID":"26240537881285303866959914873501215904100246541568629963310309506817331714","profileNonce":"0","authClaim":["80551937543569765027552589160822318028","0","17640206035128972995519606214765283372613874593503528180869261482403155458945","20634138280259599560273310290025659992320584624461316485434108770067472477956","15930428023331155902","0","0","0"],"authClaimIncMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"authClaimNonRevMtpAuxHi":"0","authClaimNonRevMtpAuxHv":"0","authClaimNonRevMtpNoAux":"1","challenge":"14269789266808968059169672911201921167953561300079987951824960759204067719875","challengeSignatureR8x":"20992633743481332091913653097095396906863961240425405184828226842777462122604","challengeSignatureR8y":"6273393852003225177156448231418255112053204171233395051223716406391798124538","challengeSignatureS":"2526580092966761964661422490382760858931103025833974942666750372883822638953","claimsTreeRoot":"9860409408344985873118363460916733946840214387455464863344022463808838582364","revTreeRoot":"0","rootsTreeRoot":"0","state":"1648710229725601204870171311149827592640182384459240511403224642152766848235","gistRoot":"6935795554508121074939204655265782244399347577736991410323391948936398259093","gistMtp":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"gistMtpAuxHi":"28049899845899252156982726682342581898046855955053612508111669900571644418","gistMtpAuxHv":"20177832565449474772630743317224985532862797657496372535616634430055981993180","gistMtpNoAux":"0"}`) var k babyjub.PrivateKey diff --git a/packager_test.go b/packager_test.go index f4d3bbe..4adbb87 100644 --- a/packager_test.go +++ b/packager_test.go @@ -4,13 +4,13 @@ import ( "encoding/json" "testing" - "github.com/gofrs/uuid" - core "github.com/iden3/go-iden3-core" - "github.com/iden3/go-jwz" - "github.com/iden3/iden3comm" - "github.com/iden3/iden3comm/mock" - "github.com/iden3/iden3comm/packers" - "github.com/iden3/iden3comm/protocol" + "github.com/gofrs/uuid/v5" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/go-jwz/v2" + "github.com/iden3/iden3comm/v2" + "github.com/iden3/iden3comm/v2/mock" + "github.com/iden3/iden3comm/v2/packers" + "github.com/iden3/iden3comm/v2/protocol" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -22,12 +22,12 @@ func TestPackagerPlainPacker(t *testing.T) { identifier := "did:iden3:polygon:mumbai:x4jcHP4XHTK3vX58AHZPyHE8kYjneyE6FZRfz7K29" - senderDID, err := core.ParseDID(identifier) + senderDID, err := w3c.ParseDID(identifier) assert.NoError(t, err) targetIdentifier := "did:iden3:polygon:mumbai:wzWeGdtjvKtUP1oTxQP5t5iZGDX3HNfEU5xR8MZAt" - targetID, err := core.ParseDID(targetIdentifier) + targetID, err := w3c.ParseDID(targetIdentifier) assert.NoError(t, err) marshalledMsg, err := createFetchCredentialMessage(packers.MediaTypePlainMessage, senderDID, targetID) @@ -58,7 +58,7 @@ var msgBytes = []byte(`{"type":"https://iden3-communication.io/authorization/1.0 func TestPackagerZKPPacker(t *testing.T) { pm := initPackageManager(t) - senderDID, err := core.ParseDID("did:polygonid:polygon:mumbai:2qK8oh6weN7H3Z8ji5YwV8Y9BF7qJfJnZ7XCdSCWo7") + senderDID, err := w3c.ParseDID("did:polygonid:polygon:mumbai:2qK8oh6weN7H3Z8ji5YwV8Y9BF7qJfJnZ7XCdSCWo7") assert.NoError(t, err) envelope, err := pm.Pack(packers.MediaTypeZKPMessage, msgBytes, packers.ZKPPackerParams{SenderID: senderDID, @@ -80,12 +80,12 @@ func TestPackagerAnonryptPacker(t *testing.T) { identifier := "did:iden3:polygon:mumbai:x4jcHP4XHTK3vX58AHZPyHE8kYjneyE6FZRfz7K29" - senderDID, err := core.ParseDID(identifier) + senderDID, err := w3c.ParseDID(identifier) assert.NoError(t, err) targetIdentifier := "did:iden3:polygon:mumbai:wzWeGdtjvKtUP1oTxQP5t5iZGDX3HNfEU5xR8MZAt" - targetID, err := core.ParseDID(targetIdentifier) + targetID, err := w3c.ParseDID(targetIdentifier) assert.NoError(t, err) marshalledMsg, err := createFetchCredentialMessage(packers.MediaTypeEncryptedMessage, senderDID, targetID) @@ -93,7 +93,8 @@ func TestPackagerAnonryptPacker(t *testing.T) { key, err := mock.ResolveKeyID(mock.MockRecipientKeyID) require.NoError(t, err) - envelope, err := pm.Pack(packers.MediaTypeEncryptedMessage, marshalledMsg, packers.AnoncryptPackerParams{RecipientKey: &key}) + envelope, err := pm.Pack(packers.MediaTypeEncryptedMessage, marshalledMsg, + packers.AnoncryptPackerParams{RecipientKey: &key}) assert.NoError(t, err) unpackedMsg, unpackerType, err := pm.Unpack(envelope) @@ -114,7 +115,7 @@ func TestPackagerZKPPacker_OtherMessageTypeInBody(t *testing.T) { identifier := "did:polygonid:polygon:mumbai:2qK8oh6weN7H3Z8ji5YwV8Y9BF7qJfJnZ7XCdSCWo7" - senderDID, err := core.ParseDID(identifier) + senderDID, err := w3c.ParseDID(identifier) assert.NoError(t, err) envelope, err := pm.Pack(packers.MediaTypeZKPMessage, msgBytes, packers.ZKPPackerParams{ @@ -136,7 +137,7 @@ func TestUnpackWithType(t *testing.T) { identifier := "did:polygonid:polygon:mumbai:2qK8oh6weN7H3Z8ji5YwV8Y9BF7qJfJnZ7XCdSCWo7" - senderDID, err := core.ParseDID(identifier) + senderDID, err := w3c.ParseDID(identifier) assert.NoError(t, err) envelope, err := pm.Pack(packers.MediaTypeZKPMessage, msgBytes, packers.ZKPPackerParams{ SenderID: senderDID, @@ -149,7 +150,7 @@ func TestUnpackWithType(t *testing.T) { assert.Equal(t, unpackedMsg.Typ, packers.MediaTypeZKPMessage) } -func createFetchCredentialMessage(typ iden3comm.MediaType, from, to *core.DID) ([]byte, error) { +func createFetchCredentialMessage(typ iden3comm.MediaType, from, to *w3c.DID) ([]byte, error) { var msg protocol.CredentialFetchRequestMessage msg.From = from.String() @@ -172,17 +173,20 @@ func initPackageManager(t *testing.T) *iden3comm.PackageManager { pm := iden3comm.NewPackageManager() err := pm.RegisterPackers(&packers.PlainMessagePacker{}) require.NoError(t, err) - mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ProvingMethodAlg: jwz.ProvingMethodAlg{Alg: "groth16-mock", CircuitID: "authV2"}} + mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ProvingMethodAlg: jwz.ProvingMethodAlg{Alg: "groth16-mock", + CircuitID: "authV2"}} jwz.RegisterProvingMethod(mockedProvingMethod.ProvingMethodAlg, func() jwz.ProvingMethod { return mockedProvingMethod }) mockVerificationParam := make(map[jwz.ProvingMethodAlg]packers.VerificationParams) - mockVerificationParam[mockedProvingMethod.ProvingMethodAlg] = packers.NewVerificationParams([]byte(""), mock.VerifyState) + mockVerificationParam[mockedProvingMethod.ProvingMethodAlg] = packers.NewVerificationParams([]byte(""), + mock.VerifyState) mockProvingParamMap := make(map[jwz.ProvingMethodAlg]packers.ProvingParams) - mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = packers.NewProvingParams(mock.PrepareAuthInputs, []byte{}, []byte{}) + mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = packers.NewProvingParams(mock.PrepareAuthInputs, + []byte{}, []byte{}) err = pm.RegisterPackers(packers.NewZKPPacker(mockProvingParamMap, mockVerificationParam)) require.NoError(t, err) diff --git a/packers/anoncrypt.go b/packers/anoncrypt.go index 06dcc48..f0fb353 100644 --- a/packers/anoncrypt.go +++ b/packers/anoncrypt.go @@ -4,10 +4,9 @@ package packers import ( "encoding/json" - "github.com/iden3/iden3comm" + "github.com/iden3/iden3comm/v2" "github.com/pkg/errors" - - jose "gopkg.in/go-jose/go-jose.v2" + "gopkg.in/go-jose/go-jose.v2" ) // MediaTypeEncryptedMessage is media type for ecnrypted message diff --git a/packers/anoncrypt_test.go b/packers/anoncrypt_test.go index b7f5166..f6c4694 100644 --- a/packers/anoncrypt_test.go +++ b/packers/anoncrypt_test.go @@ -4,8 +4,7 @@ import ( "encoding/json" "testing" - "github.com/iden3/iden3comm/mock" - + "github.com/iden3/iden3comm/v2/mock" "github.com/stretchr/testify/require" "gopkg.in/go-jose/go-jose.v2" ) diff --git a/packers/jws.go b/packers/jws.go index bff1362..0d271b9 100644 --- a/packers/jws.go +++ b/packers/jws.go @@ -9,10 +9,10 @@ import ( "github.com/dustinxie/ecc" "github.com/iden3/go-iden3-crypto/keccak256" - "github.com/iden3/go-schema-processor/verifiable" - "github.com/iden3/iden3comm" - "github.com/iden3/iden3comm/packers/providers/bjj" - "github.com/iden3/iden3comm/packers/providers/es256k" + "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/iden3comm/v2" + "github.com/iden3/iden3comm/v2/packers/providers/bjj" + "github.com/iden3/iden3comm/v2/packers/providers/es256k" "github.com/lestrrat-go/jwx/v2/jwa" "github.com/lestrrat-go/jwx/v2/jwk" "github.com/lestrrat-go/jwx/v2/jws" @@ -387,7 +387,9 @@ func findVerificationMethodByID( return verifiable.CommonVerificationMethod{}, ErrorVerificationMethodNotFound } -func extractVerificationKey(alg jwa.SignatureAlgorithm, vm verifiable.CommonVerificationMethod) (jws.VerifyOption, error) { +func extractVerificationKey(alg jwa.SignatureAlgorithm, + vm verifiable.CommonVerificationMethod) (jws.VerifyOption, error) { + switch { case len(vm.PublicKeyJwk) > 0: return processJWK(string(alg), vm) diff --git a/packers/jws_test.go b/packers/jws_test.go index 7d759af..0908497 100644 --- a/packers/jws_test.go +++ b/packers/jws_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" - "github.com/iden3/go-schema-processor/verifiable" - "github.com/iden3/iden3comm/packers/providers/bjj" - "github.com/iden3/iden3comm/packers/providers/es256k" + "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/iden3comm/v2/packers/providers/bjj" + "github.com/iden3/iden3comm/v2/packers/providers/es256k" "github.com/lestrrat-go/jwx/v2/jwa" "github.com/stretchr/testify/require" ) diff --git a/packers/plain.go b/packers/plain.go index a24e706..99eb589 100644 --- a/packers/plain.go +++ b/packers/plain.go @@ -3,7 +3,7 @@ package packers import ( "encoding/json" - "github.com/iden3/iden3comm" + "github.com/iden3/iden3comm/v2" "github.com/pkg/errors" ) diff --git a/packers/zkp.go b/packers/zkp.go index 2e3c8b5..5d6876f 100644 --- a/packers/zkp.go +++ b/packers/zkp.go @@ -6,10 +6,11 @@ import ( "math/big" "strings" - "github.com/iden3/go-circuits" - core "github.com/iden3/go-iden3-core" - "github.com/iden3/go-jwz" - "github.com/iden3/iden3comm" + "github.com/iden3/go-circuits/v2" + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/go-jwz/v2" + "github.com/iden3/iden3comm/v2" "github.com/pkg/errors" ) @@ -17,10 +18,10 @@ import ( const MediaTypeZKPMessage iden3comm.MediaType = "application/iden3-zkp-json" // DataPreparerHandlerFunc registers the handler function for inputs preparation. -type DataPreparerHandlerFunc func(hash []byte, id *core.DID, circuitID circuits.CircuitID) ([]byte, error) +type DataPreparerHandlerFunc func(hash []byte, id *w3c.DID, circuitID circuits.CircuitID) ([]byte, error) // Prepare function is responsible to call provided handler for inputs preparation -func (f DataPreparerHandlerFunc) Prepare(hash []byte, id *core.DID, circuitID circuits.CircuitID) ([]byte, error) { +func (f DataPreparerHandlerFunc) Prepare(hash []byte, id *w3c.DID, circuitID circuits.CircuitID) ([]byte, error) { return f(hash, id, circuitID) } @@ -73,7 +74,7 @@ func NewProvingParams(dataPreparer DataPreparerHandlerFunc, provingKey, wasm []b // ZKPPackerParams is params for zkp packer type ZKPPackerParams struct { - SenderID *core.DID + SenderID *w3c.DID ProvingMethodAlg jwz.ProvingMethodAlg iden3comm.PackerParams } @@ -122,7 +123,8 @@ func (p *ZKPPacker) Pack(payload []byte, params iden3comm.PackerParams) ([]byte, return nil, err } - tokenStr, err := token.Prove(p.Prover[zkpParams.ProvingMethodAlg].ProvingKey, p.Prover[zkpParams.ProvingMethodAlg].Wasm) + tokenStr, err := token.Prove(p.Prover[zkpParams.ProvingMethodAlg].ProvingKey, + p.Prover[zkpParams.ProvingMethodAlg].Wasm) if err != nil { return nil, err } @@ -140,7 +142,8 @@ func (p *ZKPPacker) Unpack(envelope []byte) (*iden3comm.BasicMessage, error) { verificationKey, ok := p.Verification[jwz.ProvingMethodAlg{Alg: token.Alg, CircuitID: token.CircuitID}] if !ok { - return nil, fmt.Errorf("message was packed with unsupported circuit `%s` and alg `%s`", token.CircuitID, token.Alg) + return nil, fmt.Errorf("message was packed with unsupported circuit `%s` and alg `%s`", token.CircuitID, + token.Alg) } isValid, err := token.Verify(verificationKey.Key) @@ -201,11 +204,15 @@ func verifyAuthV2Sender(from string, token *jwz.Token) error { } if from != did.String() { - return errors.Errorf("sender of message is not used for jwz token creation, expected: '%s' got: '%s", from, did.String()) + return errors.Errorf( + "sender of message is not used for jwz token creation, expected: '%s' got: '%s", from, + did.String()) } if challenge.Cmp(authPubSignals.Challenge) != 0 { - return errors.Errorf("the challenge used for proof creation %s is not equal to the message hash %s", challenge.String(), authPubSignals.Challenge.String()) + return errors.Errorf( + "the challenge used for proof creation %s is not equal to the message hash %s", + challenge.String(), authPubSignals.Challenge.String()) } return nil diff --git a/packers/zkp_test.go b/packers/zkp_test.go index 433eeb6..dbe39f7 100644 --- a/packers/zkp_test.go +++ b/packers/zkp_test.go @@ -5,17 +5,23 @@ import ( "fmt" "testing" - "github.com/iden3/go-circuits" - core "github.com/iden3/go-iden3-core" - "github.com/iden3/go-jwz" - "github.com/iden3/iden3comm/mock" - "github.com/iden3/iden3comm/protocol" + "github.com/iden3/go-circuits/v2" + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/go-jwz/v2" + "github.com/iden3/iden3comm/v2/mock" + "github.com/iden3/iden3comm/v2/protocol" "github.com/stretchr/testify/assert" ) func TestZKPPacker_Pack(t *testing.T) { - mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ProvingMethodAlg: jwz.ProvingMethodAlg{Alg: "groth16-mock", CircuitID: "authV2"}} + mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ + ProvingMethodAlg: jwz.ProvingMethodAlg{ + Alg: "groth16-mock", + CircuitID: "authV2", + }, + } jwz.RegisterProvingMethod(mockedProvingMethod.ProvingMethodAlg, func() jwz.ProvingMethod { return mockedProvingMethod @@ -25,7 +31,8 @@ func TestZKPPacker_Pack(t *testing.T) { mockVerificationParam[mockedProvingMethod.ProvingMethodAlg] = NewVerificationParams([]byte(""), mock.VerifyState) mockProvingParamMap := make(map[jwz.ProvingMethodAlg]ProvingParams) - mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = NewProvingParams(mock.PrepareAuthInputs, []byte{}, []byte{}) + mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = + NewProvingParams(mock.PrepareAuthInputs, []byte{}, []byte{}) p := NewZKPPacker(mockProvingParamMap, mockVerificationParam) @@ -33,7 +40,7 @@ func TestZKPPacker_Pack(t *testing.T) { identifier := "did:polygonid:polygon:mumbai:2qK8oh6weN7H3Z8ji5YwV8Y9BF7qJfJnZ7XCdSCWo7" - senderDID, err := core.ParseDID(identifier) + senderDID, err := w3c.ParseDID(identifier) assert.NoError(t, err) b, err := p.Pack(msgBytes, ZKPPackerParams{ @@ -58,7 +65,12 @@ func TestZKPPacker_Pack(t *testing.T) { } func TestPlainMessagePacker_Unpack(t *testing.T) { - mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ProvingMethodAlg: jwz.ProvingMethodAlg{Alg: "groth16-mock", CircuitID: "authV2"}} + mockedProvingMethod := &mock.ProvingMethodGroth16AuthV2{ + ProvingMethodAlg: jwz.ProvingMethodAlg{ + Alg: "groth16-mock", + CircuitID: "authV2", + }, + } jwz.RegisterProvingMethod(mockedProvingMethod.ProvingMethodAlg, func() jwz.ProvingMethod { return mockedProvingMethod @@ -68,7 +80,8 @@ func TestPlainMessagePacker_Unpack(t *testing.T) { mockVerificationParam[mockedProvingMethod.ProvingMethodAlg] = NewVerificationParams([]byte(""), mock.VerifyState) mockProvingParamMap := make(map[jwz.ProvingMethodAlg]ProvingParams) - mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = NewProvingParams(mock.PrepareAuthInputs, []byte{}, []byte{}) + mockProvingParamMap[mockedProvingMethod.ProvingMethodAlg] = + NewProvingParams(mock.PrepareAuthInputs, []byte{}, []byte{}) jwz.RegisterProvingMethod(mockedProvingMethod.ProvingMethodAlg, func() jwz.ProvingMethod { return mockedProvingMethod diff --git a/protocol/auth.go b/protocol/auth.go index f0039a8..0992ccf 100644 --- a/protocol/auth.go +++ b/protocol/auth.go @@ -5,7 +5,7 @@ import ( "encoding/json" "github.com/iden3/go-rapidsnark/types" - "github.com/iden3/iden3comm" + "github.com/iden3/iden3comm/v2" ) const ( diff --git a/protocol/contract_invoke.go b/protocol/contract_invoke.go index a222b0a..1e3f239 100644 --- a/protocol/contract_invoke.go +++ b/protocol/contract_invoke.go @@ -3,7 +3,7 @@ package protocol import ( "encoding/json" - "github.com/iden3/iden3comm" + "github.com/iden3/iden3comm/v2" ) const ( diff --git a/protocol/credentials.go b/protocol/credentials.go index 2926b2f..f47cb34 100644 --- a/protocol/credentials.go +++ b/protocol/credentials.go @@ -3,8 +3,8 @@ package protocol import ( "encoding/json" - "github.com/iden3/go-schema-processor/verifiable" - "github.com/iden3/iden3comm" + "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/iden3comm/v2" ) const ( diff --git a/protocol/devices.go b/protocol/devices.go index d48480e..9ff1d24 100644 --- a/protocol/devices.go +++ b/protocol/devices.go @@ -1,6 +1,6 @@ package protocol -import "github.com/iden3/iden3comm" +import "github.com/iden3/iden3comm/v2" const ( // DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol @@ -22,6 +22,6 @@ type DeviceRegistrationRequestMessage struct { // DeviceRegistrationRequestMessageBody is struct the represents body for register device request request type DeviceRegistrationRequestMessageBody struct { - AppID string `json:"app_id"` - PushToken string `json:"push_token"` + AppID string `json:"app_id"` + PushToken string `json:"push_token"` } diff --git a/protocol/messages.go b/protocol/messages.go index da7d70e..16b39a5 100644 --- a/protocol/messages.go +++ b/protocol/messages.go @@ -1,6 +1,6 @@ package protocol -import "github.com/iden3/iden3comm" +import "github.com/iden3/iden3comm/v2" const ( // MessageFetchRequestMessageType defines message fetch request type of the communication protocol. @@ -22,5 +22,5 @@ type MessageFetchRequestMessage struct { // MessageFetchRequestMessageBody is struct the represents body for message fetch request. type MessageFetchRequestMessageBody struct { - ID string `json:"id"` + ID string `json:"id"` } diff --git a/protocol/proof.go b/protocol/proof.go index 24d527d..09ca0f0 100644 --- a/protocol/proof.go +++ b/protocol/proof.go @@ -1,7 +1,7 @@ package protocol import ( - "github.com/iden3/iden3comm" + "github.com/iden3/iden3comm/v2" ) const ( diff --git a/protocol/revocation.go b/protocol/revocation.go index 72f25a3..7ffac0a 100644 --- a/protocol/revocation.go +++ b/protocol/revocation.go @@ -1,8 +1,8 @@ package protocol import ( - "github.com/iden3/go-schema-processor/verifiable" - "github.com/iden3/iden3comm" + "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/iden3comm/v2" ) const ( diff --git a/transport/notification/notification.go b/transport/notification/notification.go index d491566..9998819 100644 --- a/transport/notification/notification.go +++ b/transport/notification/notification.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/iden3/go-schema-processor/verifiable" + "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/pkg/errors" ) diff --git a/transport/notification/notification_test.go b/transport/notification/notification_test.go index 574e041..cda34a2 100644 --- a/transport/notification/notification_test.go +++ b/transport/notification/notification_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/iden3/go-schema-processor/verifiable" + "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/stretchr/testify/require" )