AuthChallenges.h 1.3 KB

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