GOG GALAXY SDK Documentation
IUser.h
Go to the documentation of this file.
1 #ifndef GALAXY_I_USER_H
2 #define GALAXY_I_USER_H
3 
9 #include "GalaxyID.h"
10 #include "IListenerRegistrar.h"
11 
12 namespace galaxy
13 {
14  namespace api
15  {
24  typedef uint64_t SessionID;
25 
30  {
31  public:
32 
36  virtual void OnAuthSuccess() = 0;
37 
42  {
51  };
52 
58  virtual void OnAuthFailure(FailureReason failureReason) = 0;
59 
65  virtual void OnAuthLost() = 0;
66  };
67 
72 
77 
81  class IOtherSessionStartListener : public GalaxyTypeAwareListener<OTHER_SESSION_START>
82  {
83  public:
84 
88  virtual void OnOtherSessionStarted() = 0;
89  };
90 
95 
100 
104  class IOperationalStateChangeListener : public GalaxyTypeAwareListener<OPERATIONAL_STATE_CHANGE>
105  {
106  public:
107 
112  {
115  };
116 
122  virtual void OnOperationalStateChanged(uint32_t operationalState) = 0;
123  };
124 
129 
134 
141  class IUserDataListener : public GalaxyTypeAwareListener<USER_DATA>
142  {
143  public:
144 
148  virtual void OnUserDataUpdated() = 0;
149  };
150 
155 
160 
164  class ISpecificUserDataListener : public GalaxyTypeAwareListener<SPECIFIC_USER_DATA>
165  {
166  public:
167 
173  virtual void OnSpecificUserDataUpdated(GalaxyID userID) = 0;
174  };
175 
180 
185 
189  class IEncryptedAppTicketListener : public GalaxyTypeAwareListener<ENCRYPTED_APP_TICKET_RETRIEVE>
190  {
191  public:
192 
199 
204  {
207  };
208 
214  virtual void OnEncryptedAppTicketRetrieveFailure(FailureReason failureReason) = 0;
215  };
216 
221 
226 
227 
231  class IAccessTokenListener : public GalaxyTypeAwareListener<ACCESS_TOKEN_CHANGE>
232  {
233  public:
234 
240  virtual void OnAccessTokenChanged() = 0;
241  };
242 
247 
252 
256  class IUser
257  {
258  public:
259 
260  virtual ~IUser()
261  {
262  }
263 
281  virtual bool SignedIn() = 0;
282 
288  virtual GalaxyID GetGalaxyID() = 0;
289 
306  virtual void SignInCredentials(const char* login, const char* password, IAuthListener* const listener = NULL) = 0;
307 
323  virtual void SignInToken(const char* refreshToken, IAuthListener* const listener = NULL) = 0;
324 
338  virtual void SignInLauncher(IAuthListener* const listener = NULL) = 0;
339 
354  virtual void SignInSteam(const void* steamAppTicket, uint32_t steamAppTicketSize, const char* personaName, IAuthListener* const listener = NULL) = 0;
355 
368  virtual void SignInGalaxy(bool requireOnline = false, IAuthListener* const listener = NULL) = 0;
369 
384  virtual void SignInUWP(IAuthListener* const listener = NULL) = 0;
385 
398  virtual void SignInPS4(const char* ps4ClientID, IAuthListener* const listener = NULL) = 0;
399 
412  virtual void SignInXB1(const char* xboxOneUserID, IAuthListener* const listener = NULL) = 0;
413 
429  virtual void SignInXBLive(const char* token, const char* signature, const char* marketplaceID, const char* locale, IAuthListener* const listener = NULL) = 0;
430 
442  virtual void SignInAnonymous(IAuthListener* const listener = NULL) = 0;
443 
454  virtual void SignInAnonymousTelemetry(IAuthListener* const listener = NULL) = 0;
455 
472  virtual void SignInServerKey(const char* serverKey, IAuthListener* const listener = NULL) = 0;
473 
482  virtual void SignOut() = 0;
483 
492  virtual void RequestUserData(GalaxyID userID = GalaxyID(), ISpecificUserDataListener* const listener = NULL) = 0;
493 
502  virtual bool IsUserDataAvailable(GalaxyID userID = GalaxyID()) = 0;
503 
515  virtual const char* GetUserData(const char* key, GalaxyID userID = GalaxyID()) = 0;
516 
527  virtual void GetUserDataCopy(const char* key, char* buffer, uint32_t bufferLength, GalaxyID userID = GalaxyID()) = 0;
528 
540  virtual void SetUserData(const char* key, const char* value, ISpecificUserDataListener* const listener = NULL) = 0;
541 
550  virtual uint32_t GetUserDataCount(GalaxyID userID = GalaxyID()) = 0;
551 
565  virtual bool GetUserDataByIndex(uint32_t index, char* key, uint32_t keyLength, char* value, uint32_t valueLength, GalaxyID userID = GalaxyID()) = 0;
566 
578  virtual void DeleteUserData(const char* key, ISpecificUserDataListener* const listener = NULL) = 0;
579 
592  virtual bool IsLoggedOn() = 0;
593 
603  virtual void RequestEncryptedAppTicket(const void* data, uint32_t dataSize, IEncryptedAppTicketListener* const listener = NULL) = 0;
604 
617  virtual void GetEncryptedAppTicket(void* encryptedAppTicket, uint32_t maxEncryptedAppTicketSize, uint32_t& currentEncryptedAppTicketSize) = 0;
618 
624  virtual SessionID GetSessionID() = 0;
625 
638  virtual const char* GetAccessToken() = 0;
639 
651  virtual void GetAccessTokenCopy(char* buffer, uint32_t bufferLength) = 0;
652 
674  virtual bool ReportInvalidAccessToken(const char* accessToken, const char* info = NULL) = 0;
675  };
676 
678  }
679 }
680 
681 #endif
Contains GalaxyID, which is the class that represents the ID of an entity used by Galaxy Peer.
Contains data structures and interfaces related to callback listeners.
Represents the ID of an entity used by Galaxy Peer.
Definition: GalaxyID.h:30
The class that is inherited by all specific callback listeners and provides a static method that retu...
Definition: IListenerRegistrar.h:110
Listener for the event of a change of current access token.
Definition: IUser.h:232
virtual void OnAccessTokenChanged()=0
Notification for an event of retrieving an access token.
Listener for the events related to user authentication.
Definition: IUser.h:30
virtual void OnAuthLost()=0
Notification for the event of loosing authentication.
FailureReason
Reason of authentication failure.
Definition: IUser.h:42
@ FAILURE_REASON_GALAXY_SERVICE_NOT_AVAILABLE
Galaxy Service is not installed properly or fails to start.
Definition: IUser.h:44
@ FAILURE_REASON_GALAXY_SERVICE_NOT_SIGNED_IN
Galaxy Service is not signed in properly.
Definition: IUser.h:45
@ FAILURE_REASON_UNDEFINED
Undefined error.
Definition: IUser.h:43
@ FAILURE_REASON_INVALID_CREDENTIALS
Unable to match client credentials (ID, secret) or user credentials (username, password).
Definition: IUser.h:48
@ FAILURE_REASON_EXTERNAL_SERVICE_FAILURE
Unable to communicate with external service.
Definition: IUser.h:50
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:46
@ FAILURE_REASON_NO_LICENSE
User that is being signed in has no license for this application.
Definition: IUser.h:47
@ FAILURE_REASON_GALAXY_NOT_INITIALIZED
Galaxy has not been initialized.
Definition: IUser.h:49
virtual void OnAuthSuccess()=0
Notification for the event of successful sign in.
virtual void OnAuthFailure(FailureReason failureReason)=0
Notification for the event of unsuccessful sign in.
Listener for the event of retrieving a requested Encrypted App Ticket.
Definition: IUser.h:190
FailureReason
The reason of a failure in retrieving an Encrypted App Ticket.
Definition: IUser.h:204
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IUser.h:205
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:206
virtual void OnEncryptedAppTicketRetrieveFailure(FailureReason failureReason)=0
Notification for the event of a failure in retrieving an Encrypted App Ticket.
virtual void OnEncryptedAppTicketRetrieveSuccess()=0
Notification for an event of a success in retrieving the Encrypted App Ticket.
Listener for the event of a change of the operational state.
Definition: IUser.h:105
virtual void OnOperationalStateChanged(uint32_t operationalState)=0
Notification for the event of a change of the operational state.
OperationalState
Aspect of the operational state.
Definition: IUser.h:112
@ OPERATIONAL_STATE_LOGGED_ON
User logged on.
Definition: IUser.h:114
@ OPERATIONAL_STATE_SIGNED_IN
User signed in.
Definition: IUser.h:113
Listener for the events related to starting of other sessions.
Definition: IUser.h:82
virtual void OnOtherSessionStarted()=0
Notification for the event of other session being started.
Listener for the events related to user data changes.
Definition: IUser.h:165
virtual void OnSpecificUserDataUpdated(GalaxyID userID)=0
Notification for the event of user data change.
Listener for the events related to user data changes of current user only.
Definition: IUser.h:142
virtual void OnUserDataUpdated()=0
Notification for the event of user data change.
The interface for handling the user account.
Definition: IUser.h:257
virtual void SignOut()=0
Signs the Galaxy Peer out.
virtual void SignInToken(const char *refreshToken, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with refresh token.
virtual bool GetUserDataByIndex(uint32_t index, char *key, uint32_t keyLength, char *value, uint32_t valueLength, GalaxyID userID=GalaxyID())=0
Returns a property from the user data storage by index.
virtual void RequestEncryptedAppTicket(const void *data, uint32_t dataSize, IEncryptedAppTicketListener *const listener=NULL)=0
Performs a request for an Encrypted App Ticket.
virtual void SetUserData(const char *key, const char *value, ISpecificUserDataListener *const listener=NULL)=0
Creates or updates an entry in the user data storage.
virtual bool IsLoggedOn()=0
Checks if the user is logged on to Galaxy backend services.
virtual GalaxyID GetGalaxyID()=0
Returns the ID of the user, provided that the user is signed in.
virtual void SignInXB1(const char *xboxOneUserID, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on XBOX ONE credentials.
virtual const char * GetAccessToken()=0
Returns the access token for current session.
virtual bool ReportInvalidAccessToken(const char *accessToken, const char *info=NULL)=0
Reports current access token as no longer working.
virtual void SignInGalaxy(bool requireOnline=false, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Galaxy Client authentication.
virtual void SignInServerKey(const char *serverKey, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with a specified server key.
virtual void SignInAnonymousTelemetry(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer anonymously.
virtual void SignInXBLive(const char *token, const char *signature, const char *marketplaceID, const char *locale, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Xbox Live tokens.
virtual bool IsUserDataAvailable(GalaxyID userID=GalaxyID())=0
Checks if user data exists.
virtual void SignInSteam(const void *steamAppTicket, uint32_t steamAppTicketSize, const char *personaName, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Steam Encrypted App Ticket.
virtual void SignInPS4(const char *ps4ClientID, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on PS4 credentials.
virtual void RequestUserData(GalaxyID userID=GalaxyID(), ISpecificUserDataListener *const listener=NULL)=0
Retrieves/Refreshes user data storage.
virtual void GetEncryptedAppTicket(void *encryptedAppTicket, uint32_t maxEncryptedAppTicketSize, uint32_t &currentEncryptedAppTicketSize)=0
Returns the Encrypted App Ticket.
virtual void GetAccessTokenCopy(char *buffer, uint32_t bufferLength)=0
Copies the access token for current session.
virtual void SignInAnonymous(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Game Server anonymously.
virtual SessionID GetSessionID()=0
Returns the ID of current session.
virtual const char * GetUserData(const char *key, GalaxyID userID=GalaxyID())=0
Returns an entry from the data storage of current user.
virtual bool SignedIn()=0
Checks if the user is signed in to Galaxy.
virtual void SignInUWP(IAuthListener *const listener=NULL)=0
virtual void SignInCredentials(const char *login, const char *password, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with specified user credentials.
virtual uint32_t GetUserDataCount(GalaxyID userID=GalaxyID())=0
Returns the number of entries in the user data storage.
virtual void SignInLauncher(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on launcher authentication.
virtual void GetUserDataCopy(const char *key, char *buffer, uint32_t bufferLength, GalaxyID userID=GalaxyID())=0
Copies an entry from the data storage of current user.
virtual void DeleteUserData(const char *key, ISpecificUserDataListener *const listener=NULL)=0
Clears a property of user data storage.
The class that is inherited by the self-registering versions of all specific callback listeners.
Definition: IListenerRegistrar.h:204
SelfRegisteringListener< IAccessTokenListener, GameServerListenerRegistrar > GameServerGlobalAccessTokenListener
Globally self-registering version of IAccessTokenListener for the GameServer.
Definition: IUser.h:251
SelfRegisteringListener< IOperationalStateChangeListener, GameServerListenerRegistrar > GameServerGlobalOperationalStateChangeListener
Globally self-registering version of IOperationalStateChangeListener for the GameServer.
Definition: IUser.h:133
SelfRegisteringListener< IOtherSessionStartListener > GlobalOtherSessionStartListener
Globally self-registering version of IOtherSessionStartListener.
Definition: IUser.h:94
SelfRegisteringListener< ISpecificUserDataListener > GlobalSpecificUserDataListener
Globally self-registering version of ISpecificUserDataListener.
Definition: IUser.h:179
SelfRegisteringListener< IUserDataListener > GlobalUserDataListener
Globally self-registering version of IUserDataListener.
Definition: IUser.h:154
SelfRegisteringListener< IEncryptedAppTicketListener, GameServerListenerRegistrar > GameServerGlobalEncryptedAppTicketListener
Globally self-registering version of IEncryptedAppTicketListener for the Game Server.
Definition: IUser.h:225
SelfRegisteringListener< IAuthListener > GlobalAuthListener
Globally self-registering version of IAuthListener.
Definition: IUser.h:71
SelfRegisteringListener< IUserDataListener, GameServerListenerRegistrar > GameServerGlobalUserDataListener
Globally self-registering version of IUserDataListener for the GameServer.
Definition: IUser.h:159
SelfRegisteringListener< IOperationalStateChangeListener > GlobalOperationalStateChangeListener
Globally self-registering version of IOperationalStateChangeListener.
Definition: IUser.h:128
SelfRegisteringListener< IAccessTokenListener > GlobalAccessTokenListener
Globally self-registering version of IAccessTokenListener.
Definition: IUser.h:246
SelfRegisteringListener< IOtherSessionStartListener, GameServerListenerRegistrar > GameServerGlobalOtherSessionStartListener
Globally self-registering version of IOtherSessionStartListener for the Game Server.
Definition: IUser.h:99
uint64_t SessionID
The ID of the session.
Definition: IUser.h:24
SelfRegisteringListener< IEncryptedAppTicketListener > GlobalEncryptedAppTicketListener
Globally self-registering version of IEncryptedAppTicketListener.
Definition: IUser.h:220
SelfRegisteringListener< ISpecificUserDataListener, GameServerListenerRegistrar > GameServerGlobalSpecificUserDataListener
Globally self-registering version of ISpecificUserDataListener for the Game Server.
Definition: IUser.h:184
SelfRegisteringListener< IAuthListener, GameServerListenerRegistrar > GameServerGlobalAuthListener
Globally self-registering version of IAuthListener for the Game Server.
Definition: IUser.h:76