use namespace for ca and rename CaState to ca::RequestState
Change-Id: I2250bf7fb68503465dae18e16dc3c512fe809037
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 493a959..7153731 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -36,6 +36,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
static const time::seconds DEFAULT_DATA_FRESHNESS_PERIOD = 1_s;
static const time::seconds REQUEST_VALIDITY_PERIOD_NOT_BEFORE_GRACE_PERIOD = 120_s;
@@ -306,7 +307,7 @@
}
RequestID id;
std::memcpy(id.data(), requestIdData, id.size());
- CaState requestState(m_config.m_caItem.m_caPrefix, id,
+ RequestState requestState(m_config.m_caItem.m_caPrefix, id,
requestType, Status::BEFORE_CHALLENGE, *clientCert,
makeBinaryBlock(ndn::tlv::ContentType_Key, aesKey, sizeof(aesKey)));
try {
@@ -439,7 +440,7 @@
}
security::Certificate
-CaModule::issueCertificate(const CaState& requestState)
+CaModule::issueCertificate(const RequestState& requestState)
{
auto expectedPeriod = requestState.m_cert.getValidityPeriod().getPeriod();
security::ValidityPeriod period(expectedPeriod.first, expectedPeriod.second);
@@ -460,7 +461,7 @@
return newCert;
}
-std::unique_ptr<CaState>
+std::unique_ptr<RequestState>
CaModule::getCertificateRequest(const Interest& request)
{
RequestID requestId;
@@ -474,7 +475,7 @@
}
try {
NDN_LOG_TRACE("Request Id to query the database " << toHex(requestId.data(), requestId.size()));
- return std::make_unique<CaState>(m_storage->getRequest(requestId));
+ return std::make_unique<RequestState>(m_storage->getRequest(requestId));
}
catch (const std::exception& e) {
NDN_LOG_ERROR("Cannot get certificate request record from the storage: " << e.what());
@@ -499,5 +500,6 @@
return result;
}
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/ca-module.hpp b/src/ca-module.hpp
index e1cedaf..209352c 100644
--- a/src/ca-module.hpp
+++ b/src/ca-module.hpp
@@ -27,6 +27,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
class CaModule : noncopyable
{
@@ -70,11 +71,11 @@
void
onRegisterFailed(const std::string& reason);
- std::unique_ptr<CaState>
+ std::unique_ptr<RequestState>
getCertificateRequest(const Interest& request);
security::Certificate
- issueCertificate(const CaState& requestState);
+ issueCertificate(const RequestState& requestState);
void
registerPrefix();
@@ -94,6 +95,7 @@
std::list<InterestFilterHandle> m_interestFilterHandles;
};
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 78c7e61..b400a2f 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -132,6 +132,8 @@
return caItem;
}
+namespace ca {
+
void
CaConfig::load(const std::string& fileName)
{
@@ -181,6 +183,8 @@
}
}
+} // namespace ca
+
void
RequesterCaCache::load(const std::string& fileName)
{
diff --git a/src/configuration.hpp b/src/configuration.hpp
index 8fc3c74..42d79dd 100644
--- a/src/configuration.hpp
+++ b/src/configuration.hpp
@@ -79,15 +79,17 @@
parseChallengeList(const JsonSection& configSection);
};
+namespace ca {
+
/**
* @brief The function would be invoked whenever the certificate request status is updated.
* The callback is used to notice the CA application or CA command line tool. The callback is
* fired whenever a request instance is created, challenge status is updated, and when certificate
* is issued.
*
- * @param CaState The state of the certificate request whose status is updated.
+ * @param RequestState The state of the certificate request whose status is updated.
*/
-using StatusUpdateCallback = function<void(const CaState&)>;
+using StatusUpdateCallback = function<void(const RequestState&)>;
/**
* @brief CA's configuration on NDNCERT.
@@ -138,6 +140,8 @@
std::vector<std::unique_ptr<NameAssignmentFunc>> m_nameAssignmentFuncs;
};
+} // namespace ca
+
/**
* @brief Represents Client configuration
*
diff --git a/src/detail/ca-memory.cpp b/src/detail/ca-memory.cpp
index 893801e..a293a18 100644
--- a/src/detail/ca-memory.cpp
+++ b/src/detail/ca-memory.cpp
@@ -23,6 +23,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
const std::string
CaMemory::STORAGE_TYPE = "ca-storage-memory";
@@ -34,7 +35,7 @@
{
}
-CaState
+RequestState
CaMemory::getRequest(const RequestID& requestId)
{
auto search = m_requests.find(requestId);
@@ -45,7 +46,7 @@
}
void
-CaMemory::addRequest(const CaState& request)
+CaMemory::addRequest(const RequestState& request)
{
auto search = m_requests.find(request.m_requestId);
if (search == m_requests.end()) {
@@ -57,7 +58,7 @@
}
void
-CaMemory::updateRequest(const CaState& request)
+CaMemory::updateRequest(const RequestState& request)
{
auto search = m_requests.find(request.m_requestId);
if (search == m_requests.end()) {
@@ -78,20 +79,20 @@
}
}
-std::list<CaState>
+std::list<RequestState>
CaMemory::listAllRequests()
{
- std::list<CaState> result;
+ std::list<RequestState> result;
for (const auto& entry : m_requests) {
result.push_back(entry.second);
}
return result;
}
-std::list<CaState>
+std::list<RequestState>
CaMemory::listAllRequests(const Name& caName)
{
- std::list<CaState> result;
+ std::list<RequestState> result;
for (const auto& entry : m_requests) {
if (entry.second.m_caPrefix == caName) {
result.push_back(entry.second);
@@ -100,5 +101,6 @@
return result;
}
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-memory.hpp b/src/detail/ca-memory.hpp
index 594875b..b4cdb97 100644
--- a/src/detail/ca-memory.hpp
+++ b/src/detail/ca-memory.hpp
@@ -25,6 +25,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
class CaMemory : public CaStorage
{
@@ -36,31 +37,32 @@
/**
* @throw if request cannot be fetched from underlying data storage
*/
- CaState
+ RequestState
getRequest(const RequestID& requestId) override;
/**
* @throw if there is an existing request with the same request ID
*/
void
- addRequest(const CaState& request) override;
+ addRequest(const RequestState& request) override;
void
- updateRequest(const CaState& request) override;
+ updateRequest(const RequestState& request) override;
void
deleteRequest(const RequestID& requestId) override;
- std::list<CaState>
+ std::list<RequestState>
listAllRequests() override;
- std::list<CaState>
+ std::list<RequestState>
listAllRequests(const Name& caName) override;
private:
- std::map<RequestID, CaState> m_requests;
+ std::map<RequestID, RequestState> m_requests;
};
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-sqlite.cpp b/src/detail/ca-sqlite.cpp
index 4f0971d..cd55be8 100644
--- a/src/detail/ca-sqlite.cpp
+++ b/src/detail/ca-sqlite.cpp
@@ -27,6 +27,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
using namespace ndn::util;
const std::string CaSqlite::STORAGE_TYPE = "ca-storage-sqlite3";
@@ -52,7 +53,7 @@
static const std::string INITIALIZATION = R"_DBTEXT_(
CREATE TABLE IF NOT EXISTS
- CaStates(
+ RequestStates(
id INTEGER PRIMARY KEY,
request_id BLOB NOT NULL,
ca_name BLOB NOT NULL,
@@ -69,7 +70,7 @@
aes_block_counter INTEGER
);
CREATE UNIQUE INDEX IF NOT EXISTS
- CaStateIdIndex ON CaStates(request_id);
+ RequestStateIdIndex ON RequestStates(request_id);
)_DBTEXT_";
CaSqlite::CaSqlite(const Name& caName, const std::string& path)
@@ -121,7 +122,7 @@
sqlite3_close(m_database);
}
-CaState
+RequestState
CaSqlite::getRequest(const RequestID& requestId)
{
Sqlite3Statement statement(m_database,
@@ -130,7 +131,7 @@
challenge_type, challenge_secrets,
challenge_tp, remaining_tries, remaining_time,
request_type, encryption_key, aes_block_counter
- FROM CaStates where request_id = ?)_SQLTEXT_");
+ FROM RequestStates where request_id = ?)_SQLTEXT_");
statement.bind(1, requestId.data(), requestId.size(), SQLITE_TRANSIENT);
if (statement.step() == SQLITE_ROW) {
@@ -147,13 +148,13 @@
auto encryptionKey = statement.getBlock(11);
auto aesCounter = statement.getInt(12);
if (challengeType != "") {
- return CaState(caName, requestId, requestType, status, cert,
+ return RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets), encryptionKey, aesCounter);
}
else {
- return CaState(caName, requestId, requestType, status, cert, encryptionKey);
+ return RequestState(caName, requestId, requestType, status, cert, encryptionKey);
}
}
else {
@@ -162,11 +163,11 @@
}
void
-CaSqlite::addRequest(const CaState& request)
+CaSqlite::addRequest(const RequestState& request)
{
Sqlite3Statement statement(
m_database,
- R"_SQLTEXT_(INSERT OR ABORT INTO CaStates (request_id, ca_name, status, request_type,
+ R"_SQLTEXT_(INSERT OR ABORT INTO RequestStates (request_id, ca_name, status, request_type,
cert_request, challenge_type, challenge_status, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, encryption_key, aes_block_counter)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
@@ -192,10 +193,10 @@
}
void
-CaSqlite::updateRequest(const CaState& request)
+CaSqlite::updateRequest(const RequestState& request)
{
Sqlite3Statement statement(m_database,
- R"_SQLTEXT_(UPDATE CaStates
+ R"_SQLTEXT_(UPDATE RequestStates
SET status = ?, challenge_type = ?, challenge_status = ?, challenge_secrets = ?,
challenge_tp = ?, remaining_tries = ?, remaining_time = ?, aes_block_counter = ?
WHERE request_id = ?)_SQLTEXT_");
@@ -223,15 +224,15 @@
}
}
-std::list<CaState>
+std::list<RequestState>
CaSqlite::listAllRequests()
{
- std::list<CaState> result;
+ std::list<RequestState> result;
Sqlite3Statement statement(m_database, R"_SQLTEXT_(SELECT id, request_id, ca_name, status,
challenge_status, cert_request, challenge_type, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, request_type,
encryption_key, aes_block_counter
- FROM CaStates)_SQLTEXT_");
+ FROM RequestStates)_SQLTEXT_");
while (statement.step() == SQLITE_ROW) {
RequestID requestId;
std::memcpy(requestId.data(), statement.getBlob(1), statement.getSize(1));
@@ -248,28 +249,28 @@
auto encryptionKey = statement.getBlock(12);
auto aesBlockCounter = statement.getInt(13);
if (challengeType != "") {
- result.push_back(CaState(caName, requestId, requestType, status, cert,
+ result.push_back(RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets), encryptionKey, aesBlockCounter));
}
else {
- result.push_back(CaState(caName, requestId, requestType, status, cert, encryptionKey, aesBlockCounter));
+ result.push_back(RequestState(caName, requestId, requestType, status, cert, encryptionKey, aesBlockCounter));
}
}
return result;
}
-std::list<CaState>
+std::list<RequestState>
CaSqlite::listAllRequests(const Name& caName)
{
- std::list<CaState> result;
+ std::list<RequestState> result;
Sqlite3Statement statement(m_database,
R"_SQLTEXT_(SELECT id, request_id, ca_name, status,
challenge_status, cert_request, challenge_type, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, request_type,
encryption_key, aes_block_counter
- FROM CaStates WHERE ca_name = ?)_SQLTEXT_");
+ FROM RequestStates WHERE ca_name = ?)_SQLTEXT_");
statement.bind(1, caName.wireEncode(), SQLITE_TRANSIENT);
while (statement.step() == SQLITE_ROW) {
@@ -288,13 +289,13 @@
auto encryptionKey = statement.getBlock(12);
auto aesBlockCounter = statement.getInt(13);
if (challengeType != "") {
- result.push_back(CaState(caName, requestId, requestType, status, cert,
+ result.push_back(RequestState(caName, requestId, requestType, status, cert,
challengeType, challengeStatus, time::fromIsoString(challengeTp),
remainingTries, time::seconds(remainingTime),
convertString2Json(challengeSecrets), encryptionKey, aesBlockCounter));
}
else {
- result.push_back(CaState(caName, requestId, requestType, status, cert, encryptionKey, aesBlockCounter));
+ result.push_back(RequestState(caName, requestId, requestType, status, cert, encryptionKey, aesBlockCounter));
}
}
return result;
@@ -304,10 +305,11 @@
CaSqlite::deleteRequest(const RequestID& requestId)
{
Sqlite3Statement statement(m_database,
- R"_SQLTEXT_(DELETE FROM CaStates WHERE request_id = ?)_SQLTEXT_");
+ R"_SQLTEXT_(DELETE FROM RequestStates WHERE request_id = ?)_SQLTEXT_");
statement.bind(1, requestId.data(), requestId.size(), SQLITE_TRANSIENT);
statement.step();
}
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-sqlite.hpp b/src/detail/ca-sqlite.hpp
index a74395f..21cd565 100644
--- a/src/detail/ca-sqlite.hpp
+++ b/src/detail/ca-sqlite.hpp
@@ -27,6 +27,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
class CaSqlite : public CaStorage
{
@@ -42,31 +43,32 @@
/**
* @throw if request cannot be fetched from underlying data storage
*/
- CaState
+ RequestState
getRequest(const RequestID& requestId) override;
/**
* @throw if there is an existing request with the same request ID
*/
void
- addRequest(const CaState& request) override;
+ addRequest(const RequestState& request) override;
void
- updateRequest(const CaState& request) override;
+ updateRequest(const RequestState& request) override;
void
deleteRequest(const RequestID& requestId) override;
- std::list<CaState>
+ std::list<RequestState>
listAllRequests() override;
- std::list<CaState>
+ std::list<RequestState>
listAllRequests(const Name& caName) override;
private:
sqlite3* m_database;
};
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-state.cpp b/src/detail/ca-state.cpp
index fa4e1ed..9b1f96b 100644
--- a/src/detail/ca-state.cpp
+++ b/src/detail/ca-state.cpp
@@ -46,6 +46,8 @@
}
}
+namespace ca {
+
ChallengeState::ChallengeState(const std::string& challengeStatus,
const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime,
@@ -58,7 +60,7 @@
{
}
-CaState::CaState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
+RequestState::RequestState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
const security::Certificate& cert, Block encryptionKey, uint32_t aesBlockCounter)
: m_caPrefix(caName)
, m_requestId(requestId)
@@ -70,7 +72,7 @@
{
}
-CaState::CaState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
+RequestState::RequestState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
const security::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
@@ -88,7 +90,7 @@
}
std::ostream&
-operator<<(std::ostream& os, const CaState& request)
+operator<<(std::ostream& os, const RequestState& request)
{
os << "Request's CA name: " << request.m_caPrefix << "\n";
os << "Request's request ID: " << toHex(request.m_requestId.data(), request.m_requestId.size()) << "\n";
@@ -109,5 +111,6 @@
return os;
}
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-state.hpp b/src/detail/ca-state.hpp
index 5f96fb0..e5876b1 100644
--- a/src/detail/ca-state.hpp
+++ b/src/detail/ca-state.hpp
@@ -45,6 +45,8 @@
std::string
statusToString(Status status);
+namespace ca {
+
/**
* @brief The state maintained by the Challenge module.
*/
@@ -78,20 +80,20 @@
/**
* @brief Represents a certificate request instance kept by the CA.
*
- * ChallengeModule should take use of CaState.ChallengeState to keep the challenge state.
+ * ChallengeModule should take use of RequestState.ChallengeState to keep the challenge state.
*/
-class CaState
+class RequestState
{
public:
/**
- * @brief Used to instantiate a CaState when challenge is not started.
+ * @brief Used to instantiate a RequestState when challenge is not started.
*/
- CaState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
+ RequestState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
const security::Certificate& cert, Block m_encryptionKey, uint32_t aesBlockCounter = 0);
/**
- * @brief Used to instantiate a CaState after challenge is started.
+ * @brief Used to instantiate a RequestState after challenge is started.
*/
- CaState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
+ RequestState(const Name& caName, const RequestID& requestId, RequestType requestType, Status status,
const security::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
@@ -138,8 +140,9 @@
};
std::ostream&
-operator<<(std::ostream& os, const CaState& request);
+operator<<(std::ostream& os, const RequestState& request);
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-storage.cpp b/src/detail/ca-storage.cpp
index a7195f6..a377c6c 100644
--- a/src/detail/ca-storage.cpp
+++ b/src/detail/ca-storage.cpp
@@ -22,6 +22,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
unique_ptr<CaStorage>
CaStorage::createCaStorage(const std::string& caStorageType, const Name& caName, const std::string& path)
@@ -38,5 +39,6 @@
return factory;
}
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/ca-storage.hpp b/src/detail/ca-storage.hpp
index 7349300..7ccecd8 100644
--- a/src/detail/ca-storage.hpp
+++ b/src/detail/ca-storage.hpp
@@ -25,6 +25,7 @@
namespace ndn {
namespace ndncert {
+namespace ca {
class CaStorage : noncopyable
{
@@ -32,25 +33,25 @@
/**
* @throw if request cannot be fetched from underlying data storage
*/
- virtual CaState
+ virtual RequestState
getRequest(const RequestID& requestId) = 0;
/**
* @throw if there is an existing request with the same request ID
*/
virtual void
- addRequest(const CaState& request) = 0;
+ addRequest(const RequestState& request) = 0;
virtual void
- updateRequest(const CaState& request) = 0;
+ updateRequest(const RequestState& request) = 0;
virtual void
deleteRequest(const RequestID& requestId) = 0;
- virtual std::list<CaState>
+ virtual std::list<RequestState>
listAllRequests() = 0;
- virtual std::list<CaState>
+ virtual std::list<RequestState>
listAllRequests(const Name& caName) = 0;
public: // factory
@@ -85,10 +86,11 @@
public: \
NdnCert ## C ## CaStorageRegistrationClass() \
{ \
- ::ndn::ndncert::CaStorage::registerCaStorage<C>(); \
+ ::ndn::ndncert::ca::CaStorage::registerCaStorage<C>(); \
} \
} g_NdnCert ## C ## CaStorageRegistrationVariable
+} // namespace ca
} // namespace ndncert
} // namespace ndn
diff --git a/src/detail/challenge-encoder.cpp b/src/detail/challenge-encoder.cpp
index dfe76ad..f3ebb5a 100644
--- a/src/detail/challenge-encoder.cpp
+++ b/src/detail/challenge-encoder.cpp
@@ -24,7 +24,7 @@
namespace ndncert {
Block
-ChallengeEncoder::encodeDataContent(const CaState& request)
+ChallengeEncoder::encodeDataContent(const ca::RequestState& request)
{
Block response = makeEmptyBlock(tlv::EncryptedPayload);
response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<size_t>(request.m_status)));
diff --git a/src/detail/challenge-encoder.hpp b/src/detail/challenge-encoder.hpp
index 9ef19a9..fb9d5d2 100644
--- a/src/detail/challenge-encoder.hpp
+++ b/src/detail/challenge-encoder.hpp
@@ -31,7 +31,7 @@
{
public:
static Block
- encodeDataContent(const CaState& request);
+ encodeDataContent(const ca::RequestState& request);
static void
decodeDataContent(const Block& data, RequesterState& state);
diff --git a/src/identity-challenge/challenge-credential.cpp b/src/identity-challenge/challenge-credential.cpp
index 9cceefe..e4f21d4 100644
--- a/src/identity-challenge/challenge-credential.cpp
+++ b/src/identity-challenge/challenge-credential.cpp
@@ -75,7 +75,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengeCredential::handleChallengeRequest(const Block& params, CaState& request)
+ChallengeCredential::handleChallengeRequest(const Block& params, ca::RequestState& request)
{
params.parse();
if (m_trustAnchors.empty()) {
diff --git a/src/identity-challenge/challenge-credential.hpp b/src/identity-challenge/challenge-credential.hpp
index 38a7e1a..17bc979 100644
--- a/src/identity-challenge/challenge-credential.hpp
+++ b/src/identity-challenge/challenge-credential.hpp
@@ -53,7 +53,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CaState& request) override;
+ handleChallengeRequest(const Block& params, ca::RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>
diff --git a/src/identity-challenge/challenge-email.cpp b/src/identity-challenge/challenge-email.cpp
index cc141dc..be7cd2a 100644
--- a/src/identity-challenge/challenge-email.cpp
+++ b/src/identity-challenge/challenge-email.cpp
@@ -43,7 +43,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengeEmail::handleChallengeRequest(const Block& params, CaState& request)
+ChallengeEmail::handleChallengeRequest(const Block& params, ca::RequestState& request)
{
params.parse();
auto currentTime = time::system_clock::now();
@@ -157,7 +157,7 @@
void
ChallengeEmail::sendEmail(const std::string& emailAddress, const std::string& secret,
- const CaState& request) const
+ const ca::RequestState& request) const
{
std::string command = m_sendEmailScript;
command += " \"" + emailAddress + "\" \"" + secret + "\" \"" + request.m_caPrefix.toUri() + "\" \"" + request.m_cert.getName().toUri() + "\"";
diff --git a/src/identity-challenge/challenge-email.hpp b/src/identity-challenge/challenge-email.hpp
index 8fc6af5..9dbcedd 100644
--- a/src/identity-challenge/challenge-email.hpp
+++ b/src/identity-challenge/challenge-email.hpp
@@ -57,7 +57,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CaState& request) override;
+ handleChallengeRequest(const Block& params, ca::RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>
@@ -81,7 +81,7 @@
void
sendEmail(const std::string& emailAddress, const std::string& secret,
- const CaState& request) const;
+ const ca::RequestState& request) const;
private:
std::string m_sendEmailScript;
diff --git a/src/identity-challenge/challenge-module.cpp b/src/identity-challenge/challenge-module.cpp
index 03feeeb..2208e83 100644
--- a/src/identity-challenge/challenge-module.cpp
+++ b/src/identity-challenge/challenge-module.cpp
@@ -73,7 +73,7 @@
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithError(CaState& request, ErrorCode errorCode, std::string&& errorInfo)
+ChallengeModule::returnWithError(ca::RequestState& request, ErrorCode errorCode, std::string&& errorInfo)
{
request.m_status = Status::FAILURE;
request.m_challengeType = "";
@@ -82,17 +82,17 @@
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithNewChallengeStatus(CaState& request, const std::string& challengeStatus,
+ChallengeModule::returnWithNewChallengeStatus(ca::RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime)
{
request.m_status = Status::CHALLENGE;
request.m_challengeType = CHALLENGE_TYPE;
- request.m_challengeState = ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime, std::move(challengeSecret));
+ request.m_challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime, std::move(challengeSecret));
return std::make_tuple(ErrorCode::NO_ERROR, "");
}
std::tuple<ErrorCode, std::string>
-ChallengeModule::returnWithSuccess(CaState& request)
+ChallengeModule::returnWithSuccess(ca::RequestState& request)
{
request.m_status = Status::PENDING;
request.m_challengeType = CHALLENGE_TYPE;
diff --git a/src/identity-challenge/challenge-module.hpp b/src/identity-challenge/challenge-module.hpp
index 22c6a4c..f1c942f 100644
--- a/src/identity-challenge/challenge-module.hpp
+++ b/src/identity-challenge/challenge-module.hpp
@@ -51,7 +51,7 @@
// For CA
virtual std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CaState& request) = 0;
+ handleChallengeRequest(const Block& params, ca::RequestState& request) = 0;
// For Client
virtual std::vector<std::tuple<std::string, std::string>>
@@ -68,14 +68,14 @@
protected:
// used by challenge modules
std::tuple<ErrorCode, std::string>
- returnWithError(CaState& request, ErrorCode errorCode, std::string&& errorInfo);
+ returnWithError(ca::RequestState& request, ErrorCode errorCode, std::string&& errorInfo);
std::tuple<ErrorCode, std::string>
- returnWithNewChallengeStatus(CaState& request, const std::string& challengeStatus,
+ returnWithNewChallengeStatus(ca::RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime);
std::tuple<ErrorCode, std::string>
- returnWithSuccess(CaState& request);
+ returnWithSuccess(ca::RequestState& request);
public:
const std::string CHALLENGE_TYPE;
diff --git a/src/identity-challenge/challenge-pin.cpp b/src/identity-challenge/challenge-pin.cpp
index c9f98ba..726771f 100644
--- a/src/identity-challenge/challenge-pin.cpp
+++ b/src/identity-challenge/challenge-pin.cpp
@@ -38,7 +38,7 @@
// For CA
std::tuple<ErrorCode, std::string>
-ChallengePin::handleChallengeRequest(const Block& params, CaState& request)
+ChallengePin::handleChallengeRequest(const Block& params, ca::RequestState& request)
{
params.parse();
auto currentTime = time::system_clock::now();
diff --git a/src/identity-challenge/challenge-pin.hpp b/src/identity-challenge/challenge-pin.hpp
index b942c4d..10b23d4 100644
--- a/src/identity-challenge/challenge-pin.hpp
+++ b/src/identity-challenge/challenge-pin.hpp
@@ -52,7 +52,7 @@
// For CA
std::tuple<ErrorCode, std::string>
- handleChallengeRequest(const Block& params, CaState& request) override;
+ handleChallengeRequest(const Block& params, ca::RequestState& request) override;
// For Client
std::vector<std::tuple<std::string, std::string>>