diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VCInspector.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VCInspector.java index 60dd4ac..859892c 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VCInspector.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VCInspector.java @@ -3,11 +3,9 @@ package org.oneedtech.inspect.vc; import static java.util.stream.Collectors.toList; import static org.oneedtech.inspect.vc.util.JsonNodeUtil.asStringList; -import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.Set; import java.util.Spliterators; import java.util.stream.Collectors; import java.util.stream.StreamSupport; @@ -142,5 +140,9 @@ public abstract class VCInspector extends Inspector { probes.add(probe); return this; } + + public List> getProbes() { + return probes; + } } } \ No newline at end of file diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/IronTests.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/IronTests.java index 02258fb..6092eb6 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/IronTests.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/IronTests.java @@ -26,55 +26,35 @@ import jakarta.json.JsonWriterFactory; import jakarta.json.stream.JsonGenerator; public class IronTests { - + @Disabled @Test void testOb_01() { Assertions.assertDoesNotThrow(()->{ - - + + final DidKey didKey = DidKey.from(URI.create("did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH")); - + //https://w3id.org/security#Ed25519KeyPair2020 //https://w3id.org/security#Ed25519Signature2020 - URI unsigned = Samples.OB30.JSON.SIMPLE_JSON_NOPROOF.asURL().toURI(); - KeyPair kp = Vc.generateKeys("https://w3id.org/security#Ed25519Signature2020").get(URI.create("urn:1"), 256); + URI unsigned = Samples.OB30.JSON.SIMPLE_JSON_NOPROOF.asURL().toURI(); + KeyPair kp = Vc.generateKeys("https://w3id.org/security#Ed25519Signature2020").get(URI.create("urn:1"), 256); ProofOptions options = ProofOptions.create( - Ed25519Proof2020Adapter.TYPE, + Ed25519Proof2020Adapter.TYPE, //new VerificationMethod(URI.create("did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj")), new VerificationMethod(didKey.toUri()), URI.create("https://w3id.org/security#assertionMethod")).created(Instant.now().truncatedTo(ChronoUnit.SECONDS)); - + Issuer issuer = Vc.sign(unsigned, kp, options); System.err.println(pretty(issuer.getCompacted())); - JsonObject signed = issuer.getCompacted(); - JsonObject proof = signed.getJsonObject("sec:proof"); - Assertions.assertNotNull(proof); - + JsonObject signed = issuer.getCompacted(); + JsonObject proof = signed.getJsonObject("sec:proof"); + Assertions.assertNotNull(proof); + Vc.verify(issuer.getCompacted()).isValid(); }); } - - @Disabled - @Test - void testClr_01() { - Assertions.assertDoesNotThrow(()->{ - URI unsigned = Samples.CLR20.JSON.SIMPLE_JSON_NOPROOF.asURL().toURI(); - KeyPair kp = Vc.generateKeys("https://w3id.org/security#Ed25519Signature2020").get(URI.create("urn:1"), 256); - ProofOptions options = ProofOptions.create( - Ed25519Proof2020Adapter.TYPE, - new VerificationMethod(URI.create("did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj")), - URI.create("https://w3id.org/security#assertionMethod")); - - Issuer issuer = Vc.sign(unsigned, kp, options); - JsonObject job = issuer.getCompacted().getJsonObject("sec:proof"); - - //System.err.println (pretty(issuer.getCompacted().toString())); - Assertions.assertNotNull(job); - Vc.verify(issuer.getCompacted()).isValid(); - }); - } - + String pretty(JsonObject jobj) { Map properties = new HashMap<>(1); properties.put(JsonGenerator.PRETTY_PRINTING, true); 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 8a96657..b0ab19e 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 @@ -50,15 +50,6 @@ public class Samples { } } - public static final class CLR20 { - public static final class JSON { - public final static Sample SIMPLE_JSON = new Sample("clr20/simple.json", true); - public final static Sample SIMPLE_JSON_NOPROOF = new Sample("clr20/simple-noproof.json", true); - public final static Sample SIMPLE_JWT = new Sample("clr20/simple.jwt", true); - public final static Sample COMPLEX_JSON = new Sample("clr20/complex.json", true); - } - } - public static final class OB20 { public static final class JSON { // original: test_verify: test_verify_function