ChatHive

2 minute read Published:

ChatHive is an Android app that allows you to talk to a robot at any time.

Built on ChatEngine, ChatHive provides a simple but effective interface to the chatbot.

You can get the app here on Google Play.

Internals

The app is a fairly simple Android app written in Kotlin. It uses several native Kotlin libraries and was mainly a first app to learn Android and Kotlin. Heavy use is made of KotlinX for neater references of widgets.

Thoughts

Disclaimer: these are only my personal thoughts. Take them with a grain of salt.

The Android platform is such a mess. Why should activities be completely recreated just to rotate the screen? Why is everything written in XML? Why does such a simple layout take so long to build?

It’s definitely not the worst platform ever, though.

Preventing spam

Because this is a public app that is susceptible to spam, precautions had to be taken. Firstly, a ratelimit was implemented with special messages to inform users of the limit. The ratelimit had to be implemented on the server side to prevent client modifications bypassing the limit.

Next, how does the app authenticate? How is the token/key kept secure? The easiest and most secure solution was to have it generated on-the-fly by a native library, and directly added to the request data without meeting the JVM.

There was a fair share of segmentation faults and memory corruption, but after challenging several users to obtain the key, nobody was able to recover it. The closest anyone got was only a segment of the full key.

If you do manage to get the key, please tell me! I’d love to hear of how you were able to extract it from the native library.