Hardened API

HEY! LISTEN! Don't commit this until after my other pull request (the names branch). This contains all those changes for now, simply because <strike>git is insane</strike> it needs to, but those are not related. Once that is merged, this should be a significantly smaller commit.

ANYWAY! This hardens the server's API endpoints. It does not touch the client code yet. Hardening those will come in a subsequent commit. 

KNOWN ISSUE: Does not support messages with optional keys yet. This isn't needed yet, but it WILL eventually be. I haven't figured out the easiest way TO do that yet. So, that will be fixed by the time it is needed.