Skip to content

Commit

Permalink
merge main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
olomix committed Jul 12, 2023
2 parents 699ad39 + 0200e3b commit cb8aecd
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 56 deletions.
5 changes: 1 addition & 4 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/google/uuid"
"github.com/iden3/contracts-abi/state/go/abi"
"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/go-schema-processor/v2/merklize"
"github.com/iden3/go-schema-processor/v2/verifiable"
"github.com/iden3/iden3comm/v2"
"github.com/iden3/iden3comm/v2/packers"
"github.com/iden3/iden3comm/v2/protocol"
shell "github.com/ipfs/go-ipfs-api"
Expand Down Expand Up @@ -334,7 +331,7 @@ func (v *Verifier) VerifyAuthResponse(
rawMessage = nil
}

err = cv.VerifyQuery(ctx, query, v.documentLoader, rawMessage)
err = cv.VerifyQuery(ctx, query, v.documentLoader, rawMessage, opts...)
if err != nil {
return err
}
Expand Down
16 changes: 12 additions & 4 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/big"
"os"
"testing"
"time"

"github.com/google/uuid"
"github.com/iden3/go-circuits/v2"
Expand Down Expand Up @@ -62,6 +63,8 @@ var stateResolvers = map[string]pubsignals.StateResolver{
"polygon:mumbai": &mockStateResolver{},
}

const proofGenerationDelay = time.Hour * 100000

type mockStateResolver struct {
}

Expand Down Expand Up @@ -401,7 +404,7 @@ func TestVerifyMessageWithMTPProof_Merkalized(t *testing.T) {
authInstance, err := NewVerifier(verificationKeyloader, stateResolvers,
WithDocumentLoader(schemaLoader))
require.NoError(t, err)
err = authInstance.VerifyAuthResponse(context.Background(), message, request)
err = authInstance.VerifyAuthResponse(context.Background(), message, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
schemaLoader.assert(t)
}
Expand Down Expand Up @@ -461,7 +464,7 @@ func TestVerifier_FullVerify(t *testing.T) {
authInstance, err := NewVerifier(verificationKeyloader, stateResolvers,
WithDocumentLoader(schemaLoader))
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
schemaLoader.assert(t)
}
Expand Down Expand Up @@ -511,8 +514,13 @@ func TestVerifier_FullVerify_JWS(t *testing.T) {
WithDocumentLoader(schemaLoader),
WithDIDResolver(mockedResolver))
require.NoError(t, err)
<<<<<<< HEAD

_, err = v.FullVerify(context.Background(), token, request)
=======
v.SetPackageManager(pm)
_, err = v.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
>>>>>>> main
require.NoError(t, err)

schemaLoader.assert(t)
Expand Down Expand Up @@ -745,7 +753,7 @@ func TestVerifier_FullVerifySelectiveDisclosure(t *testing.T) {
authInstance, err := NewVerifier(verificationKeyloader, stateResolvers,
WithDocumentLoader(schemaLoader))
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
schemaLoader.assert(t)
}
Expand Down Expand Up @@ -781,7 +789,7 @@ func TestEmptyCredentialSubject(t *testing.T) {
authInstance, err := NewVerifier(verificationKeyloader, stateResolvers,
WithDocumentLoader(schemaLoader))
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)

schemaLoader.assert(t)
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/iden3/contracts-abi/state/go/abi v1.0.0-beta.3
github.com/iden3/go-circuits/v2 v2.0.0-20230519130224-2f1dac1ae3f8
github.com/iden3/go-iden3-core/v2 v2.0.0-20230519124718-42b31ff46f37
github.com/iden3/go-jwz/v2 v2.0.0-20230519132540-75b6744028b1
github.com/iden3/go-rapidsnark/types v0.0.3
github.com/iden3/go-rapidsnark/verifier v0.0.5
github.com/iden3/go-schema-processor/v2 v2.0.0-20230706160026-132b2d90334c
Expand All @@ -22,7 +21,7 @@ require (
)

require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/btcsuite/btcd v0.23.3 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
Expand All @@ -39,13 +38,14 @@ require (
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
github.com/iden3/go-jwz/v2 v2.0.0-20230519132540-75b6744028b1 // indirect
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/witness v0.0.6 // indirect
github.com/iden3/wasmer-go v0.0.1 // indirect
github.com/ipfs/boxo v0.8.0 // indirect
github.com/ipfs/go-cid v0.4.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/ipfs/go-cid v0.4.1 // 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
Expand All @@ -54,16 +54,16 @@ require (
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.3 // indirect
github.com/minio/sha256-simd v1.0.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/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.8.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.8.1 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.2 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -75,10 +75,10 @@ require (
github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect
github.com/yusufpapurcu/wmi v1.2.2 // 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
golang.org/x/sys v0.8.0 // indirect
google.golang.org/protobuf v1.30.0 // 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/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
)
Loading

0 comments on commit cb8aecd

Please sign in to comment.