Browse Source

some changes

gradlePlay
Gutyn 9 years ago
parent
commit
ab90aabd72
  1. 10
      .idea/libraries/appcompat_v7_23_0_1.xml
  2. 6
      .idea/libraries/espresso_core_2_2.xml
  3. 4
      .idea/libraries/espresso_idling_resource_2_2.xml
  4. 10
      .idea/libraries/exposed_instrumentation_api_publish_0_3.xml
  5. 12
      .idea/libraries/exposed_instrumentation_api_publish_0_4.xml
  6. 6
      .idea/libraries/rules_0_3.xml
  7. 10
      .idea/libraries/runner_0_3.xml
  8. 12
      .idea/libraries/runner_0_4.xml
  9. 11
      .idea/libraries/support_annotations_22_2_0.xml
  10. 11
      .idea/libraries/support_annotations_23_0_1.xml
  11. 12
      .idea/libraries/support_v4_23_0_1.xml
  12. 40
      app/app.iml
  13. 15
      app/build.gradle
  14. 13
      app/src/main/AndroidManifest.xml
  15. 65
      app/src/main/java/com/breadwallet/presenter/activities/IntroActivity.java
  16. 16
      app/src/main/java/com/breadwallet/presenter/activities/IntroShowPhraseActivity.java
  17. 4
      app/src/main/java/com/breadwallet/presenter/activities/MainActivity.java
  18. 2
      app/src/main/java/com/breadwallet/presenter/fragments/ChangePasswordDialogFragment.java
  19. 23
      app/src/main/java/com/breadwallet/presenter/fragments/FragmentRecoveryPhrase.java
  20. 32
      app/src/main/java/com/breadwallet/presenter/fragments/FragmentWipeWallet.java
  21. 3
      app/src/main/java/com/breadwallet/presenter/fragments/IntroNewWalletFragment.java
  22. 1
      app/src/main/java/com/breadwallet/presenter/fragments/IntroRecoverWalletFragment.java
  23. 2
      app/src/main/java/com/breadwallet/presenter/fragments/PasswordDialogFragment.java
  24. 18
      app/src/main/java/com/breadwallet/tools/WordsReader.java
  25. 30
      app/src/main/java/com/breadwallet/tools/security/KeyStoreManager.java
  26. 2
      app/src/main/java/com/breadwallet/tools/security/PassCodeManager.java
  27. 223
      app/src/main/java/com/breadwallet/wallet/BRWalletManager.java
  28. 1
      app/src/main/jni/Application.mk
  29. 2
      app/src/main/jni/breadwallet-core
  30. 35
      app/src/main/jni/transition/core.c
  31. 3
      app/src/main/res/layouts/activities/layout/activity_intro_show_phrase.xml
  32. 3
      app/src/main/res/layouts/fragments/layout/fragment_recovery_phrase.xml

10
.idea/libraries/appcompat_v7_22_2_0.xml → .idea/libraries/appcompat_v7_23_0_1.xml

@ -1,15 +1,15 @@
<component name="libraryTable">
<library name="appcompat-v7-22.2.0">
<library name="appcompat-v7-23.0.1">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0-sources.jar!/" />
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

6
.idea/libraries/espresso_core_2_2.xml

@ -1,10 +1,12 @@
<component name="libraryTable">
<library name="espresso-core-2.2">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/espresso/espresso-core/2.2/espresso-core-2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

4
.idea/libraries/espresso_idling_resource_2_2.xml

@ -5,6 +5,8 @@
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-idling-resource/2.2/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/espresso/espresso-idling-resource/2.2/espresso-idling-resource-2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

10
.idea/libraries/exposed_instrumentation_api_publish_0_3.xml

@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="exposed-instrumentation-api-publish-0.3">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.3/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.3/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

12
.idea/libraries/exposed_instrumentation_api_publish_0_4.xml

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="exposed-instrumentation-api-publish-0.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.4/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.4/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/exposed-instrumentation-api-publish/0.4/exposed-instrumentation-api-publish-0.4-sources.jar!/" />
</SOURCES>
</library>
</component>

6
.idea/libraries/rules_0_3.xml

