rename identity challenge dir to challenge

Change-Id: Ieb89704404dae2086bd83987624670432bb69663
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index f4e03c0..ee55132 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -20,7 +20,7 @@
 
 #include "ca-module.hpp"
 #include "detail/crypto-helpers.hpp"
-#include "identity-challenge/challenge-module.hpp"
+#include "challenge/challenge-module.hpp"
 #include "name-assignment/assignment-func.hpp"
 #include "detail/challenge-encoder.hpp"
 #include "detail/error-encoder.hpp"
@@ -306,7 +306,7 @@
   }
   RequestId id;
   std::memcpy(id.data(), requestIdData, id.size());
-  RequestState requestState( m_config.m_caProfile.m_caPrefix, id, requestType,
+  RequestState requestState(m_config.m_caProfile.m_caPrefix, id, requestType,
                             Status::BEFORE_CHALLENGE, *clientCert, std::move(aesKey));
   try {
     m_storage->addRequest(requestState);
diff --git a/src/identity-challenge/challenge-credential.cpp b/src/challenge/challenge-credential.cpp
similarity index 100%
rename from src/identity-challenge/challenge-credential.cpp
rename to src/challenge/challenge-credential.cpp
diff --git a/src/identity-challenge/challenge-credential.hpp b/src/challenge/challenge-credential.hpp
similarity index 100%
rename from src/identity-challenge/challenge-credential.hpp
rename to src/challenge/challenge-credential.hpp
diff --git a/src/identity-challenge/challenge-email.cpp b/src/challenge/challenge-email.cpp
similarity index 100%
rename from src/identity-challenge/challenge-email.cpp
rename to src/challenge/challenge-email.cpp
diff --git a/src/identity-challenge/challenge-email.hpp b/src/challenge/challenge-email.hpp
similarity index 100%
rename from src/identity-challenge/challenge-email.hpp
rename to src/challenge/challenge-email.hpp
diff --git a/src/identity-challenge/challenge-module.cpp b/src/challenge/challenge-module.cpp
similarity index 98%
rename from src/identity-challenge/challenge-module.cpp
rename to src/challenge/challenge-module.cpp
index e58b0aa..8de88b6 100644
--- a/src/identity-challenge/challenge-module.cpp
+++ b/src/challenge/challenge-module.cpp
@@ -18,7 +18,7 @@
  * See AUTHORS.md for complete list of ndncert authors and contributors.
  */
 
-#include "identity-challenge/challenge-module.hpp"
+#include "challenge/challenge-module.hpp"
 #include <ndn-cxx/util/random.hpp>
 
 namespace ndn {
diff --git a/src/identity-challenge/challenge-module.hpp b/src/challenge/challenge-module.hpp
similarity index 100%
rename from src/identity-challenge/challenge-module.hpp
rename to src/challenge/challenge-module.hpp
diff --git a/src/identity-challenge/challenge-pin.cpp b/src/challenge/challenge-pin.cpp
similarity index 100%
rename from src/identity-challenge/challenge-pin.cpp
rename to src/challenge/challenge-pin.cpp
diff --git a/src/identity-challenge/challenge-pin.hpp b/src/challenge/challenge-pin.hpp
similarity index 100%
rename from src/identity-challenge/challenge-pin.hpp
rename to src/challenge/challenge-pin.hpp
diff --git a/src/detail/ca-profile.cpp b/src/detail/ca-profile.cpp
index bd826e9..5216ae0 100644
--- a/src/detail/ca-profile.cpp
+++ b/src/detail/ca-profile.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "detail/ca-profile.hpp"
-#include "identity-challenge/challenge-module.hpp"
+#include "challenge/challenge-module.hpp"
 #include <ndn-cxx/util/io.hpp>
 #include <boost/filesystem.hpp>
 
diff --git a/src/detail/ca-profile.hpp b/src/detail/ca-profile.hpp
index c9599f9..3fe0180 100644
--- a/src/detail/ca-profile.hpp
+++ b/src/detail/ca-profile.hpp
@@ -57,39 +57,37 @@
 
 public:
   /**
-   * CA Name prefix (without /CA suffix).
+   * @brief CA Name prefix (without /CA suffix).
    */
   Name m_caPrefix;
   /**
-   * CA Information.
-   * Default: "".
+   * @brief CA Information.
    */
   std::string m_caInfo;
   /**
-   * A list of parameter-keys for PROBE.
-   * Default: empty list.
+   * @brief A list of parameter-keys for PROBE.
    */
   std::list<std::string> m_probeParameterKeys;
   /**
-   * Maximum allowed validity period of the certificate being requested.
+   * @brief  Maximum allowed validity period of the certificate being requested.
+   *
    * The value is in the unit of second.
    * Default: one day (86400 seconds).
    */
   time::seconds m_maxValidityPeriod;
   /**
-   * Maximum allowed suffix length of requested name.
+   * @brief Maximum allowed suffix length of requested name.
+   *
    * E.g., When its value is 2, at most 2 name components can be assigned after m_caPrefix.
    * Default: none.
    */
   optional<size_t> m_maxSuffixLength = nullopt;
   /**
-   * A list of supported challenges. Only CA side will have m_supportedChallenges.
-   * Default: empty list.
+   * @brief A list of supported challenges. Only CA side will have m_supportedChallenges.
    */
   std::list<std::string> m_supportedChallenges;
   /**
-   * CA's certificate. Only Client side will have m_cert.
-   * Default: nullptr.
+   * @brief CA's certificate. Only Client side will have m_cert.
    */
   std::shared_ptr<security::Certificate> m_cert;
 };
diff --git a/src/detail/ca-request-state.cpp b/src/detail/ca-request-state.cpp
index 923f9be..adb453f 100644
--- a/src/detail/ca-request-state.cpp
+++ b/src/detail/ca-request-state.cpp
@@ -38,10 +38,6 @@
     return "Success";
   case Status::FAILURE:
     return "Failure";
-  case Status::NOT_STARTED:
-    return "Not started";
-  case Status::ENDED:
-    return "Ended";
   default:
     return "Unrecognized status";
   }
diff --git a/src/detail/ca-request-state.hpp b/src/detail/ca-request-state.hpp
index 27d19fa..160760e 100644
--- a/src/detail/ca-request-state.hpp
+++ b/src/detail/ca-request-state.hpp
@@ -34,9 +34,7 @@
   CHALLENGE = 1,
   PENDING = 2,
   SUCCESS = 3,
-  FAILURE = 4,
-  NOT_STARTED = 5,
-  ENDED = 6
+  FAILURE = 4
 };
 
 /**
@@ -121,7 +119,7 @@
   /**
    * @brief The status of the request.
    */
