Removed CLR inspector
This commit is contained in:
parent
cc3bd6d171
commit
20bdaadbd0
@ -3,11 +3,9 @@ package org.oneedtech.inspect.vc;
|
|||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
import static org.oneedtech.inspect.vc.util.JsonNodeUtil.asStringList;
|
import static org.oneedtech.inspect.vc.util.JsonNodeUtil.asStringList;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Spliterators;
|
import java.util.Spliterators;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
@ -142,5 +140,9 @@ public abstract class VCInspector extends Inspector {
|
|||||||
probes.add(probe);
|
probes.add(probe);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Probe<VerifiableCredential>> getProbes() {
|
||||||
|
return probes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,55 +26,35 @@ import jakarta.json.JsonWriterFactory;
|
|||||||
import jakarta.json.stream.JsonGenerator;
|
import jakarta.json.stream.JsonGenerator;
|
||||||
|
|
||||||
public class IronTests {
|
public class IronTests {
|
||||||
|
|
||||||
@Disabled
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
void testOb_01() {
|
void testOb_01() {
|
||||||
Assertions.assertDoesNotThrow(()->{
|
Assertions.assertDoesNotThrow(()->{
|
||||||
|
|
||||||
|
|
||||||
final DidKey didKey = DidKey.from(URI.create("did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH"));
|
final DidKey didKey = DidKey.from(URI.create("did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH"));
|
||||||
|
|
||||||
//https://w3id.org/security#Ed25519KeyPair2020
|
//https://w3id.org/security#Ed25519KeyPair2020
|
||||||
//https://w3id.org/security#Ed25519Signature2020
|
//https://w3id.org/security#Ed25519Signature2020
|
||||||
URI unsigned = Samples.OB30.JSON.SIMPLE_JSON_NOPROOF.asURL().toURI();
|
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);
|
KeyPair kp = Vc.generateKeys("https://w3id.org/security#Ed25519Signature2020").get(URI.create("urn:1"), 256);
|
||||||
ProofOptions options = ProofOptions.create(
|
ProofOptions options = ProofOptions.create(
|
||||||
Ed25519Proof2020Adapter.TYPE,
|
Ed25519Proof2020Adapter.TYPE,
|
||||||
//new VerificationMethod(URI.create("did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj")),
|
//new VerificationMethod(URI.create("did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj")),
|
||||||
new VerificationMethod(didKey.toUri()),
|
new VerificationMethod(didKey.toUri()),
|
||||||
URI.create("https://w3id.org/security#assertionMethod")).created(Instant.now().truncatedTo(ChronoUnit.SECONDS));
|
URI.create("https://w3id.org/security#assertionMethod")).created(Instant.now().truncatedTo(ChronoUnit.SECONDS));
|
||||||
|
|
||||||
Issuer issuer = Vc.sign(unsigned, kp, options);
|
Issuer issuer = Vc.sign(unsigned, kp, options);
|
||||||
System.err.println(pretty(issuer.getCompacted()));
|
System.err.println(pretty(issuer.getCompacted()));
|
||||||
JsonObject signed = issuer.getCompacted();
|
JsonObject signed = issuer.getCompacted();
|
||||||
JsonObject proof = signed.getJsonObject("sec:proof");
|
JsonObject proof = signed.getJsonObject("sec:proof");
|
||||||
Assertions.assertNotNull(proof);
|
Assertions.assertNotNull(proof);
|
||||||
|
|
||||||
Vc.verify(issuer.getCompacted()).isValid();
|
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) {
|
String pretty(JsonObject jobj) {
|
||||||
Map<String, Object> properties = new HashMap<>(1);
|
Map<String, Object> properties = new HashMap<>(1);
|
||||||
properties.put(JsonGenerator.PRETTY_PRINTING, true);
|
properties.put(JsonGenerator.PRETTY_PRINTING, true);
|
||||||
|
@ -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 OB20 {
|
||||||
public static final class JSON {
|
public static final class JSON {
|
||||||
// original: test_verify: test_verify_function
|
// original: test_verify: test_verify_function
|
||||||
|
Loading…
Reference in New Issue
Block a user