Show signatures into admin lookup queries

This commit is contained in:
Max Dor
2019-03-04 02:12:55 +01:00
parent 1dce59a02e
commit 57c7e4a91d
3 changed files with 28 additions and 3 deletions

View File

@@ -27,6 +27,8 @@ import io.kamax.matrix._MatrixID;
import io.kamax.mxisd.http.io.identity.SingeLookupReplyJson;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
public class SingleLookupReply {
@@ -39,6 +41,7 @@ public class SingleLookupReply {
private Instant notBefore;
private Instant notAfter;
private Instant timestamp;
private Map<String, Map<String, String>> signatures = new HashMap<>();
public static SingleLookupReply fromRecursive(SingleLookupRequest request, String body) {
SingleLookupReply reply = new SingleLookupReply();
@@ -52,6 +55,7 @@ public class SingleLookupReply {
reply.notAfter = Instant.ofEpochMilli(json.getNot_after());
reply.notBefore = Instant.ofEpochMilli(json.getNot_before());
reply.timestamp = Instant.ofEpochMilli(json.getTs());
reply.signatures = new HashMap<>(json.getSignatures());
} catch (JsonSyntaxException e) {
// stub - we only want to try, nothing more
}
@@ -107,4 +111,12 @@ public class SingleLookupReply {
return timestamp;
}
public Map<String, Map<String, String>> getSignatures() {
return signatures;
}
public Map<String, String> getSignature(String host) {
return signatures.computeIfAbsent(host, k -> new HashMap<>());
}
}