diff --git a/native/cpp/CommonCpp/grpc/_generated/backup.pb.h b/native/cpp/CommonCpp/grpc/_generated/backup.pb.h --- a/native/cpp/CommonCpp/grpc/_generated/backup.pb.h +++ b/native/cpp/CommonCpp/grpc/_generated/backup.pb.h @@ -1857,7 +1857,8 @@ enum DataCase { kAuthenticationRequestData = 1, kBackupKeyEntropy = 2, - kNewCompactionChunk = 3, + kNewCompactionHash = 3, + kNewCompactionChunk = 4, DATA_NOT_SET = 0, }; @@ -1938,7 +1939,8 @@ enum : int { kAuthenticationRequestDataFieldNumber = 1, kBackupKeyEntropyFieldNumber = 2, - kNewCompactionChunkFieldNumber = 3, + kNewCompactionHashFieldNumber = 3, + kNewCompactionChunkFieldNumber = 4, }; // .backup.FullAuthenticationRequestData authenticationRequestData = 1; bool has_authenticationrequestdata() const; @@ -1976,7 +1978,27 @@ ::backup::BackupKeyEntropy* backupkeyentropy); ::backup::BackupKeyEntropy* unsafe_arena_release_backupkeyentropy(); - // bytes newCompactionChunk = 3; + // bytes newCompactionHash = 3; + bool has_newcompactionhash() const; + private: + bool _internal_has_newcompactionhash() const; + public: + void clear_newcompactionhash(); + const std::string& newcompactionhash() const; + void set_newcompactionhash(const std::string& value); + void set_newcompactionhash(std::string&& value); + void set_newcompactionhash(const char* value); + void set_newcompactionhash(const void* value, size_t size); + std::string* mutable_newcompactionhash(); + std::string* release_newcompactionhash(); + void set_allocated_newcompactionhash(std::string* newcompactionhash); + private: + const std::string& _internal_newcompactionhash() const; + void _internal_set_newcompactionhash(const std::string& value); + std::string* _internal_mutable_newcompactionhash(); + public: + + // bytes newCompactionChunk = 4; bool has_newcompactionchunk() const; private: bool _internal_has_newcompactionchunk() const; @@ -2003,6 +2025,7 @@ class _Internal; void set_has_authenticationrequestdata(); void set_has_backupkeyentropy(); + void set_has_newcompactionhash(); void set_has_newcompactionchunk(); inline bool has_data() const; @@ -2016,6 +2039,7 @@ ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::backup::FullAuthenticationRequestData* authenticationrequestdata_; ::backup::BackupKeyEntropy* backupkeyentropy_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr newcompactionhash_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr newcompactionchunk_; } data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; @@ -5159,7 +5183,117 @@ return _internal_mutable_backupkeyentropy(); } -// bytes newCompactionChunk = 3; +// bytes newCompactionHash = 3; +inline bool CreateNewBackupRequest::_internal_has_newcompactionhash() const { + return data_case() == kNewCompactionHash; +} +inline bool CreateNewBackupRequest::has_newcompactionhash() const { + return _internal_has_newcompactionhash(); +} +inline void CreateNewBackupRequest::set_has_newcompactionhash() { + _oneof_case_[0] = kNewCompactionHash; +} +inline void CreateNewBackupRequest::clear_newcompactionhash() { + if (_internal_has_newcompactionhash()) { + data_.newcompactionhash_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); + clear_has_data(); + } +} +inline const std::string& CreateNewBackupRequest::newcompactionhash() const { + // @@protoc_insertion_point(field_get:backup.CreateNewBackupRequest.newCompactionHash) + return _internal_newcompactionhash(); +} +inline void CreateNewBackupRequest::set_newcompactionhash(const std::string& value) { + _internal_set_newcompactionhash(value); + // @@protoc_insertion_point(field_set:backup.CreateNewBackupRequest.newCompactionHash) +} +inline std::string* CreateNewBackupRequest::mutable_newcompactionhash() { + // @@protoc_insertion_point(field_mutable:backup.CreateNewBackupRequest.newCompactionHash) + return _internal_mutable_newcompactionhash(); +} +inline const std::string& CreateNewBackupRequest::_internal_newcompactionhash() const { + if (_internal_has_newcompactionhash()) { + return data_.newcompactionhash_.Get(); + } + return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); +} +inline void CreateNewBackupRequest::_internal_set_newcompactionhash(const std::string& value) { + if (!_internal_has_newcompactionhash()) { + clear_data(); + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + data_.newcompactionhash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena()); +} +inline void CreateNewBackupRequest::set_newcompactionhash(std::string&& value) { + // @@protoc_insertion_point(field_set:backup.CreateNewBackupRequest.newCompactionHash) + if (!_internal_has_newcompactionhash()) { + clear_data(); + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + data_.newcompactionhash_.Set( + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:backup.CreateNewBackupRequest.newCompactionHash) +} +inline void CreateNewBackupRequest::set_newcompactionhash(const char* value) { + GOOGLE_DCHECK(value != nullptr); + if (!_internal_has_newcompactionhash()) { + clear_data(); + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + data_.newcompactionhash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, + ::std::string(value), GetArena()); + // @@protoc_insertion_point(field_set_char:backup.CreateNewBackupRequest.newCompactionHash) +} +inline void CreateNewBackupRequest::set_newcompactionhash(const void* value, + size_t size) { + if (!_internal_has_newcompactionhash()) { + clear_data(); + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + data_.newcompactionhash_.Set( + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string( + reinterpret_cast(value), size), + GetArena()); + // @@protoc_insertion_point(field_set_pointer:backup.CreateNewBackupRequest.newCompactionHash) +} +inline std::string* CreateNewBackupRequest::_internal_mutable_newcompactionhash() { + if (!_internal_has_newcompactionhash()) { + clear_data(); + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + } + return data_.newcompactionhash_.Mutable( + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); +} +inline std::string* CreateNewBackupRequest::release_newcompactionhash() { + // @@protoc_insertion_point(field_release:backup.CreateNewBackupRequest.newCompactionHash) + if (_internal_has_newcompactionhash()) { + clear_has_data(); + return data_.newcompactionhash_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + } else { + return nullptr; + } +} +inline void CreateNewBackupRequest::set_allocated_newcompactionhash(std::string* newcompactionhash) { + if (has_data()) { + clear_data(); + } + if (newcompactionhash != nullptr) { + set_has_newcompactionhash(); + data_.newcompactionhash_.UnsafeSetDefault(newcompactionhash); + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); + if (arena != nullptr) { + arena->Own(newcompactionhash); + } + } + // @@protoc_insertion_point(field_set_allocated:backup.CreateNewBackupRequest.newCompactionHash) +} + +// bytes newCompactionChunk = 4; inline bool CreateNewBackupRequest::_internal_has_newcompactionchunk() const { return data_case() == kNewCompactionChunk; } diff --git a/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc b/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc --- a/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc +++ b/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc @@ -301,6 +301,7 @@ ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, + ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, PROTOBUF_FIELD_OFFSET(::backup::CreateNewBackupRequest, data_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::backup::CreateNewBackupResponse, _internal_metadata_), @@ -359,12 +360,12 @@ { 58, -1, sizeof(::backup::SimpleAuthenticationRequestData)}, { 65, -1, sizeof(::backup::BackupKeyEntropy)}, { 73, -1, sizeof(::backup::CreateNewBackupRequest)}, - { 82, -1, sizeof(::backup::CreateNewBackupResponse)}, - { 91, -1, sizeof(::backup::SendLogRequest)}, - { 98, -1, sizeof(::backup::RecoverBackupKeyRequest)}, - { 104, -1, sizeof(::backup::RecoverBackupKeyResponse)}, - { 113, -1, sizeof(::backup::PullBackupRequest)}, - { 119, -1, sizeof(::backup::PullBackupResponse)}, + { 83, -1, sizeof(::backup::CreateNewBackupResponse)}, + { 92, -1, sizeof(::backup::SendLogRequest)}, + { 99, -1, sizeof(::backup::RecoverBackupKeyRequest)}, + { 105, -1, sizeof(::backup::RecoverBackupKeyResponse)}, + { 114, -1, sizeof(::backup::PullBackupRequest)}, + { 120, -1, sizeof(::backup::PullBackupResponse)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { @@ -418,46 +419,46 @@ "DataH\000B\006\n\004data\"C\n\037SimpleAuthenticationRe" "questData\022\020\n\010backupID\030\001 \001(\t\022\016\n\006userID\030\002 " "\001(\t\"A\n\020BackupKeyEntropy\022\017\n\005nonce\030\001 \001(\014H\000" - "\022\024\n\nrawMessage\030\002 \001(\014H\000B\006\n\004data\"\300\001\n\026Creat" + "\022\024\n\nrawMessage\030\002 \001(\014H\000B\006\n\004data\"\335\001\n\026Creat" "eNewBackupRequest\022J\n\031authenticationReque" "stData\030\001 \001(\0132%.backup.FullAuthentication" "RequestDataH\000\0224\n\020backupKeyEntropy\030\002 \001(\0132" - "\030.backup.BackupKeyEntropyH\000\022\034\n\022newCompac" - "tionChunk\030\003 \001(\014H\000B\006\n\004data\"\233\001\n\027CreateNewB" - "ackupResponse\022L\n\032authenticationResponseD" - "ata\030\001 \001(\0132&.backup.FullAuthenticationRes" - "ponseDataH\000\022\026\n\014entropyValid\030\002 \001(\010H\000\022\022\n\010b" - "ackupID\030\003 \001(\tH\000B\006\n\004data\"f\n\016SendLogReques" - "t\022C\n\022authenticationData\030\001 \001(\0132\'.backup.S" - "impleAuthenticationRequestData\022\017\n\007logDat" - "a\030\002 \001(\014\"\\\n\027RecoverBackupKeyRequest\022A\n\022au" - "thenticationData\030\001 \001(\0132%.backup.FullAuth" - "enticationRequestData\"\272\001\n\030RecoverBackupK" - "eyResponse\022L\n\032authenticationResponseData" - "\030\001 \001(\0132&.backup.FullAuthenticationRespon" - "seDataH\000\0224\n\020backupKeyEntropy\030\002 \001(\0132\030.bac" - "kup.BackupKeyEntropyH\000\022\022\n\010backupID\030\004 \001(\t" - "H\000B\006\n\004data\"X\n\021PullBackupRequest\022C\n\022authe" - "nticationData\030\001 \001(\0132\'.backup.SimpleAuthe" - "nticationRequestData\"K\n\022PullBackupRespon" - "se\022\031\n\017compactionChunk\030\001 \001(\014H\000\022\022\n\010logChun" - "k\030\002 \001(\014H\000B\006\n\004data2\320\002\n\rBackupService\022X\n\017C" - "reateNewBackup\022\036.backup.CreateNewBackupR" - "equest\032\037.backup.CreateNewBackupResponse\"" - "\000(\0010\001\022=\n\007SendLog\022\026.backup.SendLogRequest" - "\032\026.google.protobuf.Empty\"\000(\001\022[\n\020RecoverB" - "ackupKey\022\037.backup.RecoverBackupKeyReques" - "t\032 .backup.RecoverBackupKeyResponse\"\000(\0010" - "\001\022I\n\nPullBackup\022\031.backup.PullBackupReque" - "st\032\032.backup.PullBackupResponse\"\000(\0010\001b\006pr" - "oto3" + "\030.backup.BackupKeyEntropyH\000\022\033\n\021newCompac" + "tionHash\030\003 \001(\014H\000\022\034\n\022newCompactionChunk\030\004" + " \001(\014H\000B\006\n\004data\"\233\001\n\027CreateNewBackupRespon" + "se\022L\n\032authenticationResponseData\030\001 \001(\0132&" + ".backup.FullAuthenticationResponseDataH\000" + "\022\026\n\014entropyValid\030\002 \001(\010H\000\022\022\n\010backupID\030\003 \001" + "(\tH\000B\006\n\004data\"f\n\016SendLogRequest\022C\n\022authen" + "ticationData\030\001 \001(\0132\'.backup.SimpleAuthen" + "ticationRequestData\022\017\n\007logData\030\002 \001(\014\"\\\n\027" + "RecoverBackupKeyRequest\022A\n\022authenticatio" + "nData\030\001 \001(\0132%.backup.FullAuthenticationR" + "equestData\"\272\001\n\030RecoverBackupKeyResponse\022" + "L\n\032authenticationResponseData\030\001 \001(\0132&.ba" + "ckup.FullAuthenticationResponseDataH\000\0224\n" + "\020backupKeyEntropy\030\002 \001(\0132\030.backup.BackupK" + "eyEntropyH\000\022\022\n\010backupID\030\004 \001(\tH\000B\006\n\004data\"" + "X\n\021PullBackupRequest\022C\n\022authenticationDa" + "ta\030\001 \001(\0132\'.backup.SimpleAuthenticationRe" + "questData\"K\n\022PullBackupResponse\022\031\n\017compa" + "ctionChunk\030\001 \001(\014H\000\022\022\n\010logChunk\030\002 \001(\014H\000B\006" + "\n\004data2\320\002\n\rBackupService\022X\n\017CreateNewBac" + "kup\022\036.backup.CreateNewBackupRequest\032\037.ba" + "ckup.CreateNewBackupResponse\"\000(\0010\001\022=\n\007Se" + "ndLog\022\026.backup.SendLogRequest\032\026.google.p" + "rotobuf.Empty\"\000(\001\022[\n\020RecoverBackupKey\022\037." + "backup.RecoverBackupKeyRequest\032 .backup." + "RecoverBackupKeyResponse\"\000(\0010\001\022I\n\nPullBa" + "ckup\022\031.backup.PullBackupRequest\032\032.backup" + ".PullBackupResponse\"\000(\0010\001b\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_backup_2eproto_deps[1] = { &::descriptor_table_google_2fprotobuf_2fempty_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_backup_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_backup_2eproto = { - false, false, 2524, descriptor_table_protodef_backup_2eproto, "backup.proto", + false, false, 2553, descriptor_table_protodef_backup_2eproto, "backup.proto", &descriptor_table_backup_2eproto_once, descriptor_table_backup_2eproto_deps, 1, 16, schemas, file_default_instances, TableStruct_backup_2eproto::offsets, file_level_metadata_backup_2eproto, file_level_enum_descriptors_backup_2eproto, file_level_service_descriptors_backup_2eproto, @@ -3053,6 +3054,10 @@ _internal_mutable_backupkeyentropy()->::backup::BackupKeyEntropy::MergeFrom(from._internal_backupkeyentropy()); break; } + case kNewCompactionHash: { + _internal_set_newcompactionhash(from._internal_newcompactionhash()); + break; + } case kNewCompactionChunk: { _internal_set_newcompactionchunk(from._internal_newcompactionchunk()); break; @@ -3106,6 +3111,10 @@ } break; } + case kNewCompactionHash: { + data_.newcompactionhash_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); + break; + } case kNewCompactionChunk: { data_.newcompactionchunk_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); break; @@ -3149,9 +3158,17 @@ CHK_(ptr); } else goto handle_unusual; continue; - // bytes newCompactionChunk = 3; + // bytes newCompactionHash = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + auto str = _internal_mutable_newcompactionhash(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else goto handle_unusual; + continue; + // bytes newCompactionChunk = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { auto str = _internal_mutable_newcompactionchunk(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); @@ -3201,10 +3218,16 @@ 2, _Internal::backupkeyentropy(this), target, stream); } - // bytes newCompactionChunk = 3; + // bytes newCompactionHash = 3; + if (_internal_has_newcompactionhash()) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_newcompactionhash(), target); + } + + // bytes newCompactionChunk = 4; if (_internal_has_newcompactionchunk()) { target = stream->WriteBytesMaybeAliased( - 3, this->_internal_newcompactionchunk(), target); + 4, this->_internal_newcompactionchunk(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -3238,7 +3261,14 @@ *data_.backupkeyentropy_); break; } - // bytes newCompactionChunk = 3; + // bytes newCompactionHash = 3; + case kNewCompactionHash: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_newcompactionhash()); + break; + } + // bytes newCompactionChunk = 4; case kNewCompactionChunk: { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( @@ -3289,6 +3319,10 @@ _internal_mutable_backupkeyentropy()->::backup::BackupKeyEntropy::MergeFrom(from._internal_backupkeyentropy()); break; } + case kNewCompactionHash: { + _internal_set_newcompactionhash(from._internal_newcompactionhash()); + break; + } case kNewCompactionChunk: { _internal_set_newcompactionchunk(from._internal_newcompactionchunk()); break; 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 @@ -11,103 +11,34 @@ rpc PullBackup(stream PullBackupRequest) returns (stream PullBackupResponse) {} } -// Helper types - -message PakeRegistrationRequestAndUserID { - string userID = 1; - bytes pakeRegistrationRequest = 2; -} - -message PakeAuthenticationRequestData { - oneof data { - PakeRegistrationRequestAndUserID pakeRegistrationRequestAndUserID = 1; - bytes pakeRegistrationUpload = 2; - bytes pakeCredentialRequest = 3; - bytes pakeCredentialFinalization = 4; - bytes pakeClientMAC = 5; - } -} - -message WalletAuthenticationRequestData { - string userID = 1; - string walletAddress = 2; - bytes signedMessage = 3; -} - -message FullAuthenticationRequestData { - oneof data { - PakeAuthenticationRequestData pakeAuthenticationRequestData = 1; - WalletAuthenticationRequestData walletAuthenticationRequestData = 2; - } -} - -message WalletAuthenticationResponseData { - bool success = 1; -} - -message PakeAuthenticationResponseData { - oneof data { - bytes pakeRegistrationResponse = 1; - bool pakeRegistrationSuccess = 2; - bytes pakeCredentialResponse = 3; - bytes pakeServerMAC = 4; - } -} - -message FullAuthenticationResponseData { - oneof data { - PakeAuthenticationResponseData pakeAuthenticationResponseData = 1; - WalletAuthenticationResponseData walletAuthenticationResponseData = 2; - } -} - -message SimpleAuthenticationRequestData { - string backupID = 1; - string userID = 2; -} - -message BackupKeyEntropy { - oneof data { - bytes nonce = 1; - bytes rawMessage = 2; - } -} - // CreateNewBackup message CreateNewBackupRequest { oneof data { - FullAuthenticationRequestData authenticationRequestData = 1; - BackupKeyEntropy backupKeyEntropy = 2; + bytes keyEntropy = 1; + bytes newCompactionHash = 2; bytes newCompactionChunk = 3; } } message CreateNewBackupResponse { - oneof data { - FullAuthenticationResponseData authenticationResponseData = 1; - bool entropyValid = 2; - string backupID = 3; - } + string backupID = 1; } // SendLog message SendLogRequest { - SimpleAuthenticationRequestData authenticationData = 1; - bytes logData = 2; + bytes logData = 1; } // RecoverBackupKey message RecoverBackupKeyRequest { - FullAuthenticationRequestData authenticationData = 1; + string userID = 1; } message RecoverBackupKeyResponse { oneof data { - FullAuthenticationResponseData authenticationResponseData = 1; - BackupKeyEntropy backupKeyEntropy = 2; string backupID = 4; } } @@ -115,7 +46,7 @@ // PullBackup message PullBackupRequest { - SimpleAuthenticationRequestData authenticationData = 1; + string userID = 1; } message PullBackupResponse {