Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/vc api test suite compliance #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 69 additions & 31 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/blockchain-certificates/cvjs-docker#readme",
"dependencies": {
"@blockcerts/cert-verifier-js": "^6.22.1",
"@blockcerts/cert-verifier-js": "^6.25.0",
"body-parser": "^1.20.2",
"express": "^4.18.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/init-cert-verifier-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async function initCertVerifierJs (req: Request<{}, {}, APIPaylo
message: e.message,
error: JSON.stringify(e.stack, null, 2),
status: VERIFICATION_STATUSES.FAILURE,
statusCode: 200
statusCode: 422
}
}
}
6 changes: 6 additions & 0 deletions test/assertions/failing-signature-cert-verified-steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
{
"proofType": "MerkleProof2019",
"subSteps": [
{
"code": "assertProofValidity",
"label": "Asserting proof purpose",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "getTransactionId",
"status": "success",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,77 @@
[{"code": "formatValidation", "isLast": false, "label": "Format validation", "labelPending": "Validating format", "status": "success", "subSteps": [{"code": "validateDateFormat", "label": "Validating date format", "parentStep": "formatValidation", "status": "success"}]}, {"code": "proofVerification", "isLast": false, "label": "Proof Verification", "labelPending": "Verifying Proof", "status": "success", "subSteps": [], "suites": [{"proofType": "MerkleProof2019", "subSteps": [{"code": "computeLocalHash", "label": "Computing local hash", "parentStep": "proofVerification", "status": "success"}, {"code": "compareHashes", "label": "Comparing hashes", "parentStep": "proofVerification", "status": "success"}, {"code": "checkReceipt", "label": "Checking Receipt", "parentStep": "proofVerification", "status": "success"}]}]}, {"code": "statusCheck", "isLast": true, "label": "Status check", "labelPending": "Checking record status", "status": "success", "subSteps": [{"code": "checkRevokedStatus", "label": "Checking Revoked Status", "parentStep": "statusCheck", "status": "success"}, {"code": "checkExpiresDate", "label": "Checking Expiration Date", "parentStep": "statusCheck", "status": "success"}]}]
[
{
"code": "formatValidation",
"isLast": false,
"label": "Format validation",
"labelPending": "Validating format",
"status": "success",
"subSteps": [
{
"code": "validateDateFormat",
"label": "Validating date format",
"parentStep": "formatValidation",
"status": "success"
}
]
},
{
"code": "proofVerification",
"isLast": false,
"label": "Proof Verification",
"labelPending": "Verifying Proof",
"status": "success",
"subSteps": [],
"suites": [
{
"proofType": "MerkleProof2019",
"subSteps": [
{
"code": "assertProofValidity",
"label": "Asserting proof purpose",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "computeLocalHash",
"label": "Computing local hash",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "compareHashes",
"label": "Comparing hashes",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "checkReceipt",
"label": "Checking Receipt",
"parentStep": "proofVerification",
"status": "success"
}
]
}
]
},
{
"code": "statusCheck",
"isLast": true,
"label": "Status check",
"labelPending": "Checking record status",
"status": "success",
"subSteps": [
{
"code": "checkRevokedStatus",
"label": "Checking Revoked Status",
"parentStep": "statusCheck",
"status": "success"
},
{
"code": "checkExpiresDate",
"label": "Checking Expiration Date",
"parentStep": "statusCheck",
"status": "success"
}
]
}
]
6 changes: 6 additions & 0 deletions test/assertions/multiple-signature-cert-verified-steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
{
"proofType": "MerkleProof2019",
"subSteps": [
{
"code": "assertProofValidity",
"label": "Asserting proof purpose",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "computeLocalHash",
"status": "success",
Expand Down
6 changes: 6 additions & 0 deletions test/assertions/single-signature-cert-verified-steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
{
"proofType": "MerkleProof2019",
"subSteps": [
{
"code": "assertProofValidity",
"label": "Asserting proof purpose",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "getTransactionId",
"label": "Getting transaction ID",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,77 @@
[{"code": "formatValidation", "isLast": false, "label": "Format validation", "labelPending": "Validating format", "status": "success", "subSteps": [{"code": "validateDateFormat", "label": "Validating date format", "parentStep": "formatValidation", "status": "success"}]}, {"code": "proofVerification", "isLast": false, "label": "Proof Verification", "labelPending": "Verifying Proof", "status": "success", "subSteps": [], "suites": [{"proofType": "MerkleProof2019", "subSteps": [{"code": "computeLocalHash", "label": "Computing local hash", "parentStep": "proofVerification", "status": "success"}, {"code": "compareHashes", "label": "Comparing hashes", "parentStep": "proofVerification", "status": "success"}, {"code": "checkReceipt", "label": "Checking Receipt", "parentStep": "proofVerification", "status": "success"}]}]}, {"code": "statusCheck", "isLast": true, "label": "Status check", "labelPending": "Checking record status", "status": "success", "subSteps": [{"code": "checkRevokedStatus", "label": "Checking Revoked Status", "parentStep": "statusCheck", "status": "success"}, {"code": "checkExpiresDate", "label": "Checking Expiration Date", "parentStep": "statusCheck", "status": "success"}]}]
[
{
"code": "formatValidation",
"isLast": false,
"label": "Format validation",
"labelPending": "Validating format",
"status": "success",
"subSteps": [
{
"code": "validateDateFormat",
"label": "Validating date format",
"parentStep": "formatValidation",
"status": "success"
}
]
},
{
"code": "proofVerification",
"isLast": false,
"label": "Proof Verification",
"labelPending": "Verifying Proof",
"status": "success",
"subSteps": [],
"suites": [
{
"proofType": "MerkleProof2019",
"subSteps": [
{
"code": "assertProofValidity",
"label": "Asserting proof purpose",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "computeLocalHash",
"label": "Computing local hash",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "compareHashes",
"label": "Comparing hashes",
"parentStep": "proofVerification",
"status": "success"
},
{
"code": "checkReceipt",
"label": "Checking Receipt",
"parentStep": "proofVerification",
"status": "success"
}
]
}
]
},
{
"code": "statusCheck",
"isLast": true,
"label": "Status check",
"labelPending": "Checking record status",
"status": "success",
"subSteps": [
{
"code": "checkRevokedStatus",
"label": "Checking Revoked Status",
"parentStep": "statusCheck",
"status": "success"
},
{
"code": "checkExpiresDate",
"label": "Checking Expiration Date",
"parentStep": "statusCheck",
"status": "success"
}
]
}
]
4 changes: 4 additions & 0 deletions test/contract/basic-verification.test.docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('basic verification docker endpoint test suite', function () {

expect(output).toEqual({
checks: [
"assertProofValidity",
"getTransactionId",
"computeLocalHash",
"fetchRemoteHash",
Expand Down Expand Up @@ -56,6 +57,7 @@ describe('basic verification docker endpoint test suite', function () {

expect(output).toEqual({
checks: [
"assertProofValidity",
"getTransactionId",
"computeLocalHash",
"fetchRemoteHash"
Expand All @@ -81,6 +83,7 @@ describe('basic verification docker endpoint test suite', function () {

expect(output).toEqual({
checks: [
"assertProofValidity",
"computeLocalHash",
"compareHashes",
"checkReceipt",
Expand Down Expand Up @@ -113,6 +116,7 @@ describe('basic verification docker endpoint test suite', function () {

expect(output).toEqual({
checks: [
"assertProofValidity",
"computeLocalHash",
"compareHashes",
"checkReceipt",
Expand Down
2 changes: 2 additions & 0 deletions test/contract/verbose-verification.test.docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe('verbose verification docker endpoint test suite', function () {

it('should expose the checks array to conform with VC-API', function () {
expect(output.checks).toEqual([
"assertProofValidity",
"getTransactionId",
"computeLocalHash",
"fetchRemoteHash",
Expand Down Expand Up @@ -167,6 +168,7 @@ describe('verbose verification docker endpoint test suite', function () {

it('should expose the checks array to conform with VC-API', function () {
expect(output.checks).toEqual([
"assertProofValidity",
"getTransactionId",
"computeLocalHash",
"fetchRemoteHash"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('verbose verification docker endpoint test suite', function () {

it('should expose the checks array to conform with VC-API', function () {
expect(output.checks).toEqual([
"assertProofValidity",
"computeLocalHash",
"compareHashes",
"checkReceipt",
Expand Down Expand Up @@ -155,6 +156,7 @@ describe('verbose verification docker endpoint test suite', function () {

it('should expose the checks array to conform with VC-API', function () {
expect(output.checks).toEqual([
"assertProofValidity",
"computeLocalHash",
"compareHashes",
"checkReceipt",
Expand Down