forked from credebl/credo-controller
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:Bhutan-NDI/ngotag-agent-controller …
…into pipeline-implementation
- Loading branch information
Showing
10 changed files
with
465 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
patches/@credo-ts+core+0.5.3+001+debug-core-abandon-issue.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
diff --git a/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js b/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
index 80acfe9..a92f41a 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
@@ -69,11 +69,14 @@ let DifPresentationExchangeService = class DifPresentationExchangeService { | ||
} | ||
} | ||
validatePresentation(presentationDefinition, presentation) { | ||
+ console.log("inside validate presentaion DifPresentationExchangeService.js:: presentationDefinition " , presentationDefinition) | ||
+ console.log("inside validate presentaion DifPresentationExchangeService.js:: presentation " , presentation) | ||
const { errors } = this.pex.evaluatePresentation(presentationDefinition, (0, utils_2.getSphereonOriginalVerifiablePresentation)(presentation), { | ||
limitDisclosureSignatureSuites: ['BbsBlsSignatureProof2020', 'DataIntegrityProof.anoncreds-2023'], | ||
}); | ||
if (errors) { | ||
const errorMessages = this.formatValidated(errors); | ||
+ console.log("inside validatePresentation DifPresentationExchangeService.js errors ::" ,errorMessages ) | ||
if (errorMessages.length > 0) { | ||
throw new DifPresentationExchangeError_1.DifPresentationExchangeError(`Invalid presentation`, { additionalMessages: errorMessages }); | ||
} | ||
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
index 006d870..0b086e5 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
@@ -170,6 +170,7 @@ class DifPresentationExchangeProofFormatService { | ||
try { | ||
ps.validatePresentationDefinition(request.presentation_definition); | ||
ps.validatePresentationSubmission(jsonPresentation.presentation_submission); | ||
+ console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: request.presentation_definition" , request.presentation_definition ) | ||
ps.validatePresentation(request.presentation_definition, parsedPresentation); | ||
let verificationResult; | ||
// FIXME: for some reason it won't accept the input if it doesn't know | ||
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/ProofFormatCoordinator.js b/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/ProofFormatCoordinator.js | ||
index 83277c5..c749043 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/ProofFormatCoordinator.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/ProofFormatCoordinator.js | ||
@@ -263,6 +263,7 @@ class ProofFormatCoordinator { | ||
formatVerificationResults.push(isValid); | ||
} | ||
catch (error) { | ||
+ console.log("inside processPresentation catch block of ProofFormatCoordinator.js :: error" ,error) | ||
return { | ||
message: error.message, | ||
isValid: false, | ||
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/V2ProofProtocol.js b/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/V2ProofProtocol.js | ||
index 382c097..e147559 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/V2ProofProtocol.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/proofs/protocol/v2/V2ProofProtocol.js | ||
@@ -513,6 +513,7 @@ class V2ProofProtocol extends BaseProofProtocol_1.BaseProofProtocol { | ||
message: presentationMessage, | ||
}); | ||
proofRecord.isVerified = result.isValid; | ||
+ console.log("inside V2ProofProtocol.js result::" , result) | ||
if (result.isValid) { | ||
await this.updateState(messageContext.agentContext, proofRecord, models_2.ProofState.PresentationReceived); | ||
} |
14 changes: 14 additions & 0 deletions
14
patches/@credo-ts+core+0.5.3+003+log presentation and request to debug pex issue.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
index 0b086e5..69000f6 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
@@ -170,7 +170,8 @@ class DifPresentationExchangeProofFormatService { | ||
try { | ||
ps.validatePresentationDefinition(request.presentation_definition); | ||
ps.validatePresentationSubmission(jsonPresentation.presentation_submission); | ||
- console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: request.presentation_definition" , request.presentation_definition ) | ||
+ console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: request", JSON.stringify(request, null, 2)) | ||
+ console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: jsonPresentation", JSON.stringify(jsonPresentation, null, 2)) | ||
ps.validatePresentation(request.presentation_definition, parsedPresentation); | ||
let verificationResult; | ||
// FIXME: for some reason it won't accept the input if it doesn't know |
29 changes: 29 additions & 0 deletions
29
...@credo-ts+core+0.5.3+004+commenting validationPresentation to avoid abandoned issue.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js b/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
index a92f41a..9fee65c 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js | ||
@@ -69,8 +69,6 @@ let DifPresentationExchangeService = class DifPresentationExchangeService { | ||
} | ||
} | ||
validatePresentation(presentationDefinition, presentation) { | ||
- console.log("inside validate presentaion DifPresentationExchangeService.js:: presentationDefinition " , presentationDefinition) | ||
- console.log("inside validate presentaion DifPresentationExchangeService.js:: presentation " , presentation) | ||
const { errors } = this.pex.evaluatePresentation(presentationDefinition, (0, utils_2.getSphereonOriginalVerifiablePresentation)(presentation), { | ||
limitDisclosureSignatureSuites: ['BbsBlsSignatureProof2020', 'DataIntegrityProof.anoncreds-2023'], | ||
}); | ||
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
index 69000f6..501bd61 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
+++ b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js | ||
@@ -170,9 +170,8 @@ class DifPresentationExchangeProofFormatService { | ||
try { | ||
ps.validatePresentationDefinition(request.presentation_definition); | ||
ps.validatePresentationSubmission(jsonPresentation.presentation_submission); | ||
- console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: request", JSON.stringify(request, null, 2)) | ||
- console.log("inside processPresentation of DifPresentationExchangeProofFormatService.js :: jsonPresentation", JSON.stringify(jsonPresentation, null, 2)) | ||
- ps.validatePresentation(request.presentation_definition, parsedPresentation); | ||
+ // FIXME: Commenting validatePresentation() for now due to intermittent abandoned issue. | ||
+ // ps.validatePresentation(request.presentation_definition, parsedPresentation); | ||
let verificationResult; | ||
// FIXME: for some reason it won't accept the input if it doesn't know | ||
// whether it's a JWT or JSON-LD VP even though the input is the same. |
42 changes: 42 additions & 0 deletions
42
patches/@sphereon+pex+3.3.3+001+proof-abandon-pex-patch.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
diff --git a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
index 728096f..b035d3c 100644 | ||
--- a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
+++ b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
@@ -19,6 +19,8 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
return 'UriEvaluation'; | ||
} | ||
handle(definition, wrappedVcs) { | ||
+ console.log("definition::" ,JSON.stringify(definition,null,2)) | ||
+ console.log("wrappedVcs" , JSON.stringify(wrappedVcs,null,2)) | ||
var _a, _b, _c; | ||
// This filter is removed in V2 | ||
definition.input_descriptors.forEach((inDesc, descriptorIdx) => { | ||
@@ -32,6 +34,7 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
const descriptorMap = this.getResults() | ||
.filter((result) => result.status === ConstraintUtils_1.Status.INFO) | ||
.map((result) => { | ||
+ console.log(" inside handle function of uriEvaluationHandler.js :: result,", result) | ||
var _a, _b, _c, _d; | ||
let format = (_a = result.payload) === null || _a === void 0 ? void 0 : _a.format; | ||
// This checks if the new data integrity format should be used. | ||
@@ -56,13 +59,20 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
format = 'di_vc'; | ||
} | ||
} | ||
+ | ||
+ console.log("jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0]::", JSON.stringify(jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0],null,2)) | ||
+ console.log("jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value::", JSON.stringify(jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value,null,2)) | ||
+ | ||
const inputDescriptor = jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value; | ||
+ | ||
+ | ||
return { | ||
id: inputDescriptor.id, | ||
format, | ||
path: result.verifiable_credential_path, | ||
}; | ||
}); | ||
+ | ||
// The presentation submission is being created in this handler, then updated in subsequent handler. | ||
// TODO: This approach needs to be refactored for a new Major version. | ||
// Also there is no apparent need for the indirection and state in this class. |
34 changes: 34 additions & 0 deletions
34
patches/@sphereon+pex+3.3.3+002+pex library debugging.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
index b035d3c..185ccef 100644 | ||
--- a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
+++ b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
@@ -31,10 +31,12 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
}); | ||
}); | ||
const definitionAllowsDataIntegrity = ((_a = definition.format) === null || _a === void 0 ? void 0 : _a.di) || ((_b = definition.format) === null || _b === void 0 ? void 0 : _b.di_vc) || ((_c = definition.format) === null || _c === void 0 ? void 0 : _c.di_vp); | ||
- const descriptorMap = this.getResults() | ||
- .filter((result) => result.status === ConstraintUtils_1.Status.INFO) | ||
+ const results = this.getResults(); | ||
+ console.log("results from getResults() :::", JSON.stringify(results, null, 2)); | ||
+ | ||
+ const descriptorMap = results.filter((result) => result.status === ConstraintUtils_1.Status.INFO) | ||
.map((result) => { | ||
- console.log(" inside handle function of uriEvaluationHandler.js :: result,", result) | ||
+ console.log("inside handle function of uriEvaluationHandler.js :: result,", JSON.stringify(result, null, 2)); | ||
var _a, _b, _c, _d; | ||
let format = (_a = result.payload) === null || _a === void 0 ? void 0 : _a.format; | ||
// This checks if the new data integrity format should be used. | ||
@@ -60,12 +62,9 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
} | ||
} | ||
|
||
- console.log("jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0]::", JSON.stringify(jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0],null,2)) | ||
- console.log("jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value::", JSON.stringify(jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value,null,2)) | ||
- | ||
+ console.log("searching input_descriptor_path in definition :: jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)::", JSON.stringify(result.input_descriptor_path,null,2)) | ||
const inputDescriptor = jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value; | ||
|
||
- | ||
return { | ||
id: inputDescriptor.id, | ||
format, |
48 changes: 48 additions & 0 deletions
48
patches/@sphereon+pex+3.3.3+003+debug logs in pex library.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
diff --git a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
index 52d0666..0a1c997 100644 | ||
--- a/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
+++ b/node_modules/@sphereon/pex/dist/main/lib/evaluation/handlers/uriEvaluationHandler.js | ||
@@ -19,13 +19,15 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
return 'UriEvaluation'; | ||
} | ||
handle(definition, wrappedVcs) { | ||
- console.log("definition::" ,JSON.stringify(definition,null,2)) | ||
- console.log("wrappedVcs" , JSON.stringify(wrappedVcs,null,2)) | ||
+ console.log("In handle :: definition :: " ,JSON.stringify(definition,null,2)) | ||
+ console.log("In handle :: wrappedVcs :: " , JSON.stringify(wrappedVcs,null,2)) | ||
var _a, _b, _c; | ||
// This filter is removed in V2 | ||
definition.input_descriptors.forEach((inDesc, descriptorIdx) => { | ||
+ console.log("In handle :: descriptorIdx :: " , descriptorIdx) | ||
const uris = definition.getVersion() !== types_1.PEVersion.v2 ? inDesc.schema.map((so) => so.uri) : []; | ||
wrappedVcs.forEach((wvc, wrappedVCIdx) => { | ||
+ console.log("In handle :: wrappedVCIdx ::" , wrappedVCIdx) | ||
const vcUris = UriEvaluationHandler.buildVcContextAndSchemaUris(wvc.credential, definition.getVersion()); | ||
this.evaluateUris(wvc, vcUris, uris, descriptorIdx, wrappedVCIdx, definition.getVersion()); | ||
}); | ||
@@ -62,6 +64,7 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
} | ||
} | ||
|
||
+ console.log('In handle End :: definition ::: ', JSON.stringify(definition, null, 2)); | ||
console.log("searching input_descriptor_path in definition :: jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)::", JSON.stringify(result.input_descriptor_path,null,2)) | ||
const inputDescriptor = jsonpath_1.JSONPath.nodes(definition, result.input_descriptor_path)[0].value; | ||
|
||
@@ -102,6 +105,8 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
hasAnyMatch = true; | ||
} | ||
if (hasAnyMatch) { | ||
+ console.log('In evaluateUris :: idIdx ::',idIdx); | ||
+ console.log('In evaluateUris :: vcIdx ::',vcIdx); | ||
this.getResults().push(this.createSuccessResultObject(wvc, inputDescriptorsUris, idIdx, vcIdx)); | ||
} | ||
else { | ||
@@ -175,6 +180,8 @@ class UriEvaluationHandler extends abstractEvaluationHandler_1.AbstractEvaluatio | ||
return result; | ||
} | ||
createResult(idIdx, vcIdx) { | ||
+ console.log('In createResult :: idIdx ::',idIdx); | ||
+ console.log('In createResult :: vcIdx ::',vcIdx); | ||
return { | ||
input_descriptor_path: `$.input_descriptors[${idIdx}]`, | ||
verifiable_credential_path: `$[${vcIdx}]`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.