Inheritance: LinqToDB.Data.DataConnection
        public static bool HandleAuthSession(GatewayConnection client, BinaryReader br)
        {
            var pkt = PacketHelper.Parse<CMSG_AUTH_SESSION>(br);

            // TODO: verify build

            client.Crypt = new AuthCrypt(LoginService.GetSessionKey(pkt.Account));

            var serverDigest = HashUtil.ComputeHash(Encoding.ASCII.GetBytes(pkt.Account),
                new byte[] { 0, 0, 0, 0 },
                BitConverter.GetBytes(pkt.ClientSeed),
                BitConverter.GetBytes(client.Seed),
                client.Crypt.SessionKey);
            if (!serverDigest.SequenceEqual(pkt.ClientDigest))
                return false;

            // TODO: Move to LoginService?
            using (var db = new DBLogin())
            {
                var acc = db.Account.FirstOrDefault(a => a.Username == pkt.Account);
                client.AccountName = acc.Username;
                client.AccountID = acc.AccountID;
            }

            client.SendPacket(WorldOpcodes.SMSG_AUTH_RESPONSE, PacketHelper.Build(new SMSG_AUTH_RESPONSE
            {
                Response = (byte)ResponseCodes.AUTH_OK,
                BillingTimeRemaining = 0,
                BillingPlanFlags = 0,
                BillingTimeRested = 0
            }));

            return true;
        }
        private void InitTestDb()
        {
            if (!File.Exists("Login.sqlite"))
            {
                using (var db = new DBLogin())
                {
                    db.CreateTable<Account>();
                    db.CreateTable<Session>();
                }
            }

            if (!LoginService.ExistsAccount("testuser"))
                LoginService.CreateAccount("testuser", "*****@*****.**", "TestPass");
        }