Update ob and clr schemas (renders from unifiedmodel)

This commit is contained in:
Markus Gylling 2022-09-15 13:59:33 +02:00
parent 66fd9e4bf8
commit 4e35622d92
2 changed files with 15 additions and 3 deletions

View File

@ -70,9 +70,9 @@ public class Credential extends GeneratedObject {
private static final Map<Credential.Type, SchemaKey> schemas = new ImmutableMap.Builder<Credential.Type, SchemaKey>()
.put(AchievementCredential, Catalog.OB_30_ACHIEVEMENTCREDENTIAL_JSON)
.put(ClrCredential, Catalog.OB_30_ACHIEVEMENTCREDENTIAL_JSON)
.put(EndorsementCredential, Catalog.OB_30_ENDORSEMENTCREDENTIAL_JSON)
.put(ClrCredential, Catalog.CLR_20_CLRCREDENTIAL_JSON)
.put(VerifiablePresentation, Catalog.CLR_20_CLRCREDENTIAL_JSON)
.put(EndorsementCredential, Catalog.OB_30_ENDORSEMENTCREDENTIAL_JSON)
.build();
/**
@ -85,7 +85,7 @@ public class Credential extends GeneratedObject {
public enum Type {
AchievementCredential,
OpenBadgeCredential, //treated as an alias of AchievementCredential
ClrCredential, //NOT a duplicate of OB this does not use an alias and we ONLY use 'ClrCredential' as the base type
ClrCredential,
EndorsementCredential,
VerifiablePresentation,
VerifiableCredential, //this is an underspecifier in our context

View File

@ -34,6 +34,9 @@ public class EmbeddedProofProbe extends Probe<Credential> {
@Override
public ReportItems run(Credential crd, RunContext ctx) throws Exception {
//TODO check that proof is Ed25519 - issue error if not ("type": "Ed25519Signature2020",
//TODO check value "proofPurpose": "assertionMethod", if not error
VerifiableCredential vc = VerifiableCredential.fromJson(new StringReader(crd.getJson().toString()));
vc.setDocumentLoader(new CachingDocumentLoader());
@ -51,6 +54,10 @@ public class EmbeddedProofProbe extends Probe<Credential> {
// did:key:[publicKeyMultibase]
// [publicKeyMultibase]
// TODO fourth format that we don't support yet: a URL that returns a Ed25519VerificationKey2020
// if starts with http and does not have hashcode, try fetch and see if returns Ed25519VerificationKey2020
// property is publicKeyMultibase
if (method.toString().contains("#")) {
publicKeyMultibase = method.getFragment();
} else {
@ -77,6 +84,11 @@ public class EmbeddedProofProbe extends Probe<Credential> {
Ed25519Signature2020LdVerifier verifier = new Ed25519Signature2020LdVerifier(publicKey);
//TODO find out whether we also should check that controller matches issuer ID:
// if [controller]#[publicKeyMultibase] format - check [controller] segment
// if did:key:[publicKeyMultibase] format: issuer ID must match the entire URI
// if [publicKeyMultibase] -- don't check issuer ID. Maybe we should warn about this syntax.
try {
verifier.verify(vc);
} catch (Exception e) {