Removed CLR inspector

This commit is contained in:
Xavi Aracil 2023-10-11 12:44:47 +02:00
parent cc3bd6d171
commit 20bdaadbd0
3 changed files with 17 additions and 44 deletions

View File

@ -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<Probe<VerifiableCredential>> getProbes() {
return probes;
}
}
}

View File

@ -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<String, Object> properties = new HashMap<>(1);
properties.put(JsonGenerator.PRETTY_PRINTING, true);

View File

@ -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