From fec1ecc8ac66a75aefaa36592d2466929b7ee30a Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 15 Sep 2023 17:16:42 +0300 Subject: [PATCH] fix tests --- auth_test.go | 76 +++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/auth_test.go b/auth_test.go index cf82ba4..4b01d44 100644 --- a/auth_test.go +++ b/auth_test.go @@ -99,7 +99,7 @@ func TestVerifyMessageWithSigProof_NonMerkalized(t *testing.T) { request := CreateAuthorizationRequestWithMessage(reason, "message to sign", verifierID, callbackURL) request.Body.Scope = append(request.Body.Scope, mtpProofRequest) - userID := "did:polygonid:polygon:mumbai:2qKzaaAewvBVv11iZjJZzjTxBQioZLEujPYTUJp7gQ" + userID := "did:polygonid:polygon:mumbai:2qESoaGFEnva4pPwsrAFBQVGDe9nWZjxnYPx9iZCmy" responseUUID := uuid.New() // response @@ -119,39 +119,39 @@ func TestVerifyMessageWithSigProof_NonMerkalized(t *testing.T) { ZKProof: types.ZKProof{ Proof: &types.ProofData{ A: []string{ - "14056228231956087288378518013493130710375131807243578639863710060510262038676", - "15685597096933930175890593905690244171450509041610585092210638200145586390285", + "2611057193079519143943574762976163751513297830204274538165209742319404560009", + "12788136479543687707691255840000266348710592817282837814793759907273190108832", "1", }, B: [][]string{ { - "6867891861795556838771075779522609255721689620651295420993290050538780283807", - "12803728874072821363624664338413776845757845422512289455246307343796729670516", + "10339668293932770774721966230711117475856552910519491964127539856759509764538", + "17964019159250915555109750373550416110000486687819674734837267280880888810242", }, { - "1556511867067742689232747109877739227261867306751037654148240512509806309140", - "3417379743049361186708759271231315501277403869916476403120965486647240758779", + "6499462520390702655745417048723495028623947635734919685001024458271017372928", + "4784939073830356747664613674202589008960041219476254033188324784531745896723", }, { "1", "0", }}, C: []string{ - "10569434133480072042978475540156042501239134571700053665222790798542811352807", - "16412506719218682682070660169432465369639644911994254460610287965570092298694", + "2984436813221912132373797933359320407850882135995712713500068095842517260060", + "14165028891749861878969723019325288416949269447664143825335627519902321505165", "1", }, Protocol: "groth16", }, PubSignals: []string{ "0", - "23556362286864724741858679466282977995723542763829611007300550436288008706", - "6488011081960287964570775172930943914920953982696735236025195378048754598764", + "21644443298494844652823233093669102266165833451013044961990306925134942722", + "17537800766613709234797664178634662536948999910610642067578271567408034578838", "84239", - "21803003425107230045260507608510138502859759480520560654156359021447614978", + "21348146785008049378057709592345376828473866675540022564894550180914532866", "1", - "6488011081960287964570775172930943914920953982696735236025195378048754598764", - "1693230616", + "17537800766613709234797664178634662536948999910610642067578271567408034578838", + "1694787248", "198285726510688200335207273836123338699", "1", "0", @@ -519,21 +519,19 @@ func TestVerifier_FullVerify_JWS(t *testing.T) { } func TestVerifyAuthResponseWithEmptyReq(t *testing.T) { - t.Skip("non-merklized claims are not supported") - verifierID := "did:polygonid:polygon:mumbai:2qEevY9VnKdNsVDdXRv3qSLHRqoMGMRRdE5Gmc6iA7" callbackURL := "https://test.com/callback" reason := "test" - userID := "did:polygonid:polygon:mumbai:2qD8Nsp4FQcdk1N3yhziquEBZGMXdVkKtBhtLdGnix" + userID := "did:polygonid:polygon:mumbai:2qCjgvM5XKq1dSxcaVD4tUPg84wHAGEfRAy6pnvL8J" var zkReq protocol.ZeroKnowledgeProofRequest - zkReq.ID = 23 + zkReq.ID = 84239 zkReq.CircuitID = string(circuits.AtomicQuerySigV2CircuitID) opt := true zkReq.Optional = &opt zkReq.Query = map[string]interface{}{ "allowedIssuers": []string{"*"}, - "context": "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld", + "context": "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-nonmerklized.jsonld", "type": "KYCAgeCredential", } @@ -544,7 +542,7 @@ func TestVerifyAuthResponseWithEmptyReq(t *testing.T) { // response resp := protocol.AuthorizationResponseMessage{ - ID: "1", + ID: "84239", Typ: "application/iden3comm-plain-json", Type: "https://iden3-communication.io/authorization/1.0/response", ThreadID: authReq.ThreadID, @@ -552,48 +550,48 @@ func TestVerifyAuthResponseWithEmptyReq(t *testing.T) { Message: "test", Scope: []protocol.ZeroKnowledgeProofResponse{ { - ID: 23, + ID: 84239, CircuitID: string(circuits.AtomicQuerySigV2CircuitID), ZKProof: types.ZKProof{ Proof: &types.ProofData{ A: []string{ - "9842063851166899357608339265674332708045063650629323669848120342194679808076", - "16206954115086409123668950271515758924555963980494493510855476478591822404827", + "12438986486122571189252917917494589996381439858584898996374967683395269730731", + "9412079662468735177603233699455634208465878005774236161008642218316734804796", "1", }, B: [][]string{ { - "5545535720422947171459387662245741010162970511259433941703524281908236057668", - "10561444885633079418413567831528236222511254998093130837955795587671392481895", + "12705378067840438230602790810116303665597242623604828384033131906209301383932", + "8051172734575096778884550333111728898496153961669774926620891253970840750743", }, { - "12832733708698041875897779399574055232051553662135872243100477516512773082967", - "9817420633398166811616613261515725671943907865363970047192668444892570410329", + "16749240419593841408185262492070297370295714176340637165233273033868360979018", + "2999000186136809474865219897229258765249288247905601316016410459032164165331", }, { "1", "0", }}, C: []string{ - "15730764089701951976631362836516364492331983136934339494373153516632793542908", - "6678992215432400449623605365468322210942926642059613422963275672866160988129", + "12139245376011507438715230756679171548416792518380038781634231898718436149353", + "5615427094043590964226038096439342195435404664699787454067611877169392904955", "1", }, Protocol: "groth16", }, PubSignals: []string{ "0", - "23280069646923371456510050373677752848804011824981226331232885668622242306", - "2943483356559152311923412925436024635269538717812859789851139200242297094", - "23", - "22064883246134712298411652505170593669589088931416964593351226206090301954", + "19643426216833902904490317766780826367730928250958458340547064713091289602", + "3684990652514203763871876082267216309378204238417321809966225547084716893577", + "84239", + "27434661371051334799078615742064517792049501374373415671506754318297010690", + "1", + "3684990652514203763871876082267216309378204238417321809966225547084716893577", + "1694785732", + "198285726510688200335207273836123338699", "1", - "2943483356559152311923412925436024635269538717812859789851139200242297094", - "1642074362", - "74977327600848231385663280181476307657", - "0", "0", - "2", + "6", "0", "0", "0", @@ -670,7 +668,7 @@ func TestVerifyAuthResponseWithEmptyReq(t *testing.T) { schemaLoader := &mockJSONLDSchemaLoader{ schemas: map[string]string{ - "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v2.json-ld": loadSchema("kyc-v2.json-ld"), + "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-nonmerklized.jsonld": loadSchema("kyc-nonmerklized.jsonld"), }, } authInstance, err := NewVerifier(verificationKeyloader, stateResolvers,