KeeOff Android: My carry-on password manager
Tags: android, javascript, keepass, showdev
Published: 2018-08-21 19:21:44

---
title: KeeOff Android: My carry-on password manager
published: true
description: KeePass password manager for android that can be accessed on other devices from the same local network.
tags: Android, JavaScript, KeePass, showdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xc4aegs37ah05qi1t5nr.png
---

#What is _KeeOff Android_ and why am I making it?
Like many others I use a password manager, the one I've chosen being [_KeePass_](https://keepass.info/). My current setup is quite simple, have the database lie remotely on a server hosted by _Digital Ocean_ which I connect to from the client on my computer and phone, keeps it nice and synced. However, if I ever want to use my passwords on another device, I won't be able to get any of them without first getting a client onto the device. Sure, I can go around with a USB everywhere I go with a client or maybe just a SD card, but I'm _lazier_ than that.

My solution? Making an Android app that launches a web server that is able to access my password database on the phone on the same local network. Simple right? Yeah I thought so at first too, I wanted to cheat a little and make it easy on myself, but ended up having to start from square two (because of some help).

##Let down by _KeeWeb_, but they _do_ have a nice library...
What I wanted was just to use a web based password manager called [_KeeWeb_](https://github.com/keeweb/keeweb) and serve it with a server and then everything would be fine and dandy. __But__ I forgot some things...

KeeWeb uses JavaScript so everything is run in the browser, it is intended for you to use it just as an interface, enter it, select and navigate to a database file on your local device or a remote service using something like WebDav or Dropbox. Not what I was looking for since I want the database file to be stored on my phone, loaded from it and saved to it. No FTP support. Darn.

However other users wanted the same kind of feature as me, but the devs aren't interested in making such a feature, so one person took it upon himself to make a [plugin](https://github.com/vavrecan/keeweb-local-server) for it. Great! __But__ it requires use of PHP for saving the database on the server, I even thought about making my own plugin but I couldn't find any documentation on how their structure work, only some basic infos and examples - not enough for me wanting to jump out into it.

I could use the guys plugin, but I quickly found out that trying to run PHP code as a server in Java was big task on its own - tried a project called [Resin/Quercus](http://quercus.caucho.com/) but couldn't get it to work. Scratch that then.

#Starting from square-two
Luckily I didn't have to start totally from the bottom, as mentioned in the other title, KeeWeb has a great JavaScript library for KeePass v2 databases. Thank _some unknown entity_ for that, I don't trust myself to being able to implement something that can work with KeePass's databases, I only know basic cryptography concepts so no way it would be secure if I made it.

So I snatched that and then found a great web server in Java called [_NanoHTTPD_](https://github.com/NanoHttpd/nanohttpd) that is lightweight and easy to use.

Awesome. Now all I had to do is make all of the UI myself and use KeeWeb's library to _communicate_ with the database, iterate over results, display them, make events for when items are clicked. All that fun JavaScript stuff.

#Still Work-In-Progress
All the basic features for managing the database is there, can create new groups and entries, can move, rename, and delete them, can edit and get data from entries.

__Just one drawback...__ It can't save. Yeah, pretty big core feature missing that makes the project useless without it. As far as my understanding of the problem goes, NanoHTTPD encodes the data, or at least does something to it, that messes up what the server receives. I've created an [_issue_](https://github.com/NanoHttpd/nanohttpd/issues/507) and still waiting an answer, I can see from the _Network Inspector_ tab in my browser that it is sending the send the correct data to the server, but it is not the same that it receives. Trying to encode it before sending doesn't help neither.

The project will be published to my [GitHub](https://github.com/mikkel1156) when I think it is suitable (maybe when save function finally works) or might do it if a number of people request it out of interest etc.

##Things missing
Apart from the saving function I also still need to implement:
* SSL communication
* App can change master password
* A password generator for password fields
* Other small features and fixes