ConnectionContextStore to expose API to retrieve store items path
Summary: ^ This change allow callers to retrieve the path of different store items some of which are used for connection authentication. Reviewed By: aigoncharov Differential Revision: D34081942 fbshipit-source-id: c6b8d3590993de6c48a36266a5c16f2caf9f5a93
This commit is contained in:
committed by
Facebook GitHub Bot
parent
63f51ad0f5
commit
37b87b7653
@@ -150,6 +150,23 @@ std::string ConnectionContextStore::getCACertificatePath() {
|
||||
return absoluteFilePath(FLIPPER_CA_FILE_NAME);
|
||||
}
|
||||
|
||||
std::string ConnectionContextStore::getPath(StoreItem storeItem) {
|
||||
switch (storeItem) {
|
||||
case CSR:
|
||||
return absoluteFilePath(CSR_FILE_NAME);
|
||||
case FLIPPER_CA:
|
||||
return absoluteFilePath(FLIPPER_CA_FILE_NAME);
|
||||
case CLIENT_CERT:
|
||||
return absoluteFilePath(CLIENT_CERT_FILE_NAME);
|
||||
case PRIVATE_KEY:
|
||||
return absoluteFilePath(PRIVATE_KEY_FILE);
|
||||
case CERTIFICATE:
|
||||
return absoluteFilePath(CERTIFICATE_FILE_NAME);
|
||||
case CONNECTION_CONFIG:
|
||||
return absoluteFilePath(CONNECTION_CONFIG_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionContextStore::resetState() {
|
||||
// Clear in-memory state
|
||||
csr = "";
|
||||
|
||||
@@ -19,6 +19,14 @@ namespace flipper {
|
||||
|
||||
class ConnectionContextStore {
|
||||
public:
|
||||
enum StoreItem {
|
||||
CSR,
|
||||
FLIPPER_CA,
|
||||
CLIENT_CERT,
|
||||
PRIVATE_KEY,
|
||||
CERTIFICATE,
|
||||
CONNECTION_CONFIG,
|
||||
};
|
||||
ConnectionContextStore(DeviceData deviceData);
|
||||
bool hasRequiredFiles();
|
||||
std::string getCertificateSigningRequest();
|
||||
@@ -26,6 +34,7 @@ class ConnectionContextStore {
|
||||
std::string getCertificateDirectoryPath();
|
||||
std::string getCACertificatePath();
|
||||
std::string getDeviceId();
|
||||
std::string getPath(StoreItem storeItem);
|
||||
/**
|
||||
* Get medium over which the certificate was received.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user