clean up filenames

This commit is contained in:
Markus Gylling 2022-08-31 15:04:32 +02:00
parent 469d60eae3
commit 7c7d283530
9 changed files with 103 additions and 7 deletions

View File

@ -39,7 +39,6 @@ import org.oneedtech.inspect.vc.probe.RevocationListProbe;
import org.oneedtech.inspect.vc.probe.SignatureVerifierProbe;
import org.oneedtech.inspect.vc.probe.TypePropertyProbe;
import org.oneedtech.inspect.vc.util.CachingDocumentLoader;
import org.oneedtech.inspect.vc.util.JsonNodeUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -91,6 +90,10 @@ public class OB30Inspector extends VCInspector {
//we expect the above to place a generated object in the context
Credential crd = ctx.getGeneratedObject(Credential.ID);
//TODO check context IRIs? the schema doesnt do this
//TODO new check: that subject @id or IdentityObject is available (at least one is the req)
//type property
probeCount++;
accumulator.add(new TypePropertyProbe(OpenBadgeCredential).run(crd.getJson(), ctx));

View File

@ -0,0 +1,64 @@
package org.oneedtech.inspect.vc;
import java.net.URI;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import com.apicatalog.ld.signature.ed25519.Ed25519Proof2020Adapter;
import com.apicatalog.ld.signature.key.KeyPair;
import com.apicatalog.ld.signature.proof.ProofOptions;
import com.apicatalog.ld.signature.proof.VerificationMethod;
import com.apicatalog.vc.Vc;
import com.apicatalog.vc.processor.Issuer;
import jakarta.json.JsonObject;
public class IronTests {
@Disabled
@Test
void testOb_01() {
Assertions.assertDoesNotThrow(()->{
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,
new VerificationMethod(URI.create("did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj")),
URI.create("https://w3id.org/security#assertionMethod")).created(Instant.now().truncatedTo(ChronoUnit.SECONDS));
Issuer issuer = Vc.sign(unsigned, kp, options);
JsonObject signed = issuer.getCompacted();
JsonObject proof = signed.getJsonObject("sec:proof");
Assertions.assertNotNull(proof);
System.err.println (issuer.getCompacted().toString());
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 (issuer.getCompacted().toString());
Assertions.assertNotNull(job);
Vc.verify(issuer.getCompacted()).isValid();
});
}
}

View File

@ -11,11 +11,12 @@ public class Samples {
public static final class JSON {
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_JSON_UNKNOWN_TYPE = new Sample("ob30/simple-unknown-type.json", false);
public final static Sample SIMPLE_JSON_PROOF_ERROR = new Sample("ob30/simple-proof-error.json", false);
public final static Sample SIMPLE_JSON_EXPIRED = new Sample("ob30/simple-expired.json", false);
public final static Sample SIMPLE_JSON_ISSUED = new Sample("ob30/simple-issued.json", false);
public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-issuer.json", false);
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_PROOF_ERROR = new Sample("ob30/simple-err-proof.json", false);
public final static Sample SIMPLE_JSON_EXPIRED = new Sample("ob30/simple-err-expired.json", false);
public final static Sample SIMPLE_JSON_ISSUED = new Sample("ob30/simple-err-issued.json", false);
public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-err-issuer.json", false);
}
public static final class PNG {
public final static Sample SIMPLE_JWT_PNG = new Sample("ob30/simple-jwt.png", true);
@ -29,6 +30,7 @@ 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);
}
}

View File

@ -0,0 +1,27 @@
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://imsglobal.github.io/openbadges-specification/context.json",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": "http://example.edu/credentials/3732",
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
],
"issuer": {
"id": "https://example.edu/issuers/565049",
"type": [
"Profile"
],
"name": "Example University"
},
"issuanceDate": "2010-01-01T00:00:00Z",
"name": "Example University Degree",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"type": [
"AchievementSubject"
]
}
}