@ -1,10 +1,12 @@
<component name="libraryTable">
<library name="rules-0.3">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/rules/0.3/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/rules/0.3/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/rules/0.3/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/rules/0.3/rules-0.3-sources.jar!/" />
</SOURCES>
</library>
</component>

10
.idea/libraries/runner_0_3.xml

@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="runner-0.3">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/runner/0.3/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/runner/0.3/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

12
.idea/libraries/runner_0_4.xml

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="runner-0.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/runner/0.4/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support.test/runner/0.4/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/runner/0.4/runner-0.4-sources.jar!/" />
</SOURCES>
</library>
</component>

11
.idea/libraries/support_annotations_22_2_0.xml

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="support-annotations-22.2.0">
<CLASSES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/22.2.0/support-annotations-22.2.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/22.2.0/support-annotations-22.2.0-sources.jar!/" />
</SOURCES>
</library>
</component>

11
.idea/libraries/support_annotations_23_0_1.xml

@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="support-annotations-23.0.1">
<CLASSES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.0.1/support-annotations-23.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.0.1/support-annotations-23.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

12
.idea/libraries/support_v4_22_2_0.xml → .idea/libraries/support_v4_23_0_1.xml

@ -1,16 +1,16 @@
<component name="libraryTable">
<library name="support-v4-22.2.0">
<library name="support-v4-23.0.1">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars/classes.jar!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars/libs/internal_impl-22.2.0.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/res" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars/libs/internal_impl-23.0.1.jar!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0-sources.jar!/" />
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

40
app/app.iml

@ -21,7 +21,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res/layouts/activities" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res/layouts/activities;file://$MODULE_DIR$/src/main/res/layouts/toasts;file://$MODULE_DIR$/src/main/res/layouts;file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/main/res/layouts/fragments" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/main/res/layouts;file://$MODULE_DIR$/src/main/res/layouts/activities;file://$MODULE_DIR$/src/main/res/layouts/toasts;file://$MODULE_DIR$/src/main/res/layouts/fragments" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
@ -78,11 +78,11 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-idling-resource/2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/rules/0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/runner/0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/runner/0.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@ -98,27 +98,27 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="xmlwise-1_2" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javawriter-2.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-2.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-core-2.2" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="runner-0.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="exposed-instrumentation-api-publish-0.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
<orderEntry type="library" exported="" name="acra-4.6.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="exposed-instrumentation-api-publish-0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="rules-0.3" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-integration-1.3" level="project" />
<orderEntry type="library" exported="" name="rebound-0.3.8" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="runner-0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javawriter-2.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="rules-0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
</component>
</module>

15
app/build.gradle

@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
compileSdkVersion 23
buildToolsVersion "21.1.2"
lintOptions {
@ -21,12 +21,14 @@ android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
applicationId "com.breadwallet"
minSdkVersion 17
targetSdkVersion 22
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
moduleName "BreadWalletCore"
ldLibs "log"
stl "gnustl_static"
cFlags "-std=c99"
}
}
@ -57,14 +59,13 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/acra-4.6.1.jar')
compile files('libs/xmlwise-1_2.jar')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
testCompile 'junit:junit:+'
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.zxing:core:3.2.0' //QRCode scanner
compile 'com.facebook.rebound:rebound:0.3.8' //spring animation
compile 'org.json:json:20141113' //JSonParser google
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:runner:+'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.3'
// Set this dependency to build and run Espresso tests

13
app/src/main/AndroidManifest.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.breadwallet" >
package="com.breadwallet">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
@ -16,11 +16,11 @@
android:icon="@mipmap/icon80"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme">
<activity
android:name=".presenter.activities.IntroActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -31,14 +31,9 @@
android:name=".presenter.activities.MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait" />
<activity
android:name=".presenter.activities.DecoderActivity"
android:label="@string/title_activity_decoder"
android:screenOrientation="portrait" />
<activity
android:name=".presenter.activities.IntroShowPhraseActivity"
android:label="@string/title_activity_intro_show_phrase" >
</activity>
android:label="@string/title_activity_intro_show_phrase"></activity>
</application>
</manifest>

65
app/src/main/java/com/breadwallet/presenter/activities/IntroActivity.java

