diff --git a/native/cpp/CommonCpp/grpc/protos/backup.proto b/native/cpp/CommonCpp/grpc/protos/backup.proto --- a/native/cpp/CommonCpp/grpc/protos/backup.proto +++ b/native/cpp/CommonCpp/grpc/protos/backup.proto @@ -30,9 +30,10 @@ message CreateNewBackupRequest { oneof data { string userID = 1; - bytes keyEntropy = 2; - bytes newCompactionHash = 3; - bytes newCompactionChunk = 4; + string deviceID = 2; + bytes keyEntropy = 3; + bytes newCompactionHash = 4; + bytes newCompactionChunk = 5; } } diff --git a/services/backup/src/Reactors/server/CreateNewBackupReactor.h b/services/backup/src/Reactors/server/CreateNewBackupReactor.h --- a/services/backup/src/Reactors/server/CreateNewBackupReactor.h +++ b/services/backup/src/Reactors/server/CreateNewBackupReactor.h @@ -21,13 +21,15 @@ backup::CreateNewBackupResponse> { enum class State { USER_ID = 1, - KEY_ENTROPY = 2, - DATA_HASH = 3, - DATA_CHUNKS = 4, + DEVICE_ID = 2, + KEY_ENTROPY = 3, + DATA_HASH = 4, + DATA_CHUNKS = 5, }; State state = State::USER_ID; std::string userID; + std::string deviceID; std::string keyEntropy; std::string dataHash; std::string holder; diff --git a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp --- a/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp +++ b/services/backup/src/Reactors/server/CreateNewBackupReactor.cpp @@ -25,6 +25,14 @@ throw std::runtime_error("user id expected but not received"); } this->userID = request.userid(); + this->state = State::DEVICE_ID; + return nullptr; + } + case State::DEVICE_ID: { + if (!request.has_deviceid()) { + throw std::runtime_error("device id expected but not received"); + } + this->deviceID = request.deviceid(); this->state = State::KEY_ENTROPY; return nullptr; }