-  Status m_status = Status::NOT_STARTED;
+  Status m_status;
   /**
    * @brief The self-signed certificate in the request.
    */
diff --git a/src/detail/profile-storage.cpp b/src/detail/profile-storage.cpp
index 8fcbc9f..2917382 100644
--- a/src/detail/profile-storage.cpp
+++ b/src/detail/profile-storage.cpp
@@ -90,7 +90,7 @@
 }
 
 const std::list<CaProfile>&
-ProfileStorage::getCaProfiles() const
+ProfileStorage::getKnownProfiles() const
 {
   return m_caProfiles;
 }
diff --git a/src/detail/profile-storage.hpp b/src/detail/profile-storage.hpp
index eabb7c9..5955f15 100644
--- a/src/detail/profile-storage.hpp
+++ b/src/detail/profile-storage.hpp
@@ -28,7 +28,7 @@
 namespace requester {
 
 /**
- * @brief Represents Client configuration
+ * @brief CA profiles kept by a requester.
  * @sa https://github.com/named-data/ndncert/wiki/Client-Configuration-Sample
  */
 class ProfileStorage
@@ -53,13 +53,15 @@
   removeCaProfile(const Name& caName);
 
   /**
+   * @brief Add a new CA profile
+   *
    * Be cautious. This will add a new trust anchor for requesters.
    */
   void
   addCaProfile(const CaProfile& profile);
 
   const std::list<CaProfile>&
-  getCaProfiles() const;
+  getKnownProfiles() const;
 
 private:
   std::list<CaProfile> m_caProfiles;
diff --git a/src/name-assignment/assignment-func.hpp b/src/name-assignment/assignment-func.hpp
index 29b516a..9e9b128 100644
--- a/src/name-assignment/assignment-func.hpp
+++ b/src/name-assignment/assignment-func.hpp
@@ -62,7 +62,7 @@
   createNameAssignmentFunc(const std::string& challengeType, const std::string& format = "");
 
 NDNCERT_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
-    std::vector<std::string> m_nameFormat;
+  std::vector<std::string> m_nameFormat;
 
 private:
   typedef function<unique_ptr<NameAssignmentFunc>(const std::string&)> FactoryCreateFunc;
diff --git a/src/requester-request-state.hpp b/src/requester-request-state.hpp
index 9c67409..815e7cc 100644
--- a/src/requester-request-state.hpp
+++ b/src/requester-request-state.hpp
@@ -60,7 +60,7 @@
   /**
    * @brief The current status of the request.
    */
-  Status m_status = Status::NOT_STARTED;
+  Status m_status = Status::BEFORE_CHALLENGE;
   /**
    * @brief The type of challenge chosen.
    */
diff --git a/src/requester.cpp b/src/requester.cpp
index 6f83dc1..7cfa992 100644
--- a/src/requester.cpp
+++ b/src/requester.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "requester.hpp"
-#include "identity-challenge/challenge-module.hpp"
+#include "challenge/challenge-module.hpp"
 #include "detail/crypto-helpers.hpp"
 #include "detail/challenge-encoder.hpp"
 #include "detail/error-encoder.hpp"
@@ -290,7 +290,7 @@
 void
 Requester::endSession(RequestState& state)
 {
-  if (state.m_status == Status::SUCCESS || state.m_status == Status::ENDED) {
+  if (state.m_status == Status::SUCCESS) {
     return;
   }
   if (state.m_isNewlyCreatedIdentity) {
@@ -303,7 +303,6 @@
     auto identity = state.m_keyChain.getPib().getIdentity(state.m_identityName);
     state.m_keyChain.deleteKey(identity, state.m_keyPair);
   }
-  state.m_status = Status::ENDED;
 }
 
 void