code: private void createKeysIfNotExist() {
          if (!keyPairExists()) {
              try {
                  final KeyPair keyPair = generateKeyPair();
                  save(keyPair);
              } catch (NoSuchAlgorithmException e) {
                  LOGGER.error("An error occurred generating new keypair");
                  LOGGER.error(e.getMessage());
              } catch (IOException e) {
                  LOGGER.error("An error occurred saving newly generated keypair");
                  LOGGER.error(e.getMessage());
              }
          }
          if (!secretKeyExists()) {
              try {
                  final SecretKey secretKey = generateSecretKey();
                  save(secretKey);
              } catch (NoSuchAlgorithmException e) {
                  LOGGER.error("An error occurred generating new secret key");
                  LOGGER.error(e.getMessage());
              } catch (IOException e) {
                  LOGGER.error("An error occurred saving newly generated secret key");
                  LOGGER.error(e.getMessage());
              }
          }
      }
docs: Checks if the keys exists. If not, they will be created.