52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
/**************************************************************************/
|
|
/* aethex_auth.h */
|
|
/**************************************************************************/
|
|
/* AeThex Engine */
|
|
/* https://aethex.dev */
|
|
/**************************************************************************/
|
|
|
|
#ifndef AETHEX_AUTH_H
|
|
#define AETHEX_AUTH_H
|
|
|
|
#include "core/object/ref_counted.h"
|
|
|
|
class AethexCloud;
|
|
|
|
class AethexAuth : public RefCounted {
|
|
GDCLASS(AethexAuth, RefCounted);
|
|
|
|
private:
|
|
AethexCloud *cloud = nullptr;
|
|
|
|
String user_id;
|
|
String username;
|
|
String email;
|
|
bool logged_in = false;
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
void set_cloud(AethexCloud *p_cloud);
|
|
|
|
// Auth methods
|
|
Dictionary login(const String &p_email, const String &p_password);
|
|
Dictionary register_account(const String &p_username, const String &p_email, const String &p_password);
|
|
Dictionary get_profile();
|
|
void logout();
|
|
|
|
// Async versions
|
|
void login_async(const String &p_email, const String &p_password, const Callable &p_callback);
|
|
void register_async(const String &p_username, const String &p_email, const String &p_password, const Callable &p_callback);
|
|
|
|
// Status
|
|
bool is_logged_in() const;
|
|
String get_user_id() const;
|
|
String get_username() const;
|
|
String get_email() const;
|
|
|
|
AethexAuth();
|
|
~AethexAuth();
|
|
};
|
|
|
|
#endif // AETHEX_AUTH_H
|