From 1e404b62d14a98b4dc9025987b302be6d93a85a3 Mon Sep 17 00:00:00 2001 From: str4d Date: Thu, 28 Aug 2014 06:37:58 +0000 Subject: [PATCH] Fingerprint field for contacts, not filled yet The regular Fingerprint doesn't work here because it requires the salt, which is not part of the public Destination. The salt is published with the Destination in the public address book, and could be conveyed between Bote apps via NFC or QR code, but that doesn't work for Destinations published in other spaces. --- .../addressbook/ViewContactFragment.java | 9 +++++++++ .../main/res/layout/fragment_view_contact.xml | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/src/main/java/i2p/bote/android/addressbook/ViewContactFragment.java b/app/src/main/java/i2p/bote/android/addressbook/ViewContactFragment.java index 9cdbca0..db6f8b1 100644 --- a/app/src/main/java/i2p/bote/android/addressbook/ViewContactFragment.java +++ b/app/src/main/java/i2p/bote/android/addressbook/ViewContactFragment.java @@ -43,6 +43,7 @@ public class ViewContactFragment extends Fragment { TextView mTextField; TextView mCryptoField; TextView mDestinationField; + TextView mFingerprintField; public static ViewContactFragment newInstance(String destination) { ViewContactFragment f = new ViewContactFragment(); @@ -74,6 +75,7 @@ public class ViewContactFragment extends Fragment { mTextField = (TextView) view.findViewById(R.id.text); mCryptoField = (TextView) view.findViewById(R.id.crypto_impl); mDestinationField = (TextView) view.findViewById(R.id.destination); + mFingerprintField = (TextView) view.findViewById(R.id.fingerprint); if (mDestination != null) { try { @@ -98,6 +100,13 @@ public class ViewContactFragment extends Fragment { mTextField.setText(mContact.getText()); mCryptoField.setText(mContact.getDestination().getCryptoImpl().getName()); mDestinationField.setText(mDestination); + try { + String locale = getActivity().getResources().getConfiguration().locale.getLanguage(); + mFingerprintField.setText(BoteHelper.getFingerprint(mContact, locale)); + } catch (GeneralSecurityException e) { + // Could not get fingerprint + mFingerprintField.setText(e.getLocalizedMessage()); + } } } diff --git a/app/src/main/res/layout/fragment_view_contact.xml b/app/src/main/res/layout/fragment_view_contact.xml index f1e13a5..1a4a04d 100644 --- a/app/src/main/res/layout/fragment_view_contact.xml +++ b/app/src/main/res/layout/fragment_view_contact.xml @@ -62,4 +62,23 @@ android:layout_marginTop="5dp" android:text="Destination" /> + + + + \ No newline at end of file