From a13bcf8f11287375abeacaa1de964522a614cee0 Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Mon, 9 Jan 2023 12:04:35 +0100 Subject: [PATCH] Added a test for multiple proofs --- .../org/oneedtech/inspect/vc/OB30Tests.java | 9 ++++ .../org/oneedtech/inspect/vc/Samples.java | 1 + .../ob30/simple-multiple-proofs.json | 51 +++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 inspector-vc/src/test/resources/ob30/simple-multiple-proofs.json diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB30Tests.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB30Tests.java index e98e6c8..53d2198 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB30Tests.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB30Tests.java @@ -52,6 +52,15 @@ public class OB30Tests { }); } + @Test + void testSimpleMultipleProofsJsonValid() { + assertDoesNotThrow(()->{ + Report report = validator.run(Samples.OB30.JSON.SIMPLE_MULTIPLE_PROOF_JSON.asFileResource()); + if(verbose) PrintHelper.print(report, true); + assertValid(report); + }); + } + @Test void testSimplePNGPlainValid() { assertDoesNotThrow(()->{ diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java index c0ebdf8..b9f9d8a 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java @@ -12,6 +12,7 @@ public class Samples { public final static Sample COMPLETE_JSON = new Sample("ob30/complete.json", false); public final static Sample SIMPLE_JSON = new Sample("ob30/simple.json", true); public final static Sample SIMPLE_DID_METHOD_JSON = new Sample("ob30/simple-did-method.json", true); + public final static Sample SIMPLE_MULTIPLE_PROOF_JSON = new Sample("ob30/simple-multiple-proofs.json", true); public final static Sample SIMPLE_JSON_NOPROOF = new Sample("ob30/simple-noproof.json", false); public final static Sample SIMPLE_JSON_UNKNOWN_TYPE = new Sample("ob30/simple-err-type.json", false); public final static Sample SIMPLE_JSON_UNKNOWN_CREDENTIAL_SUBJECT_TYPE = new Sample("ob30/simple-err-credential-subject-type.json", false); diff --git a/inspector-vc/src/test/resources/ob30/simple-multiple-proofs.json b/inspector-vc/src/test/resources/ob30/simple-multiple-proofs.json new file mode 100644 index 0000000..d539520 --- /dev/null +++ b/inspector-vc/src/test/resources/ob30/simple-multiple-proofs.json @@ -0,0 +1,51 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://purl.imsglobal.org/spec/ob/v3p0/context.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "id": "http://example.com/credentials/3527", + "type": [ + "VerifiableCredential", + "OpenBadgeCredential" + ], + "issuer": { + "id": "https://example.com/issuers/876543", + "type": [ + "Profile" + ], + "name": "Example Corp" + }, + "issuanceDate": "2010-01-01T00:00:00Z", + "name": "Teamwork Badge", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "type": [ + "AchievementSubject" + ], + "achievement": { + "id": "https://example.com/achievements/21st-century-skills/teamwork", + "type": [ + "Achievement" + ], + "criteria": { + "narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management." + }, + "description": "This badge recognizes the development of the capacity to collaborate within a group environment.", + "name": "Teamwork" + } + }, + "proof": [{ + "type": "SomeProofType", + "created": "2022-11-16T18:54:22Z", + "proofPurpose": "assertionMethod" + }, + { + "type": "Ed25519Signature2020", + "created": "2022-11-16T18:54:22Z", + "verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv", + "proofPurpose": "assertionMethod", + "proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK" + } + ] +} \ No newline at end of file