From 746300ab425f3d7f07ea952a908e6d60ca9b90f1 Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Fri, 2 Dec 2022 11:29:09 +0100 Subject: [PATCH] Added basic jws test --- .../src/test/java/org/oneedtech/inspect/vc/Samples.java | 4 ++++ .../src/test/resources/ob20/assets/beths-robot-work.html | 0 inspector-vc/src/test/resources/ob20/assets/key1.json | 7 +++++++ .../src/test/resources/ob20/assets/organization.json | 3 ++- inspector-vc/src/test/resources/ob20/basic-assertion.json | 1 + inspector-vc/src/test/resources/ob20/simple.jwt | 1 + inspector-vc/src/test/resources/ob30/simple.jwt | 2 +- 7 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 inspector-vc/src/test/resources/ob20/assets/beths-robot-work.html create mode 100644 inspector-vc/src/test/resources/ob20/assets/key1.json create mode 100644 inspector-vc/src/test/resources/ob20/simple.jwt 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 a07ff01..6de1cba 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 @@ -59,5 +59,9 @@ public class Samples { // original: test_verify: test_verify_of_baked_image public final static Sample SIMPLE_JSON_PNG = new Sample("ob20/simple-badge.png", true); } + + public static final class JWT { + public final static Sample SIMPLE_JWT = new Sample("ob20/simple.jwt", true); + } } } diff --git a/inspector-vc/src/test/resources/ob20/assets/beths-robot-work.html b/inspector-vc/src/test/resources/ob20/assets/beths-robot-work.html new file mode 100644 index 0000000..e69de29 diff --git a/inspector-vc/src/test/resources/ob20/assets/key1.json b/inspector-vc/src/test/resources/ob20/assets/key1.json new file mode 100644 index 0000000..b37cf80 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/assets/key1.json @@ -0,0 +1,7 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "id": "http://example.org/key1.json", + "type": "CryptographicKey", + "owner": "https://example.org/organization.json", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq/tyy5CGrCVfGIMrMkVq\nZ5cAKkbLdrNrNFvXNMSazvKj/9VmuALZOjqXl1Od/Ku6q+18sn70p6r25kGRoaU/\nAJNLt36EnRSs9I66xZ3tOY4c9PeWpMC1XbCrUBh1rpx7XQ5wULOMbttEvBf9V2Cl\nCGiNqwqcafrQHoYteAtF4d2zcjNm+xZRQmnVU0CdvXSXeniWjqyif/751/M/xb93\nfeF1AIFS5IGaI1cWca7BG2izKz1DjZxbMlvQVZk1Axz2Uj/FXssyBKmAdCw4EjuF\nqinQBmKwmFvCB3yhMAK6+f1k4hsR/ET/PxwkNQZfu+gkmEAQoYAMSPgGS3xY3LVf\nxwIDAQAB\n-----END PUBLIC KEY-----" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/assets/organization.json b/inspector-vc/src/test/resources/ob20/assets/organization.json index 559a120..1ae00aa 100644 --- a/inspector-vc/src/test/resources/ob20/assets/organization.json +++ b/inspector-vc/src/test/resources/ob20/assets/organization.json @@ -4,5 +4,6 @@ "id": "https://example.org/organization.json", "name": "An Example Badge Issuer", "url": "https://example.org", - "email": "contact@example.org" + "email": "contact@example.org", + "publicKey": "http://example.org/key1.json" } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/basic-assertion.json b/inspector-vc/src/test/resources/ob20/basic-assertion.json index 6811b7b..69963d6 100644 --- a/inspector-vc/src/test/resources/ob20/basic-assertion.json +++ b/inspector-vc/src/test/resources/ob20/basic-assertion.json @@ -9,6 +9,7 @@ "identity": "sha256$ecf5409f3f4b91ab60cc5ef4c02aef7032354375e70cf4d8e43f6a1d29891942" }, "image": "https://example.org/beths-robot-badge.png", + "evidence": "https://example.org/beths-robot-work.html", "issuedOn": "2016-12-31T23:59:59Z", "badge": "https://example.org/robotics-badge.json", "verification": { diff --git a/inspector-vc/src/test/resources/ob20/simple.jwt b/inspector-vc/src/test/resources/ob20/simple.jwt new file mode 100644 index 0000000..b02bac2 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/simple.jwt @@ -0,0 +1 @@ +eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJAY29udGV4dCI6Imh0dHBzOi8vdzNpZC5vcmcvb3BlbmJhZGdlcy92MiIsInR5cGUiOiJBc3NlcnRpb24iLCJpZCI6Imh0dHBzOi8vZXhhbXBsZS5vcmcvYmV0aHMtcm9ib3RpY3MtYmFkZ2UuanNvbiIsInJlY2lwaWVudCI6eyJ0eXBlIjoiZW1haWwiLCJoYXNoZWQiOnRydWUsInNhbHQiOiJkZWFkc2VhIiwiaWRlbnRpdHkiOiJzaGEyNTYkZWNmNTQwOWYzZjRiOTFhYjYwY2M1ZWY0YzAyYWVmNzAzMjM1NDM3NWU3MGNmNGQ4ZTQzZjZhMWQyOTg5MTk0MiJ9LCJpbWFnZSI6Imh0dHBzOi8vZXhhbXBsZS5vcmcvYmV0aHMtcm9ib3QtYmFkZ2UucG5nIiwiZXZpZGVuY2UiOiJodHRwczovL2V4YW1wbGUub3JnL2JldGhzLXJvYm90LXdvcmsuaHRtbCIsImlzc3VlZE9uIjoiMjAxNi0xMi0zMVQyMzo1OTo1OVoiLCJiYWRnZSI6Imh0dHBzOi8vZXhhbXBsZS5vcmcvcm9ib3RpY3MtYmFkZ2UuanNvbiIsInZlcmlmaWNhdGlvbiI6eyJ0eXBlIjoic2lnbmVkIiwiY3JlYXRvciI6Imh0dHA6Ly9leGFtcGxlLm9yZy9rZXkxLmpzb24ifX0.i2aO8rusbEupHysBBgxZpZBMtLHrGGI2l3Qi-OLxfV20YlD_yRUAVi5D98NyQZsTmHXrvG9x9VCki60ksQqr5vImplKpaq6k4OkvL8VdAt_y6MLD9w-2dTtpgfRFHnWvXcVwImrllUU5wZ1SHAikEpRhAX6Z3BbGvJOo2liCk4g16NazpItLACfKxrNeNMi9vOOyZ3ztBProePa6nQB8ysy7qAQetBioZM17Umm4RjpHkil33PHwkVHndx74rdaUoMcc6mNy7nv_ddEi1l4mK1La9xb62KyXuQKCE1Wj6UzsjTh2wPo-ISzjEJQcY1Ge5-PcrPk35ZQpqDxJyyWaBA \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob30/simple.jwt b/inspector-vc/src/test/resources/ob30/simple.jwt index 6f64aad..41540b1 100644 --- a/inspector-vc/src/test/resources/ob30/simple.jwt +++ b/inspector-vc/src/test/resources/ob30/simple.jwt @@ -1 +1 @@ -eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vaW1zZ2xvYmFsLmdpdGh1Yi5pby9vcGVuYmFkZ2VzLXNwZWNpZmljYXRpb24vY29udGV4dC5qc29uIl0sImlkIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiT3BlbkJhZGdlQ3JlZGVudGlhbCJdLCJpc3N1ZXIiOnsiaWQiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwidHlwZSI6WyJQcm9maWxlIl0sIm5hbWUiOiJFeGFtcGxlIFVuaXZlcnNpdHkifSwiaXNzdWFuY2VEYXRlIjoiMjAxMC0wMS0wMVQwMDowMDowMFoiLCJuYW1lIjoiRXhhbXBsZSBVbml2ZXJzaXR5IERlZ3JlZSIsImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmV4YW1wbGU6ZWJmZWIxZjcxMmViYzZmMWMyNzZlMTJlYzIxIiwidHlwZSI6WyJBY2hpZXZlbWVudFN1YmplY3QiXX19LCJpc3MiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwibmJmIjoxMjYyMzA0M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