Skip to content
Snippets Groups Projects
identity_service.hh 1.46 KiB
Newer Older
  • Learn to ignore specific revisions
  • Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    #ifndef __VEREIGN_SERVICE_IDENITY_SERVICE_HH
    #define __VEREIGN_SERVICE_IDENITY_SERVICE_HH
    
    #include <vereign/identity/provider.hh>
    #include <vereign/client_library/common_types.pb.h>
    #include <vereign/client_library/identity_types.pb.h>
    #include <vereign/client_library/types.gen.pb.h>
    #include <vereign/restapi/post_result.hh>
    #include <vereign/service/gen/identity_service.hh>
    
    #include <future>
    
    namespace vereign {
    
    namespace restapi {
      class ClientSession;
    }
    
    namespace service {
    
    template <class Request, class Response>
    using Result = restapi::PostResult<Request, Response>;
    
    class IdentityService : public gen::IdentityService {
    public:
      IdentityService(
        identity::Provider& identity_provider,
        restapi::ClientSession& client_session
      );
    
      IdentityService(const IdentityService&) = delete;
      auto operator=(const IdentityService&) -> IdentityService& = delete;
    
      void LoginWithExistingPubKey(
        const client_library::LoginWithExistingPubKeyForm* req,
        client_library::EmptyResponse* resp
      );
    
      void LoginWithNewDevice(
        const client_library::LoginFormNewDevice* req,
        client_library::LoginFormNewDeviceResponse* resp
      );
    
      void LoginWithPreviouslyAddedDevice(
        const client_library::LoginFormPreviousAddedDevice* req,
        client_library::EmptyResponse* resp
      );
    
    private:
      identity::Provider& identity_provider_;
      restapi::ClientSession& client_session_;
    };
    
    } // namespace service
    } // namespace vereign
    
    
    #endif // __VEREIGN_SERVICE_IDENITY_SERVICE_HH