Use URI methods
This commit is contained in:
parent
aec2be38bd
commit
4eb82c819b
@ -58,21 +58,22 @@ public class EmbeddedProofProbe extends Probe<Credential> {
|
|||||||
// TODO fourth format that we don't support yet: a URL that returns a Ed25519VerificationKey2020
|
// 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
|
// if starts with http and does not have hashcode, try fetch and see if returns Ed25519VerificationKey2020
|
||||||
// property is publicKeyMultibase
|
// property is publicKeyMultibase
|
||||||
|
|
||||||
|
publicKeyMultibase = method.toString();
|
||||||
|
|
||||||
if (method.toString().contains("#")) {
|
if (method.getFragment() != null) {
|
||||||
publicKeyMultibase = method.getFragment();
|
publicKeyMultibase = method.getFragment();
|
||||||
} else {
|
} else {
|
||||||
if (method.toString().startsWith("did")) {
|
if (method.getScheme().equals("did")) {
|
||||||
String didScheme = method.getSchemeSpecificPart();
|
if (method.getSchemeSpecificPart().startsWith("key:")) {
|
||||||
if (didScheme.startsWith("key:")) {
|
publicKeyMultibase = method.getSchemeSpecificPart().substring(4);
|
||||||
publicKeyMultibase = didScheme.substring(4);
|
} else {
|
||||||
} else {
|
return error("Unknown verification method: " + method, ctx);
|
||||||
return error("Unknown verification method: " + method.toString(), ctx);
|
}
|
||||||
}
|
} else if (method.getScheme().equals("http") || method.getScheme().equals("https")) {
|
||||||
} else {
|
return error("Cannot parse http verification key yet", ctx);
|
||||||
publicKeyMultibase = method.toString();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
||||||
|
Loading…
Reference in New Issue
Block a user