Use URI methods

This commit is contained in:
Andy Miller (IMS) 2022-11-10 14:16:27 -08:00
parent aec2be38bd
commit 4eb82c819b

View File

@ -59,20 +59,21 @@ public class EmbeddedProofProbe extends Probe<Credential> {
// if starts with http and does not have hashcode, try fetch and see if returns Ed25519VerificationKey2020 // if starts with http and does not have hashcode, try fetch and see if returns Ed25519VerificationKey2020
// property is publicKeyMultibase // property is publicKeyMultibase
if (method.toString().contains("#")) { publicKeyMultibase = method.toString();
publicKeyMultibase = method.getFragment();
} else { if (method.getFragment() != null) {
if (method.toString().startsWith("did")) { publicKeyMultibase = method.getFragment();
String didScheme = method.getSchemeSpecificPart(); } else {
if (didScheme.startsWith("key:")) { if (method.getScheme().equals("did")) {
publicKeyMultibase = didScheme.substring(4); if (method.getSchemeSpecificPart().startsWith("key:")) {
} else { publicKeyMultibase = method.getSchemeSpecificPart().substring(4);
return error("Unknown verification method: " + method.toString(), ctx); } else {
} return error("Unknown verification method: " + method, ctx);
} else { }
publicKeyMultibase = method.toString(); } else if (method.getScheme().equals("http") || method.getScheme().equals("https")) {
} return error("Cannot parse http verification key yet", ctx);
} }
}
// Decode the Multibase to Multicodec and check that it is an Ed25519 public key // Decode the Multibase to Multicodec and check that it is an Ed25519 public key
// https://w3c-ccg.github.io/di-eddsa-2020/#ed25519verificationkey2020 // https://w3c-ccg.github.io/di-eddsa-2020/#ed25519verificationkey2020