Hi (again) everyone,
(As you might have noticed my previous patches got eaten by the mailer daemon :-) I have now split my patches in to additional commits and I hope they will be accepted by the system. I also agree with Nathaniel that they are way easier to follow now as well. For convenience I also include the original cover letter below.)
My name is Petter and I am working for the Swedish company Fidesm AB. We are building a platform for managing Secure Elements (such as NFC cards) via the network. One of the first services that can be deliverd via our platform is an OTP application developed by Yubico (https://github.com/Yubico/ykneo-oath). To enable us to use this application to store our OTP credentials we wanted to integrate it into a good OTP Android App. This patch enables any supported external NFC token to be used with FreeOTP. Currently the only two tokens using ths protocol that we know of are the Fidesmo Card and the Yubico Yubikey. I am more than willing to add support for any other device which is using the same protocol.
The strategy taken to integrate this into FreeOTP was first to generalize the TokenPersistence and Token classes to accomodate both internal and external tokens. This is the first commit/patch. On top of this the NFC functionality was built. To manage the NFC tag efficiently (i.e. not to have the user tap it more than neccessary), we decided to handle it only in the main activity. This required the other activities to return their results rather than manage the TokenPersistence directly. This is a very common pattern in Android and we believe that end result was actually quite nice, clearly separating managing the tokens from the other activities.
If you want to try it out you will require an external NFC token. Please let me know if you want a Fidesmo Card and I can provide instructions on how to get one for free. As earlier stated it can also be tested with a Yubikey from Yubico.
I hope you like the implementation and that you have some good feedack for me on what needs to be changed and improved!
Please beware that I am a bit new to git send-email, so let me know if you want any changes to how the patches were generated.
Best regards, Petter
Petter Arvidsson (4): Change Token to Internal token Add interfaces for Token and TokenPersistence Add External tokens Extend app to utilize new external tokens
app/build.gradle | 6 + app/src/main/AndroidManifest.xml | 9 +- .../freeotp/BaseReorderableAdapter.java | 97 ++++--- .../fedorahosted/freeotp/ExternalMainActivity.java | 142 +++++++++ .../org/fedorahosted/freeotp/ExternalToken.java | 130 +++++++++ .../freeotp/ExternalTokenPersistence.java | 129 +++++++++ .../fedorahosted/freeotp/InternalMainActivity.java | 126 ++++++++ .../org/fedorahosted/freeotp/InternalToken.java | 318 +++++++++++++++++++++ .../freeotp/InternalTokenPersistence.java | 140 +++++++++ .../org/fedorahosted/freeotp/MainActivity.java | 83 +++--- .../java/org/fedorahosted/freeotp/NfcHelpers.java | 60 ++++ .../main/java/org/fedorahosted/freeotp/Token.java | 277 +----------------- .../org/fedorahosted/freeotp/TokenAdapter.java | 62 ++-- .../org/fedorahosted/freeotp/TokenPersistence.java | 131 ++------- .../org/fedorahosted/freeotp/add/AddActivity.java | 10 +- .../org/fedorahosted/freeotp/add/BaseActivity.java | 7 + .../org/fedorahosted/freeotp/add/ScanActivity.java | 23 +- .../fedorahosted/freeotp/edit/BaseActivity.java | 22 -- .../fedorahosted/freeotp/edit/DeleteActivity.java | 19 +- .../fedorahosted/freeotp/edit/EditActivity.java | 46 +-- app/src/main/res/layout/main.xml | 4 +- app/src/main/res/menu/editable_token.xml | 33 +++ app/src/main/res/menu/token.xml | 6 - app/src/main/res/values/strings.xml | 16 +- 24 files changed, 1339 insertions(+), 557 deletions(-) create mode 100644 app/src/main/java/org/fedorahosted/freeotp/ExternalMainActivity.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/ExternalToken.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/ExternalTokenPersistence.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/InternalMainActivity.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/InternalToken.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/InternalTokenPersistence.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/NfcHelpers.java create mode 100644 app/src/main/java/org/fedorahosted/freeotp/add/BaseActivity.java delete mode 100644 app/src/main/java/org/fedorahosted/freeotp/edit/BaseActivity.java create mode 100644 app/src/main/res/menu/editable_token.xml
-- 1.9.1