2
0

LoginBlob.h 1003 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef LOGINBLOB_H
  2. #define LOGINBLOB_H
  3. #include <vector>
  4. #include <memory>
  5. #include <iostream>
  6. #include "Crypto.h"
  7. #include "protobuf/authentication.pb.h"
  8. class LoginBlob
  9. {
  10. private:
  11. int blobSkipPosition = 0;
  12. std::unique_ptr<Crypto> crypto;
  13. uint32_t readBlobInt(const std::vector<uint8_t>& loginData);
  14. std::vector<uint8_t> decodeBlob(const std::vector<uint8_t>& blob, const std::vector<uint8_t>& sharedKey);
  15. std::vector<uint8_t> decodeBlobSecondary(const std::vector<uint8_t>& blob, const std::string& username, const std::string& deviceId);
  16. public:
  17. LoginBlob();
  18. std::vector<uint8_t> authData;
  19. std::string username;
  20. int authType;
  21. // Loading
  22. void loadZeroconf(const std::vector<uint8_t>& blob, const std::vector<uint8_t>& sharedKey, const std::string& deviceId, const std::string& username);
  23. void loadUserPass(const std::string& username, const std::string& password);
  24. void loadJson(const std::string& json);
  25. std::string toJson();
  26. };
  27. #endif