/// <summary> /// Sends a generic login request /// </summary> public void SignIn(DictionaryOptions data, SignInCallback callback, IClientSocket connection) { Logs.Debug("Signing in..."); if (!connection.IsConnected) { callback.Invoke(null, "Not connected to server"); return; } IsNowSigningIn = true; // We first need to get an aes key // so that we can encrypt our login data Msf.Security.GetAesKey(aesKey => { if (aesKey == null) { IsNowSigningIn = false; callback.Invoke(null, "Failed to log in due to security issues"); return; } var encryptedData = Msf.Security.EncryptAES(data.ToBytes(), aesKey); connection.SendMessage((short)MsfMessageCodes.SignInRequest, encryptedData, (status, response) => { IsNowSigningIn = false; if (status != ResponseStatus.Success) { ClearAuthToken(); callback.Invoke(null, response.AsString("Unknown error")); return; } AccountInfo = response.Deserialize(new AccountInfoPacket()); IsSignedIn = true; if (RememberMe) { SaveAuthToken(AccountInfo.Token); } else { ClearAuthToken(); } callback.Invoke(AccountInfo, null); OnSignedInEvent?.Invoke(); }); }, connection); }