diff --git a/xplat/Flipper/ConnectionContextStore.cpp b/xplat/Flipper/ConnectionContextStore.cpp index 04f5547ab..c661c657a 100644 --- a/xplat/Flipper/ConnectionContextStore.cpp +++ b/xplat/Flipper/ConnectionContextStore.cpp @@ -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 = ""; diff --git a/xplat/Flipper/ConnectionContextStore.h b/xplat/Flipper/ConnectionContextStore.h index 9cfac0c8f..be551b555 100644 --- a/xplat/Flipper/ConnectionContextStore.h +++ b/xplat/Flipper/ConnectionContextStore.h @@ -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. */