{"id":18784476,"url":"https://github.com/pwittchen/rxbiometric","last_synced_at":"2025-04-06T10:13:47.444Z","repository":{"id":50231028,"uuid":"144835327","full_name":"pwittchen/RxBiometric","owner":"pwittchen","description":"☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android","archived":false,"fork":false,"pushed_at":"2022-04-23T16:50:50.000Z","size":560,"stargazers_count":302,"open_issues_count":9,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T09:07:39.468Z","etag":null,"topics":["android","biometric","biometricprompt","fingerprint","prompt","rxandroid","rxandroid2","rxjava","rxjava2","rxkotlin","rxkotlin-android"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pwittchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["pwittchen"],"custom":["https://paypal.me/pwittchen"]}},"created_at":"2018-08-15T09:44:33.000Z","updated_at":"2024-11-07T13:52:01.000Z","dependencies_parsed_at":"2022-08-17T16:06:00.672Z","dependency_job_id":null,"html_url":"https://github.com/pwittchen/RxBiometric","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FRxBiometric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FRxBiometric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FRxBiometric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwittchen%2FRxBiometric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwittchen","download_url":"https://codeload.github.com/pwittchen/RxBiometric/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464224,"owners_count":20942970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","biometric","biometricprompt","fingerprint","prompt","rxandroid","rxandroid2","rxjava","rxjava2","rxkotlin","rxkotlin-android"],"created_at":"2024-11-07T20:43:08.642Z","updated_at":"2025-04-06T10:13:47.425Z","avatar_url":"https://github.com/pwittchen.png","language":"Kotlin","funding_links":["https://github.com/sponsors/pwittchen","https://paypal.me/pwittchen"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"logo.png\" alt=\"logo\" height=\"250px\"\u003e\u003c/p\u003e\n\nRxBiometric [![Build Status](https://img.shields.io/travis/pwittchen/RxBiometric.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/pwittchen/RxBiometric)  ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/rxbiometric.svg?style=flat-square) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RxBiometric-brightgreen.svg?style=flat-square)](https://android-arsenal.com/details/1/7245)\n===========\nRxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android (added in Android 9 Pie, API Level 28+)\n\n*If your app is drawing its own fingerprint auth dialogs, you should switch to using the BiometricPrompt API as soon as possible.*\n\nIt's an official statement from [Google Android Developers Blog](https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html). RxBiometric helps you to do that via RxJava stream!\n\nContents\n--------\n\n- [Usage](#usage)\n- [Examples](#examples)\n- [Download](#download)\n- [Tests](#tests)\n- [Code style](#code-style)\n- [Static code analysis](#static-code-analysis)\n- [JavaDoc](#javadoc)\n- [Changelog](#changelog)\n- [Releasing](#releasing)\n- [Mentions](#mentions)\n- [References](#references)\n- [License](#license)\n\nUsage\n-----\n\nSimple library usage in **Kotlin** looks as follows:\n\n```kotlin\nRxBiometric\n  .title(\"title\")\n  .description(\"description\")\n  .negativeButtonText(\"cancel\")\n  .negativeButtonListener(DialogInterface.OnClickListener { _, _ -\u003e\n    showMessage(\"cancel\")\n  })\n  .executor(mainExecutor)\n  .build()\n  .authenticate(context)\n  .subscribeOn(Schedulers.io())\n  .observeOn(AndroidSchedulers.mainThread())\n  .subscribeBy(\n    onComplete = { showMessage(\"authenticated!\") },\n    onError = { showMessage(\"error\") }\n  )\n```\n\nLibrary also have validation method in the `Preconditions` class, which you can use to verify if you're able to use Biometric.\n\n```kotlin\nPreconditions.hasBiometricSupport(context)\n```\n\nThere's also `RxPreconditions` class, which has the same method wrapped in RxJava `Single\u003cBoolean\u003e` type,\nwhich you can use to create fluent data flow like in the example below\n\n```kotlin\nRxPreconditions\n  .hasBiometricSupport(context)\n  .flatMapCompletable {\n    if (!it) Completable.error(BiometricNotSupported())\n    else\n      RxBiometric\n        .title(\"title\")\n        .description(\"description\")\n        .negativeButtonText(\"cancel\")\n        .negativeButtonListener(DialogInterface.OnClickListener { _, _ -\u003e\n          showMessage(\"cancel\")\n        })\n        .executor(mainExecutor)\n        .build()\n        .authenticate(context)\n  }\n  .subscribeOn(Schedulers.io())\n  .observeOn(AndroidSchedulers.mainThread())\n  .subscribeBy(\n    onComplete = { showMessage(\"authenticated!\") },\n    onError = {\n      when (it) {\n        is AuthenticationError -\u003e showMessage(\"error\")\n        is AuthenticationFail -\u003e showMessage(\"fail\")\n        is AuthenticationHelp -\u003e showMessage(\"help\")\n        is BiometricNotSupported -\u003e showMessage(\"biometric not supported\")\n        else -\u003e showMessage(\"other error\")\n      }\n    }\n  )\n```\n\nIf you want to create your own CryptoObject and use it during authentication, then you can call `authenticate(context, cryptoObject)` method instead of `authenticate(context)`.\n\nOf course, **don't forget to dispose** `Disposable` appropriately in the Activity Lifecycle.\n\nLibrary can be used in the **Java** projects as well. Idea is the same, just syntax will be a bit different.\n\nExamples\n--------\n\nComplete example of the working application can be found in the `kotlin-app` directory.\n\nDownload\n--------\n\nYou can depend on the library through Gradle:\n\n```groovy\ndependencies {\n  implementation 'com.github.pwittchen:rxbiometric:0.1.0'\n}\n```\n\nTests\n-----\n\nTests are available in `library/src/test/kotlin/` directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:\n\n```\n./gradlew test\n```\n\nCode style\n----------\n\nCode style used in the project is called `SquareAndroid` from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.\n\nStatic code analysis\n--------------------\n\nStatic code analysis runs Checkstyle, PMD, Lint and Detekt. It can be executed with command:\n\n```\n./gradlew check\n```\n\nReports from analysis are generated in `library/build/reports/` directory.\n\nJavaDoc\n-------\n\nDocumentation can be generated as follows:\n\n```\n./gradlew dokka\n```\n\nOutput will be generated in `library/build/javadoc`\n\nJavaDoc can be viewed on-line at https://pwittchen.github.io/RxBiometric/library/\n\nChangelog\n---------\n\nSee [CHANGELOG.md](https://github.com/pwittchen/RxBiometric/blob/master/CHANGELOG.md) file.\n\nReleasing\n---------\n\nSee [RELEASING.md](https://github.com/pwittchen/RxBiometric/blob/master/RELEASING.md) file.\n\nMentions\n--------\n- [Android Weekly - issue #324](https://androidweekly.net/issues/issue-324)\n- [Android Weekly China - issue #194](https://androidweekly.cn/android-dev-weekly-issue-194/)\n- [30 summertime libraries which you don't want to miss in 2018](https://medium.com/@mmbialas/30-summertime-android-libraries-and-tools-which-you-dont-want-to-miss-in-2018-fab053d69503)\n\nReferences\n----------\n- https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html\n- https://android-developers.googleblog.com/2018/06/better-biometrics-in-android-p.html\n- https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt\n- https://github.com/Kieun/android-biometricprompt\n- https://android-developers.googleblog.com/2019/10/one-biometric-api-over-all-android.html\n\nLicense\n-------\n\n    Copyright 2018 Piotr Wittchen\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwittchen%2Frxbiometric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwittchen%2Frxbiometric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwittchen%2Frxbiometric/lists"}