forked from Silverfish/proton-bridge
GODT-1554 / 1555: Implement gRPC go service and Qt 5 frontend C++ app.
WIP: updates WIP: cache on disk and autostart. WIP: mail, keychain and more. WIP: updated grpc version in go mod file. WIP: user list. WIP: RPC service placeholder WIP: test C++ RPC client skeleton. Other: missing license script update. WIP: use Qt test framework. WIP: test for app and login calls. WIP: test for update & cache on disk calls. WIP: tests for mail settings calls. WIP: all client tests. WIP: linter fixes. WIP: fix missing license link. WIP: update dependency_license script for gRPC and protobuf. WIP: removed unused file. WIP: app & login event streaming tests. WIP: update event stream tests. WIP: completed event streaming tests. GODT-1554: qt C++ frontend skeleton. WIP: C++ backend declaration. wip: started drafting user model. WIP: users. not functional. WIP: invokable methods WIP: Exception class + backend 'injection' into QML. WIP: switch to VCPKG to ease multi-arch compilation, C++ RPC client skeleton. WIP: Renaming and reorganisation WIP:introduced new 'grpc' go frontend. WIP: Worker & Oveerseer for thread management. WIP: added log to C++ app. WIP: event stream architecture on Go side. WIP: event parsing and streamer stopping. WIP: Moved grpc to frontend subfolder + use vcpkg for gRPC and protobuf. WIP: windows building ok WIP: wired a few messages WIP: more wiring. WIP: Fixed imports after rebase on top of devel. WIP: wired some bool and string properties. WIP: more properties. WIP: wired cache on disk stuff WIP: connect event watcher. WIP: login WIP: fix showSplashScreen WIP: Wired login calls. WIP: user list. WIP: Refactored main(). WIP: User retrieval . WIP: no shared pointer in user model. WIP: fixed user count. WIP: cached goos. WIP: Wired autostart WIP: beta channel toggle wired. WIP: User removal WIP: wired theme WIP: implemented configure apple mail. WIP: split mode. WIP: fixed user updates. WIP: fixed Quit from tray icon WIP: wired CurrentEmailClient WIP: wired UseSSLForSMTP WIP: wired change ports . WIP: wired DoH. . WIP: wired keychain calls. WIP: wired autoupdate option. WIP: QML Backend clean-up. WIP: cleanup. WIP: moved user related files in subfolder. . WIP: User are managed using smart pointers. WIP: cleanup. WIP: more cleanup. WIP: mail events forwarding WIP: code inspection tweaks from CLion. WIP: moved QML, cleanup, and missing copyright notices. WIP: Backend is not QMLBackend. Other: fixed issues reported by Leander. [skip ci]
This commit is contained in:
424
internal/frontend/grpc/bridge.proto
Normal file
424
internal/frontend/grpc/bridge.proto
Normal file
@ -0,0 +1,424 @@
|
||||
// Copyright (c) 2022 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
option go_package = "github.com/ProtonMail/proton-bridge/internal/grpc";
|
||||
|
||||
package grpc; // ignored by Go, used as namespace name in C++.
|
||||
|
||||
//**********************************************************************************************************************
|
||||
// Service Declaration
|
||||
//**********************************************************************************************************************
|
||||
service Bridge {
|
||||
|
||||
// App related calls
|
||||
rpc GuiReady (google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc Quit (google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc Restart (google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc ShowOnStartup(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc ShowSplashScreen(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc IsFirstGuiStart(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc SetIsAutostartOn(google.protobuf.BoolValue) returns (google.protobuf.Empty);
|
||||
rpc IsAutostartOn(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc SetIsBetaEnabled(google.protobuf.BoolValue) returns (google.protobuf.Empty);
|
||||
rpc IsBetaEnabled(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc GoOs(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc TriggerReset(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc Version(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc LogsPath(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc LicensePath(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
// rpc ReleaseNotesLink(google.protobuf.Empty) returns (google.protobuf.StringValue); // TODO GODT-1670 Apparently cannot be polled for now, will be sent as update.
|
||||
rpc DependencyLicensesLink(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
// rpc LandingPageLink(google.protobuf.Empty) returns (google.protobuf.StringValue); // TODO GODT-1670 Apparently cannot be polled for now, will be sent as update.
|
||||
rpc SetColorSchemeName(google.protobuf.StringValue) returns (google.protobuf.Empty);
|
||||
rpc ColorSchemeName(google.protobuf.Empty) returns (google.protobuf.StringValue); // TODO Color scheme should probably entirely be managed by the client.
|
||||
rpc CurrentEmailClient(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc ReportBug(ReportBugRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// login
|
||||
rpc Login(LoginRequest) returns (google.protobuf.Empty);
|
||||
rpc Login2FA(LoginRequest) returns (google.protobuf.Empty);
|
||||
rpc Login2Passwords(LoginRequest) returns (google.protobuf.Empty);
|
||||
rpc LoginAbort(LoginAbortRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// update
|
||||
rpc CheckUpdate(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc InstallUpdate(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
rpc SetIsAutomaticUpdateOn(google.protobuf.BoolValue) returns (google.protobuf.Empty);
|
||||
rpc IsAutomaticUpdateOn(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
|
||||
// cache
|
||||
rpc IsCacheOnDiskEnabled (google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc DiskCachePath(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc ChangeLocalCache(ChangeLocalCacheRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// mail
|
||||
rpc SetIsDoHEnabled(google.protobuf.BoolValue) returns (google.protobuf.Empty);
|
||||
rpc IsDoHEnabled(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc SetUseSslForSmtp(google.protobuf.BoolValue) returns (google.protobuf.Empty);
|
||||
rpc UseSslForSmtp(google.protobuf.Empty) returns (google.protobuf.BoolValue);
|
||||
rpc Hostname(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
rpc ImapPort(google.protobuf.Empty) returns (google.protobuf.Int32Value);
|
||||
rpc SmtpPort(google.protobuf.Empty) returns (google.protobuf.Int32Value);
|
||||
rpc ChangePorts(ChangePortsRequest) returns (google.protobuf.Empty);
|
||||
rpc IsPortFree(google.protobuf.Int32Value) returns (google.protobuf.BoolValue);
|
||||
|
||||
// keychain
|
||||
rpc AvailableKeychains(google.protobuf.Empty) returns (AvailableKeychainsResponse);
|
||||
rpc SetCurrentKeychain(google.protobuf.StringValue) returns (google.protobuf.Empty);
|
||||
rpc CurrentKeychain(google.protobuf.Empty) returns (google.protobuf.StringValue);
|
||||
|
||||
// User & user list
|
||||
rpc GetUserList(google.protobuf.Empty) returns (UserListResponse);
|
||||
rpc GetUser(google.protobuf.StringValue) returns (User);
|
||||
rpc SetUserSplitMode(UserSplitModeRequest) returns (google.protobuf.Empty);
|
||||
rpc LogoutUser(google.protobuf.StringValue) returns (google.protobuf.Empty);
|
||||
rpc RemoveUser(google.protobuf.StringValue) returns (google.protobuf.Empty);
|
||||
rpc ConfigureUserAppleMail(ConfigureAppleMailRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// Server -> Client event stream
|
||||
rpc StartEventStream(google.protobuf.Empty) returns (stream StreamEvent); // Keep streaming until StopEventStream is called.
|
||||
rpc StopEventStream(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
||||
//**********************************************************************************************************************
|
||||
// RPC calls requests and replies messages
|
||||
//**********************************************************************************************************************
|
||||
|
||||
message ReportBugRequest {
|
||||
string description = 1;
|
||||
string address = 2;
|
||||
string emailClient = 3;
|
||||
bool includeLogs = 4;
|
||||
|
||||
}
|
||||
|
||||
// login related messages
|
||||
|
||||
message LoginRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message LoginAbortRequest {
|
||||
string username = 1;
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// Cache on disk related messages
|
||||
//**********************************************************
|
||||
message ChangeLocalCacheRequest {
|
||||
bool enableDiskCache = 1;
|
||||
string diskCachePath = 2;
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// Cache on disk related messages
|
||||
//**********************************************************
|
||||
message ChangePortsRequest {
|
||||
int32 imapPort = 1;
|
||||
int32 smtpPort = 2;
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// Cache on disk related messages
|
||||
//**********************************************************
|
||||
message AvailableKeychainsResponse {
|
||||
repeated string keychains = 1;
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// Cache on disk related messages
|
||||
//**********************************************************
|
||||
message User {
|
||||
string id = 1;
|
||||
string username = 2;
|
||||
string avatarText = 3;
|
||||
bool loggedIn = 4;
|
||||
bool splitMode = 5;
|
||||
bool setupGuideSeen = 6;
|
||||
int64 usedBytes = 7;
|
||||
int64 totalBytes = 8;
|
||||
string password = 9;
|
||||
repeated string addresses = 10;
|
||||
}
|
||||
|
||||
message UserSplitModeRequest {
|
||||
string userID = 1;
|
||||
bool active = 2;
|
||||
}
|
||||
|
||||
message UserListResponse {
|
||||
repeated User users = 1;
|
||||
}
|
||||
|
||||
message ConfigureAppleMailRequest {
|
||||
string userID = 1;
|
||||
string address = 2;
|
||||
}
|
||||
|
||||
//**********************************************************************************************************************
|
||||
// Event stream messages
|
||||
//**********************************************************************************************************************
|
||||
message StreamEvent {
|
||||
oneof event {
|
||||
AppEvent app = 1;
|
||||
LoginEvent login = 2;
|
||||
UpdateEvent update = 3;
|
||||
CacheEvent cache = 4;
|
||||
MailSettingsEvent mailSettings = 5;
|
||||
KeychainEvent keychain = 6;
|
||||
MailEvent mail = 7;
|
||||
UserEvent user = 8;
|
||||
}
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// App related events
|
||||
//**********************************************************
|
||||
message AppEvent {
|
||||
oneof event {
|
||||
InternetStatusEvent internetStatus = 1;
|
||||
ToggleAutostartFinishedEvent toggleAutostartFinished = 2;
|
||||
ResetFinishedEvent resetFinished = 3;
|
||||
ReportBugFinishedEvent reportBugFinished = 4;
|
||||
ReportBugSuccessEvent reportBugSuccess = 5;
|
||||
ReportBugErrorEvent reportBugError = 6;
|
||||
ShowMainWindowEvent showMainWindow = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message InternetStatusEvent {
|
||||
bool connected = 1;
|
||||
}
|
||||
|
||||
message ToggleAutostartFinishedEvent {}
|
||||
message ResetFinishedEvent {}
|
||||
message ReportBugFinishedEvent {}
|
||||
message ReportBugSuccessEvent {}
|
||||
message ReportBugErrorEvent {}
|
||||
message ShowMainWindowEvent {}
|
||||
|
||||
//**********************************************************
|
||||
// Login related events
|
||||
//**********************************************************
|
||||
message LoginEvent {
|
||||
oneof event {
|
||||
LoginErrorEvent error = 1;
|
||||
LoginTfaRequestedEvent tfaRequested = 2;
|
||||
LoginTwoPasswordsRequestedEvent twoPasswordRequested = 3;
|
||||
LoginFinishedEvent finished = 4;
|
||||
LoginFinishedEvent alreadyLoggedIn = 5;
|
||||
}
|
||||
}
|
||||
|
||||
enum LoginErrorType {
|
||||
USERNAME_PASSWORD_ERROR = 0;
|
||||
FREE_USER = 1;
|
||||
CONNECTION_ERROR = 2;
|
||||
TFA_ERROR = 3;
|
||||
TFA_ABORT = 4;
|
||||
TWO_PASSWORDS_ERROR = 5;
|
||||
TWO_PASSWORDS_ABORT = 6;
|
||||
}
|
||||
|
||||
message LoginErrorEvent {
|
||||
LoginErrorType type = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message LoginTfaRequestedEvent {
|
||||
string username = 1;
|
||||
}
|
||||
|
||||
message LoginTwoPasswordsRequestedEvent {}
|
||||
|
||||
message LoginFinishedEvent {
|
||||
string userID = 1;
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
// Update related events
|
||||
//**********************************************************
|
||||
message UpdateEvent {
|
||||
oneof event {
|
||||
UpdateErrorEvent error = 1;
|
||||
UpdateManualReadyEvent manualReady = 2;
|
||||
UpdateManualRestartNeededEvent manualRestartNeeded = 3;
|
||||
UpdateForceEvent force = 4;
|
||||
UpdateSilentRestartNeeded silentRestartNeeded = 5;
|
||||
UpdateIsLatestVersion isLatestVersion = 6;
|
||||
UpdateCheckFinished checkFinished = 7;
|
||||
}
|
||||
}
|
||||
|
||||
enum UpdateErrorType {
|
||||
UPDATE_MANUAL_ERROR = 0;
|
||||
UPDATE_FORCE_ERROR = 1;
|
||||
UPDATE_SILENT_ERROR = 2;
|
||||
}
|
||||
|
||||
message UpdateErrorEvent {
|
||||
UpdateErrorType type = 1;
|
||||
}
|
||||
|
||||
message UpdateManualReadyEvent {
|
||||
string version = 1;
|
||||
}
|
||||
|
||||
message UpdateManualRestartNeededEvent {};
|
||||
|
||||
message UpdateForceEvent {
|
||||
string version = 1;
|
||||
}
|
||||
|
||||
message UpdateSilentRestartNeeded {}
|
||||
|
||||
message UpdateIsLatestVersion {}
|
||||
|
||||
message UpdateCheckFinished {}
|
||||
|
||||
//**********************************************************
|
||||
// Cache on disk related events
|
||||
//**********************************************************
|
||||
message CacheEvent {
|
||||
oneof event {
|
||||
CacheErrorEvent error = 1;
|
||||
CacheLocationChangeSuccessEvent locationChangedSuccess = 2;
|
||||
ChangeLocalCacheFinishedEvent changeLocalCacheFinished = 3;
|
||||
IsCacheOnDiskEnabledChanged isCacheOnDiskEnabledChanged = 4;
|
||||
DiskCachePathChanged diskCachePathChanged = 5;
|
||||
}
|
||||
}
|
||||
|
||||
enum CacheErrorType {
|
||||
CACHE_UNAVAILABLE_ERROR = 0;
|
||||
CACHE_CANT_MOVE_ERROR = 1;
|
||||
DISK_FULL = 2;
|
||||
};
|
||||
|
||||
message CacheErrorEvent {
|
||||
CacheErrorType type = 1;
|
||||
}
|
||||
|
||||
message CacheLocationChangeSuccessEvent {};
|
||||
|
||||
message ChangeLocalCacheFinishedEvent {};
|
||||
|
||||
|
||||
message IsCacheOnDiskEnabledChanged {
|
||||
bool enabled = 1;
|
||||
}
|
||||
|
||||
message DiskCachePathChanged {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
|
||||
//**********************************************************
|
||||
// Mail settings related events
|
||||
//**********************************************************
|
||||
message MailSettingsEvent {
|
||||
oneof event {
|
||||
MailSettingsErrorEvent error = 1;
|
||||
UseSslForSmtpFinishedEvent useSslForSmtpFinished = 2;
|
||||
ChangePortsFinishedEvent changePortsFinished = 3;
|
||||
}
|
||||
}
|
||||
|
||||
enum MailSettingsErrorType {
|
||||
IMAP_PORT_ISSUE = 0;
|
||||
SMTP_PORT_ISSUE = 1;
|
||||
}
|
||||
|
||||
message MailSettingsErrorEvent {
|
||||
MailSettingsErrorType type = 1;
|
||||
}
|
||||
|
||||
message UseSslForSmtpFinishedEvent {}
|
||||
|
||||
message ChangePortsFinishedEvent {}
|
||||
|
||||
//**********************************************************
|
||||
// keychain related events
|
||||
//**********************************************************
|
||||
message KeychainEvent {
|
||||
oneof event {
|
||||
ChangeKeychainFinishedEvent changeKeychainFinished = 1;
|
||||
HasNoKeychainEvent hasNoKeychain = 2;
|
||||
RebuildKeychainEvent rebuildKeychain = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ChangeKeychainFinishedEvent {}
|
||||
message HasNoKeychainEvent {}
|
||||
message RebuildKeychainEvent {}
|
||||
|
||||
//**********************************************************
|
||||
// Mail related events
|
||||
//**********************************************************
|
||||
message MailEvent {
|
||||
oneof event {
|
||||
NoActiveKeyForRecipientEvent noActiveKeyForRecipientEvent = 1;
|
||||
AddressChangedEvent addressChanged = 2;
|
||||
AddressChangedLogoutEvent addressChangedLogout = 3;
|
||||
ApiCertIssueEvent apiCertIssue = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message NoActiveKeyForRecipientEvent {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
message AddressChangedEvent {
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
message AddressChangedLogoutEvent {
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
message ApiCertIssueEvent {}
|
||||
|
||||
//**********************************************************
|
||||
// User list related event
|
||||
//**********************************************************
|
||||
|
||||
message UserEvent {
|
||||
oneof event {
|
||||
ToggleSplitModeFinishedEvent toggleSplitModeFinished= 1;
|
||||
UserDisconnectedEvent userDisconnected = 2;
|
||||
UserChangedEvent userChanged = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ToggleSplitModeFinishedEvent {
|
||||
string userID = 1;
|
||||
}
|
||||
|
||||
message UserDisconnectedEvent {
|
||||
string username = 1;
|
||||
}
|
||||
|
||||
message UserChangedEvent {
|
||||
string userID = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user