diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 767e02db..d7e22148 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -17,6 +17,7 @@ #include "td/telegram/TdDb.h" #include "td/utils/as.h" +#include "td/utils/base64.h" #include "td/utils/format.h" #include "td/utils/JsonBuilder.h" #include "td/utils/logging.h" @@ -2103,10 +2104,15 @@ Result NotificationManager::get_push_receiver_id(string payload) { return Status::Error(400, "Expected encrypted payload as a String"); } Slice data = encrypted_payload.get_string(); - if (data.size() < 8) { + if (data.size() < 12) { return Status::Error(400, "Encrypted payload is too small"); } - return as(data.data()); + auto r_decoded = base64url_decode(data.substr(0, 12)); + if (r_decoded.is_error()) { + return Status::Error(400, "Failed to base64url-decode payload"); + } + CHECK(r_decoded.ok().size() == 9); + return as(r_decoded.ok().c_str()); } if (field_value.first == "user_id") { auto user_id = std::move(field_value.second); diff --git a/tdactor/td/actor/MultiPromise.h b/tdactor/td/actor/MultiPromise.h index 9aa2dfd9..153fc04a 100644 --- a/tdactor/td/actor/MultiPromise.h +++ b/tdactor/td/actor/MultiPromise.h @@ -20,7 +20,6 @@ class MultiPromiseInterface { virtual void add_promise(Promise<> &&promise) = 0; virtual Promise<> get_promise() = 0; - // deprecated? virtual size_t promise_count() const = 0; virtual void set_ignore_errors(bool ignore_errors) = 0;