Giter VIP home page Giter VIP logo

android-littlefinger's Introduction

android-littlefinger

LittleFinger предназначен для упрощения работы со сканером отпечатков пальцев на Android. С помощью LittleFinger можно:

Добавление в проект

Через gradle - зависимость

implementation 'com.elegion.library.littlefinger:littlefinger:0.9.0'

Пример использования

В конструктор нужно передавать контекст

LittleFinger mLittlefinger = new LittleFinger(getApplicationContext());

Асинхронное шифрование текста с заданным ключом

 mLittleFinger.encode(pin, key, CryptoAlgorithm.RSA, this::handleResult);

Обработка результата

private void handleResult(AuthResult authResult) {
        switch (authResult.getState()) {
            case SUCCESS: {
                String encoded = authResult.getData();
                mRepository.saveEncodedPin(encoded);
                getViewState().showEncodedPin(encoded);
                break;
            }
            default:
                if (authResult.getThrowable() != null) {
                    getViewState().showEncodedPin(authResult.getThrowable().getMessage());
                }
                break;
        }
    }

Расшифровка

 String encoded = mRepository.getEncodedPin();
 String key = mRepository.getKeyAlias();
 mLittleFinger.decode(encoded, key, CryptoAlgorithm.RSA, this::handleCallback);

Обработка результата

private void handleCallback(AuthResult result) {
        switch (result.getState()) {
            case SUCCESS:
                checkIsPinCorrect(result.getData());
                break;
            case HELP:
                getViewState().showMessage(R.string.fp_touch_help);
                break;
            case ERROR:
                getViewState().showMessage(R.string.fp_touch_failed);
                break;
            case EXCEPTION:
                if (result.isKeyInvalidated()) {
                    getViewState().setSensorStateMessage(R.string.fp_added_or_removed_fp);
                    mRepository.saveEncodedPin(null);
                } else {
                    getViewState().showMessage(R.string.fp_auth_by_fp_unavailable);
                }
                Log.d(TAG, "exc", result.getThrowable());
                break;
        }
    }

android-littlefinger's People

Contributors

azretmagometov avatar barmike avatar mikebarannikov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

azretmagometov

android-littlefinger's Issues

onAuthenticationHelp callback calling

My device has a Russian language setting and appliaction on English locale and this callback is calling without finger applying (the text of message is empty).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.