mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Add toString() methods to WOT network classes
This commit is contained in:
parent
c4f1bf1bc0
commit
e1d3180e1e
5 changed files with 40 additions and 1 deletions
|
@ -157,4 +157,9 @@ public class WebOfTrust implements CertificateAuthority {
|
||||||
public boolean isAuthorized(PGPPublicKeyRing certificate, String userId) {
|
public boolean isAuthorized(PGPPublicKeyRing certificate, String userId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return network.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,9 @@ public class CertSynopsis {
|
||||||
public Set<String> userIds() {
|
public Set<String> userIds() {
|
||||||
return new HashSet<>(userIds);
|
return new HashSet<>(userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return fingerprint + (userIds.isEmpty() ? "" : "(" + userIds.iterator().next() + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,4 +166,13 @@ public class Certification {
|
||||||
public RegexSet getRegexes() {
|
public RegexSet getRegexes() {
|
||||||
return regex;
|
return regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(issuer.getFingerprint()).append((issuer.userIds().isEmpty() ? " " : " (" + issuer.userIds().iterator().next() + ") "));
|
||||||
|
sb.append(userId.isPresent() ? "certifies" : "delegates to").append(userId.isPresent() ? " [" + userId.get() + "] " : " ").append(target.getFingerprint())
|
||||||
|
.append(userId.isEmpty() && !target.userIds().isEmpty() ? " (" + target.userIds().iterator().next() + ")" : "");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,4 +110,15 @@ public final class CertificationSet {
|
||||||
// TODO: Prevent duplicates, only keep newest timestamped sig?
|
// TODO: Prevent duplicates, only keep newest timestamped sig?
|
||||||
certificationsForUserId.add(certification);
|
certificationsForUserId.add(certification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (Map.Entry<Optional<String>, List<Certification>> entry : certifications.entrySet()) {
|
||||||
|
for (Certification certification : entry.getValue()) {
|
||||||
|
sb.append(certification).append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,4 +58,13 @@ public class Network {
|
||||||
return referenceTime;
|
return referenceTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder("Network with " + getNodes().size() + " nodes, " + getEdges().size() + " edges:\n");
|
||||||
|
for (OpenPgpFingerprint issuer : getNodes().keySet()) {
|
||||||
|
for (CertificationSet edge : getReverseEdges().get(issuer)) {
|
||||||
|
sb.append(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue