X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNodeManager.java;h=f7b231d49b3afc25824b2f7ab111b29c1e2c5150;hb=52608018e26c1d6bffc3c8561cae9500c141a636;hp=a73a563dc0e6a5c7c688071e506afdc2dc041837;hpb=61846a0aae33cb4d93534f3f7c96e7828bb84a4a;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/NodeManager.java b/src/net/pterodactylus/jsite/core/NodeManager.java index a73a563..f7b231d 100644 --- a/src/net/pterodactylus/jsite/core/NodeManager.java +++ b/src/net/pterodactylus/jsite/core/NodeManager.java @@ -40,6 +40,7 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; +import net.pterodactylus.fcp.SSKKeypair; import net.pterodactylus.fcp.highlevel.FcpClient; import net.pterodactylus.fcp.highlevel.FcpException; import net.pterodactylus.jsite.util.IdGenerator; @@ -385,14 +386,22 @@ public class NodeManager implements Iterable, PropertyChangeListener { * @throws IOException * if an I/O error occurs communicating with the node * @throws JSiteException - * if there is a problem with the node + * if there is no connected node */ public String[] generateKeyPair() throws IOException, JSiteException { logger.log(Level.FINEST, "generateKeyPair()"); if (nodes.isEmpty()) { throw new NoNodeException("no node configured"); } - return null; + for (FcpClient fcpClient : nodeClients.values()) { + try { + SSKKeypair sskKeypair = fcpClient.generateKeyPair(); + return new String[] { sskKeypair.getInsertURI(), sskKeypair.getRequestURI() }; + } catch (FcpException fcpe1) { + /* ignore, we’ll throw later on if needs be. */ + } + } + throw new JSiteException("Could not get SSK key pair from any node."); } //