{"id":17044950,"url":"https://github.com/codenameone/fingerprintscanner","last_synced_at":"2025-10-06T17:13:00.628Z","repository":{"id":37270314,"uuid":"89905954","full_name":"codenameone/FingerprintScanner","owner":"codenameone","description":"Support for fingerprint scanning/TouchID in Codename One mobile applications","archived":false,"fork":false,"pushed_at":"2024-01-27T14:32:16.000Z","size":463,"stargazers_count":5,"open_issues_count":5,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-11T13:05:49.555Z","etag":null,"topics":["android-library","authentication","biometrics","codenameone","fingerprint","fingerprint-sensor","fingerprint-validation","ios","touchid"],"latest_commit_sha":null,"homepage":"https://www.codenameone.com/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codenameone.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-05-01T07:33:23.000Z","updated_at":"2025-08-20T01:26:35.000Z","dependencies_parsed_at":"2022-09-14T22:52:02.376Z","dependency_job_id":"6b19161b-f2db-41fe-95da-25ab03d7e825","html_url":"https://github.com/codenameone/FingerprintScanner","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/codenameone/FingerprintScanner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FFingerprintScanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FFingerprintScanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FFingerprintScanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FFingerprintScanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codenameone","download_url":"https://codeload.github.com/codenameone/FingerprintScanner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FFingerprintScanner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278646797,"owners_count":26021512,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-library","authentication","biometrics","codenameone","fingerprint","fingerprint-sensor","fingerprint-validation","ios","touchid"],"created_at":"2024-10-14T09:36:00.113Z","updated_at":"2025-10-06T17:13:00.601Z","avatar_url":"https://github.com/codenameone.png","language":"Java","readme":"= Fingerprint Scanner\n\nFingerprint scanning and biometric support for https://www.codenameone.com[Codename One].\n\nimage::images/fingerprint-scanner-feature.jpg[]\n\nThis cn1lib provides basic support for fingerprint scanning on iOS/Android with one API. Due to the difference between the two implementations we chose a simplified approach that just verifies the fingerprint and doesn't delve into the nuanced complexities for this API.\n\n== Supported Platforms\n\nCurrently this library supports only Android (API 23+), and iOS.\n\n== Installation\n\nFor instructions on installing cn1libs, see https://www.codenameone.com/blog/automatically-install-update-distribute-cn1libs-extensions.html[this tutorial].\n\n=== Alternate Maven Installation\n\nIf your project uses Maven, the above installation instructions will still work, but you can alternately simply add the Maven dependency to your common/pom.xml file:\n\n[source,xml]\n----\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.codenameone\u003c/groupId\u003e\n  \u003cartifactId\u003efingerprint-scanner-lib\u003c/artifactId\u003e\n  \u003cversion\u003e1.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n----\n\n[IMPORTANT]\n====\nAndroid builds *must* use build tools 29 or higher.  E.g.  Add the following build hints:\n\n----\nandroid.buildToolsVersion=29.0.3\nandroid.targetSdkVersion=29.0.3\n----\n====\n\n== Basic Usage\n\n[source,java]\n----\nFingerprint.scanFingerprint(\"Use your finger print to unlock AppName.\", value -\u003e {\n    Log.p(\"Scan successfull!\");\n}, (sender, err, errorCode, errorMessage) -\u003e {\n    Log.p(\"Scan Failed!\");\n});\n----\n\nNote that the values passed to value/fail are `null` and don't include any data at this time...\n\nAlso check out the following samples:\n\n. https://github.com/codenameone/FingerprintScannerTest[FingerprintScannerTest App] - Basic usage.  Just fingerprint scanning.\n. https://github.com/codenameone/CodenameOne/blob/master/Samples/samples/FingerprintScannerSample/FingerprintScannerSample.java[FingerprintScannerSample] - From Codename One samples.  Includes sample of storing, retrieving, and deleting passwords.\n\n\n== Protecting Passwords with Fingerprints\n\nThis library also allows you to store passwords in the system keychain, protected by biometric authentication.  The user will be asked to authenticate with their fingerprint (or Face recognition on supported devices) in order to retrieve passwords using this library.  On Android, currently the user is also prompted to authenticate when storing passwords as well.\n\nNOTE: While these methods say that they are for storing passwords, you can use them for storing any text.  Both Android and iOS should allow you to store strings of sufficiently large size to store anything you might otherwise store in Preferences.\n\n=== Storing Passwords\n\n[source,java]\n----\nString account = \"steve@example.com\";\nString password = \"....\";\n\nFingerprint.addPassword(\n    \"Adding secure item to keystore\", // Message to display in authentication dialog\n    account, \n    password\n).onResult((success, err)-\u003e{\n    if (err != null) {\n        Log.e(err);\n        ToastBar.showErrorMessage(\"Failed to add password to keystore: \"+ err.getMessage());\n    } else {\n        // success always true if there was no error.\n        ToastBar.showInfoMessage(\"Successfully added password to keystore\");\n    }\n});\n----\n\n=== Retrieving Passwords\n\n[source,java]\n----\nString account = \"steve@example.com\";\n\nFingerprint.getPassword(\n    \"Getting secure item\",  // Message to display in auth dialog\n    account\n).onResult((password, err)-\u003e{\n    if (err != null) {\n        // Error condition occurs both if the keychain doesn't have \n        // a password for the given account, or if a failure occurs\n        // in retrieving it.\n        // NOTE:  If the user adds a finger or face to biometric scanning\n        // or disables password protection on the device, all passwords\n        // will be purged automatically.\n        Log.e(err);\n        ToastBar.showErrorMessage(\"Failed to get password: \" + err.getMessage());\n    } else {\n        System.out.println(\"The password was \"+password);\n    }\n});\n----\n\n=== Deleting Passwords\n\n[source,java]\n----\nString account = \"steve@example.com\";\n\nFingerprint.deletePassword(\n    \"Getting secure item\",   // Message to display in auth dialog\n    keyName.getText()\n).onResult((res, err)-\u003e{\n    if (err != null) {\n        Log.e(err);\n        ToastBar.showErrorMessage(\"Failed to delete password: \"+err.getMessage());\n    } else {\n        System.out.println(\"Deleted the password for account \"+account);\n    }\n});\n----\n\n=== Password Invalidation\n\nPasswords stored in the keychain will be automatically purged if any of the following occurs:\n\n. The user adds additional fingers to fingerprint authentication.\n. The user adds additional faces to face ID biometric authentication.\n. The user turns off phone login security.  E.g. if they turn off password or fingerprint requirements for login to the phone.\n\n=== Android Implementation\n\nCurrently, on Android we are using the https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager[FingerprintManager] class for authentication on API 28 (Android 9) and lower and https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt[BiometricPrompt] on devices running API 29 (Android 10) and higher.  This means that Android 9, despite supporting Face recognition at an OS level, will use FingerPrintManager and will not support face recognition for authentication.  Future versions may attempt to incorporate workarounds to add this support to Android 9, e.g. https://github.com/sergeykomlach/AdvancedBiometricPromptCompat[AdvancedBiometricPromptCompat].\n\nPasswords are not, themselves, stored inside the system Keystore.  Rather, a symmetric Key is generated and stored inside the keychain, which is used to encrypt and decrypt the passwords, which are stored private `SharedPreferences`.\n\nCurrently the key specifications are:\n\n[source,java]\n----\nnew KeyGenParameterSpec.Builder(\n    KEY_ID,\n    KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT\n)\n.setBlockModes(KeyProperties.BLOCK_MODE_CBC)\n.setUserAuthenticationRequired(true)\n.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)\n----\n\nRefer to the https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder[KeyGenParameterSpec.Builder docs] for a more detailed description of what these settings mean.\n\nThe `.setUserAuthenticationRequired(true)` call is what causes the key to become invalid when the user adds fingers or faces to authentication.\n\n=== iOS Implementation\n\nOn iOS, the library acts as a thin layer on top of the https://developer.apple.com/documentation/security/1401659-secitemadd?language=objc[SecItemAdd], https://developer.apple.com/documentation/security/1398306-secitemcopymatching?language=objc[SecItemCopyMatching], and https://developer.apple.com/documentation/security/1395547-secitemdelete?language=objc[SecItemDelete] functions which directly add passwords to the keychain.\n\nThe security settings on the passwords are:\n\n[source,objective-c]\n----\nSecAccessControlRef sacRef = SecAccessControlCreateWithFlags(kCFAllocatorDefault,\n    kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly,\n    kSecAccessControlTouchIDCurrentSet, \n    nil\n);\n----\n\nFor more details on what these mean, see the following documentation pages:\n\n. https://developer.apple.com/documentation/security/secaccesscontrolref?language=objc[SecAccessControlRef]\n. https://developer.apple.com/documentation/security/ksecattraccessiblewhenpasscodesetthisdeviceonly?language=objc[kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly]\n. https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroltouchidcurrentset?language=objc[kSecAccessControlTouchIDCurrentSet]\n\n\n== Working with the Sources\n\n. Check out with `git clone https://github.com/codenameone/FingerprintScanner`\n. Build with `mvn package`\n.. You'll find cn1lib in the _common/target_ directory.\n\nSee https://shannah.github.io/codenameone-maven-manual/[the Codename One Maven Manual] for more information about working with Codename One Maven projects.\n\n=== Releasing to Maven Central\n\n1. Set up your ~/.m2/settings.xml file with credentials for Maven central.\n2. Run `bash update-version.sh $NEW_VERSION` where `$NEW_VERSION` is the new version.  E.g. \"1.1\".\n3. `git push \u0026\u0026 git push --tags` to push the new version tag to git.\n4. `mvn deploy -Psign-artifacts`\n5. Log into Maven central and complete the release.\n6. Run `bash update-version $NEW_SNAPSHOT_VERSION` where `$NEW_SNAPSHOT_VERSION` is the next snapshot version  E.g. 1.2-SNAPSHOT.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenameone%2Ffingerprintscanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodenameone%2Ffingerprintscanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenameone%2Ffingerprintscanner/lists"}