Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset RxFingerPrint after app was killed #110

Open
danhpbt opened this issue Nov 25, 2018 · 1 comment
Open

Reset RxFingerPrint after app was killed #110

danhpbt opened this issue Nov 25, 2018 · 1 comment

Comments

@danhpbt
Copy link

danhpbt commented Nov 25, 2018

After app has forced kill, RxFingerPrint state is still save, how to reset it?

    String encrypted = AppData.getFingerEncrypt(MainApplication.getAppContext());
    fingerprintDisposable = RxFingerprint.decrypt(EncryptionMethod.RSA, getActivity(), AppData.APP_FINGER_KEY, encrypted)
            .subscribe(fingerprintDecryptionResult -> {
                switch (fingerprintDecryptionResult.getResult()) {
                    case FAILED:
                        bInitError = false;
                        ll_finger_form.setVisibility(View.GONE);

                        tv_finger_error_msg.setText(getString(R.string.str_finger_fail));
                        ll_finger_error.setVisibility(View.VISIBLE);
                        break;

                    case HELP:

                        ll_finger_form.setVisibility(View.GONE);

                        tv_finger_error_msg.setText(fingerprintDecryptionResult.getMessage());
                        ll_finger_error.setVisibility(View.VISIBLE);
                        break;

                    case AUTHENTICATED:
                        String pass = fingerprintDecryptionResult.getDecrypted();

                        fingerprintDisposable.dispose();
                        dismiss();

                        if (fingerPrintResultListener!= null)
                            fingerPrintResultListener.onSuccessFinger(pass);

                        Log.d("AUTHENTICATED", pass);
                        break;
                }
            }, throwable -> {
                fingerprintDisposable.dispose();

                //noinspection StatementWithEmptyBody
                if (RxFingerprint.keyInvalidated(throwable)) {
                    // The keys you wanted to use are invalidated because the user has turned off his
                    // secure lock screen or changed the fingerprints stored on the device
                    // You have to re-encrypt the data to access it
                }
                if (isAdded()) {

                    ll_finger_form.setVisibility(View.GONE);

                    tv_finger_error_msg.setText(getString(R.string.str_finger_fail_attempt));
                    ll_finger_error.setVisibility(View.VISIBLE);
                }

                Log.e("ERROR", "decrypt", throwable);
            });

Reproduce: Default can try 5 times

  1. try decrypt something, using scan 2 times with error finger, kill app, next time we can try only 5 - 2 = 3 times.
  2. Try 5 times error fingers, state will go to throwable, kill app, next time after init app, state will go to throwable again.

---> how to reset this state.
Thanks

@LosDanieloss
Copy link

LosDanieloss commented Aug 9, 2019

I believe it's specific for Android OS and cannot be tweaked by this library. It's possible to "reset this" by unlocking device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants