AuthChallenges.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <algorithm>
  3. #include <climits>
  4. #include <functional>
  5. #include <memory>
  6. #include <random>
  7. #include <vector>
  8. #include "Crypto.h"
  9. #include "Logger.h"
  10. #include "NanoPBHelper.h"
  11. #include "Utils.h"
  12. #include "protobuf/authentication.pb.h"
  13. #include "protobuf/keyexchange.pb.h"
  14. namespace cspot {
  15. class AuthChallenges {
  16. public:
  17. AuthChallenges();
  18. ~AuthChallenges();
  19. std::vector<uint8_t> shanSendKey = {};
  20. std::vector<uint8_t> shanRecvKey = {};
  21. std::vector<uint8_t> prepareAuthPacket(std::vector<uint8_t>& authBlob,
  22. int authType,
  23. const std::string& deviceId,
  24. const std::string& username);
  25. std::vector<uint8_t> solveApHello(std::vector<uint8_t>& helloPacket,
  26. std::vector<uint8_t>& data);
  27. std::vector<uint8_t> prepareClientHello();
  28. private:
  29. const long long SPOTIFY_VERSION = 0x10800000000;
  30. ClientResponseEncrypted authRequest;
  31. ClientResponsePlaintext clientResPlaintext;
  32. ClientHello clientHello;
  33. APResponseMessage apResponse;
  34. std::unique_ptr<Crypto> crypto;
  35. };
  36. } // namespace cspot