mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
feat(GODT-2771): gRPC calls for TLS certificates.
This commit is contained in:
@ -202,6 +202,39 @@ SPStreamEvent newReportBugErrorEvent() {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The event.
|
||||
//****************************************************************************************************************************************************
|
||||
SPStreamEvent newCertificateInstallSuccessEvent() {
|
||||
auto event = new grpc::CertificateInstallSuccessEvent;
|
||||
auto appEvent = new grpc::AppEvent;
|
||||
appEvent->set_allocated_certificateinstallsuccess(event);
|
||||
return wrapAppEvent(appEvent);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The event.
|
||||
//****************************************************************************************************************************************************
|
||||
SPStreamEvent newCertificateInstallCanceledEvent() {
|
||||
auto event = new grpc::CertificateInstallCanceledEvent;
|
||||
auto appEvent = new grpc::AppEvent;
|
||||
appEvent->set_allocated_certificateinstallcanceled(event);
|
||||
return wrapAppEvent(appEvent);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The event.
|
||||
//****************************************************************************************************************************************************
|
||||
SPStreamEvent newCertificateInstallFailedEvent() {
|
||||
auto event = new grpc::CertificateInstallFailedEvent;
|
||||
auto appEvent = new grpc::AppEvent;
|
||||
appEvent->set_allocated_certificateinstallfailed(event);
|
||||
return wrapAppEvent(appEvent);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The event.
|
||||
//****************************************************************************************************************************************************
|
||||
|
||||
@ -34,6 +34,9 @@ SPStreamEvent newResetFinishedEvent(); ///< Create a new ResetFinishedEvent even
|
||||
SPStreamEvent newReportBugFinishedEvent(); ///< Create a new ReportBugFinishedEvent event.
|
||||
SPStreamEvent newReportBugSuccessEvent(); ///< Create a new ReportBugSuccessEvent event.
|
||||
SPStreamEvent newReportBugErrorEvent(); ///< Create a new ReportBugErrorEvent event.
|
||||
SPStreamEvent newCertificateInstallSuccessEvent(); ///< Create a new CertificateInstallSuccessEvent event.
|
||||
SPStreamEvent newCertificateInstallCanceledEvent(); ///< Create a new CertificateInstallCanceledEvent event.
|
||||
SPStreamEvent newCertificateInstallFailedEvent(); ///< Create anew CertificateInstallFailedEvent event.
|
||||
SPStreamEvent newShowMainWindowEvent(); ///< Create a new ShowMainWindowEvent event.
|
||||
|
||||
// Login events
|
||||
|
||||
@ -373,14 +373,6 @@ grpc::Status GRPCClient::reportBug(QString const &category, QString const &descr
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] folderPath of the folder where the TLS files should be stored.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::exportTLSCertificates(QString const &folderPath) {
|
||||
return this->logGRPCCallStatus(this->setString(&Bridge::Stub::ExportTLSCertificates, folderPath), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[out] outIMAPPort The IMAP port.
|
||||
/// \param[out] outSMTPPort The SMTP port.
|
||||
@ -811,6 +803,32 @@ grpc::Status GRPCClient::setCurrentKeychain(QString const &keychain) {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[out] isInstalled is The Bridge certificate installed in the keychain.
|
||||
/// \return The status for the call
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::isTLSCertificateInstalled(bool isInstalled) {
|
||||
return this->logGRPCCallStatus(this->getBool(&Bridge::Stub::IsTLSCertificateInstalled, isInstalled), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The status for the gRPC call.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::installTLSCertificate() {
|
||||
return this->logGRPCCallStatus(this->simpleMethod(&Bridge::Stub::InstallTLSCertificate), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] folderPath of the folder where the TLS files should be stored.
|
||||
/// \return The status for the gRPC call.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::exportTLSCertificates(QString const &folderPath) {
|
||||
return this->logGRPCCallStatus(this->setString(&Bridge::Stub::ExportTLSCertificates, folderPath), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return true iff the event stream is active.
|
||||
//****************************************************************************************************************************************************
|
||||
@ -1134,6 +1152,18 @@ void GRPCClient::processAppEvent(AppEvent const &event) {
|
||||
this->logTrace("App event received: ReportBugFallback.");
|
||||
emit reportBugFallback();
|
||||
break;
|
||||
case AppEvent::kCertificateInstallSuccess:
|
||||
this->logTrace("App event received: CertificateInstallSuccess.");
|
||||
emit certificateInstallSuccess();
|
||||
break;
|
||||
case AppEvent::kCertificateInstallCanceled:
|
||||
this->logTrace("App event received: CertificateInstallCanceled.");
|
||||
emit certificateInstallCanceled();
|
||||
break;
|
||||
case AppEvent::kCertificateInstallFailed:
|
||||
this->logTrace("App event received: CertificateInstallFailed.");
|
||||
emit certificateInstallFailed();
|
||||
break;
|
||||
default:
|
||||
this->logError("Unknown App event received.");
|
||||
}
|
||||
@ -1517,4 +1547,5 @@ grpc::Status GRPCClient::KBArticleClicked(QString const &article) {
|
||||
return this->logGRPCCallStatus(stub_->KBArticleClicked(this->clientContext().get(), s, &empty), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
} // namespace bridgepp
|
||||
|
||||
@ -78,7 +78,6 @@ public: // member functions.
|
||||
grpc::Status setColorSchemeName(QString const &name); ///< Performs the "setColorSchemeName' gRPC call.
|
||||
grpc::Status currentEmailClient(QString &outName); ///< Performs the 'currentEmailClient' gRPC call.
|
||||
grpc::Status reportBug(QString const &category, QString const &description, QString const &address, QString const &emailClient, bool includeLogs); ///< Performs the 'ReportBug' gRPC call.
|
||||
grpc::Status exportTLSCertificates(QString const &folderPath); ///< Performs the 'ExportTLSCertificates' gRPC call.
|
||||
grpc::Status quit(); ///< Perform the "Quit" gRPC call.
|
||||
grpc::Status restart(); ///< Performs the Restart gRPC call.
|
||||
grpc::Status triggerReset(); ///< Performs the triggerReset gRPC call.
|
||||
@ -103,6 +102,9 @@ signals: // app related signals
|
||||
void reportBugSuccess();
|
||||
void reportBugError();
|
||||
void reportBugFallback();
|
||||
void certificateInstallSuccess();
|
||||
void certificateInstallCanceled();
|
||||
void certificateInstallFailed();
|
||||
void showMainWindow();
|
||||
|
||||
// cache related calls
|
||||
@ -201,6 +203,11 @@ public: // keychain related calls
|
||||
grpc::Status currentKeychain(QString &outKeychain);
|
||||
grpc::Status setCurrentKeychain(QString const &keychain);
|
||||
|
||||
public: // cert related calls
|
||||
grpc::Status isTLSCertificateInstalled(bool isInstalled); ///< Perform the 'IsTLSCertificateInstalled' gRPC call.
|
||||
grpc::Status installTLSCertificate(); ///< Perform the 'InstallTLSCertificate' gRPC call.
|
||||
grpc::Status exportTLSCertificates(QString const &folderPath); ///< Performs the 'ExportTLSCertificates' gRPC call.
|
||||
|
||||
signals:
|
||||
void changeKeychainFinished();
|
||||
void hasNoKeychain();
|
||||
|
||||
Reference in New Issue
Block a user