@ -5,6 +5,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Matrix;
import android.graphics.RectF;
@ -12,6 +13,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.Button;
@ -24,15 +26,14 @@ import com.breadwallet.presenter.fragments.IntroNewWalletFragment;
import com.breadwallet.presenter.fragments.IntroRecoverWalletFragment;
import com.breadwallet.presenter.fragments.IntroWarningFragment;
import com.breadwallet.presenter.fragments.IntroWelcomeFragment;
import com.breadwallet.tools.WordsReader;
import com.breadwallet.tools.sqlite.MerkleBlockDataSource;
import com.breadwallet.tools.sqlite.TransactionDataSource;
import com.breadwallet.tools.sqlite.entities.BRMerkleBlockEntity;
import com.breadwallet.tools.sqlite.entities.BRTransactionEntity;
import com.breadwallet.tools.sqlite.entities.BRTxInputEntity;
import com.breadwallet.tools.sqlite.entities.BRTxOutputEntity;
import com.breadwallet.wallet.BRWalletManager;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@ -73,6 +74,7 @@ public class IntroActivity extends FragmentActivity {
private static final int LeftToRight = 2;
private static final int DURATION = 30000;
public static IntroActivity app;
private ValueAnimator mCurrentAnimator;
private final Matrix mMatrix = new Matrix();
private float mScaleFactor;
@ -89,15 +91,17 @@ public class IntroActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro);
app = this;
final BRWalletManager m = BRWalletManager.getInstance();
// m.generateRandomSeed(this);
Log.e(TAG, "Activity created!");
if (savedInstanceState != null) {
return;
}
// testSQLiteConnectivity(this); //do some sqlite testing
// testSQLiteConnectivity(this); //do some SQLite testing
introWelcomeFragment = new IntroWelcomeFragment();
introNewRestoreFragment = new IntroNewRecoverFragment();
introNewWalletFragment = new IntroNewWalletFragment();
@ -127,31 +131,38 @@ public class IntroActivity extends FragmentActivity {
onBackPressed();
}
});
getSupportFragmentManager().beginTransaction().add(R.id.intro_layout, introWelcomeFragment,
"introWelcomeFragment").commit();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (noWallet) {
Log.e(TAG, "should create new wallet");
showRecoverNewWalletFragment();
} else {
Log.e(TAG, "should go to the current wallet");
startMainActivity();
if (!m.isPasscodeEnabled(this)) {
Log.e(TAG, "WARNING device is not secured!");
new AlertDialog.Builder(this)
.setTitle("Warning!")
.setMessage("A device passcode is needed to safeguard your wallet. " +
"Go to settings and turn passcode on to continue.")
.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (m.noWallet(app)) {
Log.e(TAG, "should create new wallet");
showRecoverNewWalletFragment();
} else {
Log.e(TAG, "should go to the current wallet");
startMainActivity();
}
}
}, 800);
}
}, 1200);
//testing plist:
List<String> wordList = null;
try {
wordList = WordsReader.getWordList(this);
} catch (IOException e) {
e.printStackTrace();
}
//testing plist:
//
// Iterator<String> it = wordList.iterator();
// int count = 0;
@ -160,7 +171,8 @@ public class IntroActivity extends FragmentActivity {
//
// }
//end testing
//end testing
}
}
@ -359,4 +371,5 @@ public class IntroActivity extends FragmentActivity {
}
}
}

16
app/src/main/java/com/breadwallet/presenter/activities/IntroShowPhraseActivity.java

