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;
* @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.");
}
//