Migrating to native Julia code

Part 1 of migrating to pure Julia code instead of calling liboauth, in
an attempt to not call liboauth at all.