@ -4,19 +4,21 @@ import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.breadwallet.R;
import com.breadwallet.wallet.BRWalletManager;
public class IntroShowPhraseActivity extends Activity {
Button remindMeLate;
Button remindMeLater;
RelativeLayout writeDownLayout;
ImageView checkBox;
private TextView thePhrase;
boolean checked = false;
@Override
@ -27,8 +29,9 @@ public class IntroShowPhraseActivity extends Activity {
if (savedInstanceState != null) {
return;
}
remindMeLate = (Button) findViewById(R.id.remind_me_later_button);
BRWalletManager m = BRWalletManager.getInstance();
thePhrase = (TextView) findViewById(R.id.the_phrase_at_startup);
remindMeLater = (Button) findViewById(R.id.remind_me_later_button);
writeDownLayout = (RelativeLayout) findViewById(R.id.write_down_notice_layout);
checkBox = (ImageView) findViewById(R.id.write_down_check_box);
checkBox.setOnClickListener(new View.OnClickListener() {
@ -38,6 +41,7 @@ public class IntroShowPhraseActivity extends Activity {
}
});
writeDownLayout.setVisibility(View.GONE);
thePhrase.setText(m.getKeyStoreString(null, this));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
@ -45,7 +49,7 @@ public class IntroShowPhraseActivity extends Activity {
writeDownLayout.setVisibility(View.VISIBLE);
}
}, 10000);
remindMeLate.setOnClickListener(new View.OnClickListener() {
remindMeLater.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startMainActivity();
@ -80,7 +84,7 @@ public class IntroShowPhraseActivity extends Activity {
void setCheckBoxImage() {
checkBox.setImageResource(!checked ? R.drawable.checkbox_checked : R.drawable.checkbox_empty);
remindMeLate.setText(!checked ? getResources().getString(R.string.done) :
remindMeLater.setText(!checked ? getResources().getString(R.string.done) :
getResources().getString(R.string.remind_me_later));
checked = !checked;
}

4
app/src/main/java/com/breadwallet/presenter/activities/MainActivity.java

@ -147,9 +147,6 @@ public class MainActivity extends FragmentActivity implements Observer {
getWindowManager().getDefaultDisplay().getSize(screenParametersPoint);
Log.e(TAG, "Activity created!");
if (savedInstanceState != null) {
return;
}
if (isEmulatorOrDebug()) {
MODE = DEBUG;
Log.e(TAG, "DEBUG MODE!!!!!!");
@ -234,6 +231,7 @@ public class MainActivity extends FragmentActivity implements Observer {
protected void onDestroy() {
super.onDestroy();
finish();
FragmentAnimator.level = 0;
CurrencyManager.stopTimerTask();
Log.e(TAG, "Activity Destroyed!");

2
app/src/main/java/com/breadwallet/presenter/fragments/ChangePasswordDialogFragment.java

@ -44,7 +44,7 @@ import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.adapter.CustomPagerAdapter;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.tools.CurrencyManager;
import com.breadwallet.tools.PassCodeManager;
import com.breadwallet.tools.security.PassCodeManager;
public class ChangePasswordDialogFragment extends DialogFragment {

23
app/src/main/java/com/breadwallet/presenter/fragments/FragmentRecoveryPhrase.java

@ -2,14 +2,18 @@
package com.breadwallet.presenter.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.breadwallet.R;
import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.tools.BRClipboardManager;
import com.breadwallet.tools.adapter.MiddleViewAdapter;
import com.breadwallet.wallet.BRWalletManager;
/**
* BreadWallet
@ -38,11 +42,26 @@ import com.breadwallet.tools.adapter.MiddleViewAdapter;
public class FragmentRecoveryPhrase extends Fragment {
@Nullable
public TextView thePhrase;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.fragment_recovery_phrase, container, false);
BRWalletManager m = BRWalletManager.getInstance();
thePhrase = (TextView) rootView.findViewById(R.id.the_phrase);
//TODO delete this code below which is for testing reasons only
thePhrase.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BRClipboardManager.copyToClipboard(getActivity(),thePhrase.getText().toString());
((BreadWalletApp)getActivity().getApplication()).showCustomToast(getActivity(),
"copied", 300, Toast.LENGTH_SHORT);
}
});
thePhrase.setText(m.getKeyStoreString(null, getActivity()));
return rootView;
}

32
app/src/main/java/com/breadwallet/presenter/fragments/FragmentWipeWallet.java

@ -1,9 +1,12 @@
package com.breadwallet.presenter.fragments;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -13,6 +16,7 @@ import android.widget.EditText;
import com.breadwallet.R;
import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.presenter.activities.IntroActivity;
import com.breadwallet.wallet.BRWalletManager;
/**
* BreadWallet
@ -40,9 +44,11 @@ import com.breadwallet.presenter.activities.IntroActivity;
*/
public class FragmentWipeWallet extends Fragment {
public static final String TAG = FragmentWipeWallet.class.getName();
Button close;
EditText recoveryPhraseEditText;
Button wipe;
BRWalletManager m;
@Override
public View onCreateView(LayoutInflater inflater,
@ -51,6 +57,7 @@ public class FragmentWipeWallet extends Fragment {
// properly.
View rootView = inflater.inflate(
R.layout.fragment_wipe_wallet, container, false);
m = BRWalletManager.getInstance();
close = (Button) rootView.findViewById(R.id.wipe_wallet_close);
recoveryPhraseEditText = (EditText) rootView.findViewById(R.id.editText_phrase);
wipe = (Button) rootView.findViewById(R.id.wipe_wallet_wipe);
@ -64,13 +71,36 @@ public class FragmentWipeWallet extends Fragment {
wipe.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startIntroActivity();
if (phraseIsValid(recoveryPhraseEditText.getText().toString())) {
m.sweepPrivateKey(null, false, getActivity());
startIntroActivity();
getActivity().finish();
} else {
new AlertDialog.Builder(getActivity())
.setTitle("Attention")
.setMessage("This is not a valid phrase!")
.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
}
});
return rootView;
}
private boolean phraseIsValid(String insertedPhrase) {
String thePhrase = m.getKeyStoreString(null, getActivity());
if (thePhrase == null) throw new NullPointerException("Phrase is null! weird behaviour");
Log.e(TAG,"Inserted:" + insertedPhrase);
Log.e(TAG,"Actual:" + thePhrase);
return insertedPhrase.equalsIgnoreCase(thePhrase);
}
@Override
public void onPause() {
super.onPause();

3
app/src/main/java/com/breadwallet/presenter/fragments/IntroNewWalletFragment.java

@ -9,6 +9,7 @@ import android.widget.Button;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.IntroActivity;
import com.breadwallet.wallet.BRWalletManager;
/**
* BreadWallet
@ -42,12 +43,14 @@ public class IntroNewWalletFragment extends Fragment {
ViewGroup container, Bundle savedInstanceState) {
// The last two arguments ensure LayoutParams are inflated
// properly.
final BRWalletManager m = BRWalletManager.getInstance();
View rootView = inflater.inflate(
R.layout.intro_fragment_new_wallet, container, false);
introGenerate = (Button) rootView.findViewById(R.id.intro_new_wallet_generate);
introGenerate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
m.generateRandomSeed(getActivity());
((IntroActivity) getActivity()).showWarningFragment();
}
});

1
app/src/main/java/com/breadwallet/presenter/fragments/IntroRecoverWalletFragment.java

@ -63,7 +63,6 @@ public class IntroRecoverWalletFragment extends Fragment {
((IntroActivity) getActivity()).startMainActivity();
getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
} else {
alertDialog.setTitle(getResources().getString(R.string.alert));
alertDialog.setMessage("\"" + editText.getText().toString() + "\" - " +
getResources().getString(R.string.dialog_recovery_phrase_invalid));

2
app/src/main/java/com/breadwallet/presenter/fragments/PasswordDialogFragment.java

@ -42,7 +42,7 @@ import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.tools.CurrencyManager;
import com.breadwallet.tools.PassCodeManager;
import com.breadwallet.tools.security.PassCodeManager;
public class PasswordDialogFragment extends DialogFragment {

18
app/src/main/java/com/breadwallet/tools/WordsReader.java

@ -44,4 +44,22 @@ public class WordsReader {
return wordList;
}
public static byte[] getWordListBytes(Context context) throws IOException {
String languageCode = context.getString(R.string.lang);
Log.e(TAG, "The language is: " + languageCode);
String fileName = "words/" + languageCode + "-BIP39Words.txt";
byte[] wordsBytes = null;
try {
AssetManager assetManager = context.getResources().getAssets();
InputStream inputStream = assetManager.open(fileName);
wordsBytes = new byte[inputStream.available()];
int result = inputStream.read(wordsBytes);
Log.e(TAG, String.format("The result: %s and the wordsBytes: %s", result, wordsBytes));
} catch (Exception ex) {
Log.e(TAG, "UUUps, getWordListBytes error: ", ex);
}
if (wordsBytes != null) throw new NullPointerException("bytes cannot be null");
return wordsBytes;
}
}

30
app/src/main/java/com/breadwallet/tools/security/KeyStoreManager.java

@ -0,0 +1,30 @@
package com.breadwallet.tools.security;
/**
* BreadWallet
* <p/>
* Created by Mihail on 9/29/15.
* Copyright (c) 2015 Mihail Gutan <mihail@breadwallet.com>
* <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p/>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p/>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
public class KeyStoreManager {
public static final String TAG = KeyStoreManager.class.getName();
}

2
app/src/main/java/com/breadwallet/tools/PassCodeManager.java → app/src/main/java/com/breadwallet/tools/security/PassCodeManager.java

@ -1,4 +1,4 @@
package com.breadwallet.tools;
package com.breadwallet.tools.security;
/**
* BreadWallet

223
app/src/main/java/com/breadwallet/wallet/BRWalletManager.java

@ -1,10 +1,40 @@
package com.breadwallet.wallet;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.security.KeyPairGeneratorSpec;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.text.NumberFormat;
import java.util.Calendar;
import java.util.List;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.NoSuchPaddingException;
import javax.security.auth.x500.X500Principal;
/**
* BreadWallet
* <p/>
@ -45,6 +75,8 @@ public class BRWalletManager {
public static final String FEE_PER_KB_URL = "https://api.breadwallet.com/v1/fee-per-kb";
public static final int SEED_ENTROPY_LENGTH = 128 / 8;
public static final String SEC_ATTR_SERVICE = "org.voisine.breadwallet";
public static final String ANDROID_KEY_STORE = "AndroidKeyStore";
public static final String ALIAS = "phrase";
ByteBuffer masterPublicKey; // master public key used to generate wallet addresses
char[] seedPhrase; // requesting seedPhrase will trigger authentication
@ -78,10 +110,11 @@ public class BRWalletManager {
}
public static boolean setKeychainData(ByteBuffer buffer, String key, boolean authenticated) {
return false;
return true;
}
public static ByteBuffer getKeychainData(String key) {
public ByteBuffer getKeychainData(String key) {
return null;
}
@ -89,30 +122,167 @@ public class BRWalletManager {
return false;
}
public static long getKeychainInt(String key) {
public long getKeychainInt(String key) {
return 0;
}
public static boolean setKeychainString(String s, String key, boolean authenticated) {
return false;
public boolean setKeyStoreString(String strPhrase, String key,
boolean authenticated, Context ctx) {
try {
KeyStore keyStore = KeyStore.getInstance(ANDROID_KEY_STORE);
keyStore.load(null);
int nBefore = keyStore.size();
// Create the keys if necessary
if (!keyStore.containsAlias(ALIAS)) {
Calendar notBefore = Calendar.getInstance();
Calendar notAfter = Calendar.getInstance();
notAfter.add(Calendar.YEAR, 1);
KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(ctx)
.setAlias(ALIAS)
.setKeyType("RSA")
.setKeySize(2048)
.setSubject(new X500Principal("CN=test"))
.setSerialNumber(BigInteger.ONE)
.setStartDate(notBefore.getTime())
.setEndDate(notAfter.getTime())
.build();
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", ANDROID_KEY_STORE);
generator.initialize(spec);
KeyPair keyPair = generator.generateKeyPair();
}
int nAfter = keyStore.size();
Log.v(TAG, "Before = " + nBefore + " After = " + nAfter);
// Retrieve the keys
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(ALIAS, null);
RSAPrivateKey privateKey = (RSAPrivateKey) privateKeyEntry.getPrivateKey();
RSAPublicKey publicKey = (RSAPublicKey) privateKeyEntry.getCertificate().getPublicKey();
Log.v(TAG, "private key = " + privateKey.toString());
Log.v(TAG, "public key = " + publicKey.toString());
// Encrypt the text
String dataDirectory = ctx.getApplicationInfo().dataDir;
String filesDirectory = ctx.getFilesDir().getAbsolutePath();
String encryptedDataFilePath = filesDirectory + File.separator + "my_phrase";
Log.v(TAG, "strPhrase = " + strPhrase);
Log.v(TAG, "dataDirectory = " + dataDirectory);
Log.v(TAG, "filesDirectory = " + filesDirectory);
Log.v(TAG, "encryptedDataFilePath = " + encryptedDataFilePath);
Cipher inCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "AndroidOpenSSL");
inCipher.init(Cipher.ENCRYPT_MODE, publicKey);
CipherOutputStream cipherOutputStream =
new CipherOutputStream(
new FileOutputStream(encryptedDataFilePath), inCipher);
cipherOutputStream.write(strPhrase.getBytes("UTF-8"));
cipherOutputStream.close();
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (NoSuchProviderException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (InvalidAlgorithmParameterException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (KeyStoreException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (CertificateException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (IOException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (UnrecoverableEntryException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (NoSuchPaddingException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (InvalidKeyException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (UnsupportedOperationException e) {
Log.e(TAG, Log.getStackTraceString(e));
}
return true;
}
public static String getKeychainString(String key) {
return null;
public String getKeyStoreString(String key, Context ctx) {
KeyStore keyStore;
String recoveredSecret = "";
String filesDirectory = ctx.getFilesDir().getAbsolutePath();
String encryptedDataFilePath = filesDirectory + File.separator + "my_phrase";
try {
keyStore = KeyStore.getInstance(ANDROID_KEY_STORE);
keyStore.load(null);
// Retrieve the keys
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry(ALIAS, null);
RSAPrivateKey privateKey = (RSAPrivateKey) privateKeyEntry.getPrivateKey();
Cipher outCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "AndroidOpenSSL");
outCipher.init(Cipher.DECRYPT_MODE, privateKey);
CipherInputStream cipherInputStream = new CipherInputStream(
new FileInputStream(encryptedDataFilePath), outCipher);
byte[] roundTrippedBytes = new byte[1000]; // TODO: dynamically resize as we get more data
int index = 0;
int nextByte;
while ((nextByte = cipherInputStream.read()) != -1) {
roundTrippedBytes[index] = (byte) nextByte;
index++;
}
recoveredSecret = new String(roundTrippedBytes, 0, index, "UTF-8");
Log.e(TAG, "round tripped string = " + recoveredSecret);
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (UnrecoverableEntryException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (CertificateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
Log.e(TAG, "recovered: " + recoveredSecret);
return recoveredSecret;
}
/**
* generates a random seed, saves to keychain and returns the associated seedPhrase
*/
public String generateRandomSeed() {
public String generateRandomSeed(Context ctx) {
final SecureRandom sr = new SecureRandom();
final byte[] keyBytes = new byte[128];
sr.nextBytes(keyBytes);
return null;
Log.e(TAG, keyBytes.toString());
// byte[] wordListBytes = new byte[0];
// try {
// wordListBytes = WordsReader.getWordListBytes(IntroActivity.app);
// } catch (IOException e) {
// e.printStackTrace();
// }
// String phrase = encodePhrase(keyBytes, wordListBytes); //not working yet
String phrase = "short apple trunk riot coyote innocent zebra venture ill lava shop test";
boolean success = setKeyStoreString(phrase, null, true, ctx);
Log.e(TAG, "setKeyStoreString was successful: " + success);
return phrase;
}
public native String encodePhrase(byte[] seed, byte[] wordList);
private native String encodePhrase(byte[] seed, byte[] wordList);
/**
* authenticates user and returns seed
@ -146,8 +316,24 @@ public class BRWalletManager {
* given a private key, queries chain.com for unspent outputs and calls the completion block with
* a signed transaction that will sweep the balance into wallet (doesn't publish the tx)
*/
public void sweepPrivateKey(String privKey, boolean fee) {
//?????????????????????????????
public void sweepPrivateKey(String privKey, boolean fee, Context ctx) {
KeyStore keyStore;
String filesDirectory = ctx.getFilesDir().getAbsolutePath();
String encryptedDataFilePath = filesDirectory + File.separator + "my_phrase";
try {
keyStore = KeyStore.getInstance(ANDROID_KEY_STORE);
keyStore.load(null);
keyStore.deleteEntry(ALIAS);
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public long amountForString(String string) {
@ -169,8 +355,10 @@ public class BRWalletManager {
/**
* true if keychain is available and we know that no wallet exists on it
*/
public boolean noWallet() {
return false;
public boolean noWallet(Context ctx) {
String phrase = getKeyStoreString(null, ctx);
return phrase.length() == 0;
}
/**
@ -201,8 +389,9 @@ public class BRWalletManager {
/**
* true if device passcode is enabled
*/
public boolean isPasscodeEnabled() {
return false;
public boolean isPasscodeEnabled(Context ctx) {
KeyguardManager keyguardManager = (KeyguardManager) ctx.getSystemService(Activity.KEYGUARD_SERVICE);
return keyguardManager.isKeyguardSecure();
}
public void updateFeePerKb() {

1
app/src/main/jni/Application.mk

@ -0,0 +1 @@
APP_ABI := all

2
app/src/main/jni/breadwallet-core

@ -1 +1 @@
Subproject commit 11e35d689ae7655a15df20668536028d9b68f411
Subproject commit 56e21d6d5a24d1500580283fe1e38ce8b391a9ed

35
app/src/main/jni/transition/core.c

@ -2,8 +2,6 @@
// Created by Mihail Gutan on 9/24/15.
//
#include "core.h"
#include "../../../../../../../../Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9/include/stddef.h"
#include "../breadwallet-core/BRBIP39Mnemonic.h"
JNIEXPORT void Java_com_breadwallet_presenter_activities_MainActivity_sendMethodCallBack
(JNIEnv *env, jobject obj) {
@ -17,23 +15,22 @@ JNIEXPORT void Java_com_breadwallet_presenter_activities_MainActivity_sendMethod
JNIEXPORT jbyteArray Java_com_breadwallet_wallet_BRWalletManager_encodePhrase
(JNIEnv *env, jobject obj, jbyteArray seed, jbyteArray wordList) {
jboolean b;
int wordLen = (*env)->GetArrayLength(env, wordList);
int seedLen = (*env)->GetArrayLength(env, seed);
char buff[wordLen];
char seed_buff[seedLen];
char *phrase[seedLen]; // wrong ! check later
jbyte *byte1 = (*env)->GetByteArrayElements(env, wordList, &b);
buff = byte1;
(*env)->ReleaseByteArrayElements(env, wordList, b, 0);
jbyte *seed_byte = (*env)->GetByteArrayElements(env, wordList, &b);
seed_buff = seed_byte;
(*env)->ReleaseByteArrayElements(env, seed, b, JNI_ABORT);
// jboolean b;
// int wordLen = (*env)->GetArrayLength(env, wordList);
// int seedLen = (*env)->GetArrayLength(env, seed);
// char *buff[wordLen];
// char seed_buff[seedLen];
//
// char *phrase[seedLen]; // wrong ! check later
//
// jbyte *byte1 = (*env)->GetByteArrayElements(env, wordList, &b);
// buff = (char *) byte1;
// (*env)->ReleaseByteArrayElements(env, wordList, b, 0);
//
//
// jbyte *seed_byte = (*env)->GetByteArrayElements(env, wordList, &b);
// seed_buff = seed_byte;
// (*env)->ReleaseByteArrayElements(env, seed, b, JNI_ABORT);
// size_t byte_size = BRBIP39Encode(phrase,) continue later

3
app/src/main/res/layouts/activities/layout/activity_intro_show_phrase.xml

@ -51,7 +51,7 @@
android:clickable="false">
<TextView
android:id="@+id/textView3"
android:id="@+id/the_phrase_at_startup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -59,7 +59,6 @@
android:gravity="center"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="short apple trunk riot coyote innocent zebra venture ill lava shop flat"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/dark_grey"
android:textSize="20sp" />

3
app/src/main/res/layouts/fragments/layout/fragment_recovery_phrase.xml

@ -40,7 +40,7 @@
android:clickable="false">
<TextView
android:id="@+id/textView3"
android:id="@+id/the_phrase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -48,7 +48,6 @@
android:gravity="center"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="short apple trunk riot coyote innocent zebra venture ill lava shop flat"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/dark_grey"
android:textSize="22sp" />

Loading…
Cancel
Save