{"id":28699960,"url":"https://github.com/Cap-go/capacitor-native-biometric","last_synced_at":"2025-06-14T11:03:47.524Z","repository":{"id":168429492,"uuid":"644150478","full_name":"Cap-go/capacitor-native-biometric","owner":"Cap-go","description":"Use biometrics confirm device owner presence or authenticate users.","archived":false,"fork":true,"pushed_at":"2025-02-17T18:35:54.000Z","size":6408,"stargazers_count":53,"open_issues_count":11,"forks_count":20,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-27T08:34:05.286Z","etag":null,"topics":["capacitor","capacitor-plugin","ionic"],"latest_commit_sha":null,"homepage":"https://capgo.app","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"epicshaggy/capacitor-native-biometric","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-05-22T23:40:01.000Z","updated_at":"2025-05-27T01:32:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"75c24297-43fb-4bc1-bba4-5fd892077590","html_url":"https://github.com/Cap-go/capacitor-native-biometric","commit_stats":{"total_commits":133,"total_committers":23,"mean_commits":5.782608695652174,"dds":0.7593984962406015,"last_synced_commit":"f8427d47301272764cb3b9ce178286050bb02c6b"},"previous_names":["cap-go/capacitor-native-biometric"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-biometric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-biometric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-biometric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-biometric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/capacitor-native-biometric/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-native-biometric/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257320548,"owners_count":22527371,"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":["capacitor","capacitor-plugin","ionic"],"created_at":"2025-06-14T11:01:32.158Z","updated_at":"2025-06-14T11:03:47.513Z","avatar_url":"https://github.com/Cap-go.png","language":"Java","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":["[Capgo plugins](https://capgo.app/)","Capgo Capacitor Plugins"],"sub_categories":["Authentication \u0026 Security"],"readme":"# Capacitor Native Biometric \n \u003ca href=\"https://capgo.app/\"\u003e\u003cimg src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/?ref=plugin\"\u003e ➡️ Get Instant updates for your App with Capgo 🚀\u003c/a\u003e\u003c/h2\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/consulting/?ref=plugin\"\u003e Fix your annoying bug now, Hire a Capacitor expert 💪\u003c/a\u003e\u003c/h2\u003e\n\u003c/div\u003e\n\n\nUse biometrics confirm device owner presence or authenticate users. A couple of methods are provided to handle user credentials. These are securely stored using Keychain (iOS) and Keystore (Android).\n\n## Installation (Only supports Capacitor 7)\n\n- `npm i @capgo/capacitor-native-biometric`\n\n## Usage\n\n```ts\nimport { NativeBiometric, BiometryType } from \"@capgo/capacitor-native-biometric\";\n\nasync performBiometricVerification(){\n  const result = await NativeBiometric.isAvailable();\n\n  if(!result.isAvailable) return;\n\n  const isFaceID = result.biometryType == BiometryType.FACE_ID;\n\n  const verified = await NativeBiometric.verifyIdentity({\n    reason: \"For easy log in\",\n    title: \"Log in\",\n    subtitle: \"Maybe add subtitle here?\",\n    description: \"Maybe a description too?\",\n  })\n    .then(() =\u003e true)\n    .catch(() =\u003e false);\n\n  if(!verified) return;\n\n  const credentials = await NativeBiometric.getCredentials({\n    server: \"www.example.com\",\n  });\n}\n\n// Save user's credentials\nNativeBiometric.setCredentials({\n  username: \"username\",\n  password: \"password\",\n  server: \"www.example.com\",\n}).then();\n\n// Delete user's credentials\nNativeBiometric.deleteCredentials({\n  server: \"www.example.com\",\n}).then();\n```\n\n### Biometric Auth Errors\n\nThis is a plugin specific list of error codes that can be thrown on verifyIdentity failure, or set as a part of isAvailable. It consolidates Android and iOS specific Authentication Error codes into one combined error list.\n\n| Code | Description                 | Platform                     |\n| ---- | --------------------------- | ---------------------------- |\n| 0    | Unknown Error               | Android, iOS                 |\n| 1    | Biometrics Unavailable      | Android, iOS                 |\n| 2    | User Lockout                | Android, iOS                 |\n| 3    | Biometrics Not Enrolled     | Android, iOS                 |\n| 4    | User Temporary Lockout      | Android (Lockout for 30sec)  |\n| 10   | Authentication Failed       | Android, iOS                 |\n| 11   | App Cancel                  | iOS                          |\n| 12   | Invalid Context             | iOS                          |\n| 13   | Not Interactive             | iOS                          |\n| 14   | Passcode Not Set            | Android, iOS                 |\n| 15   | System Cancel               | Android, iOS                 |\n| 16   | User Cancel                 | Android, iOS                 |\n| 17   | User Fallback               | Android, iOS                 |\n\n\u003cdocgen-index\u003e\n\n* [`isAvailable(...)`](#isavailable)\n* [`verifyIdentity(...)`](#verifyidentity)\n* [`getCredentials(...)`](#getcredentials)\n* [`setCredentials(...)`](#setcredentials)\n* [`deleteCredentials(...)`](#deletecredentials)\n* [Interfaces](#interfaces)\n* [Enums](#enums)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### isAvailable(...)\n\n```typescript\nisAvailable(options?: IsAvailableOptions | undefined) =\u003e Promise\u003cAvailableResult\u003e\n```\n\nChecks if biometric authentication hardware is available.\n\n| Param         | Type                                                              |\n| ------------- | ----------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#isavailableoptions\"\u003eIsAvailableOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#availableresult\"\u003eAvailableResult\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### verifyIdentity(...)\n\n```typescript\nverifyIdentity(options?: BiometricOptions | undefined) =\u003e Promise\u003cvoid\u003e\n```\n\nPrompts the user to authenticate with biometrics.\n\n| Param         | Type                                                          |\n| ------------- | ------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#biometricoptions\"\u003eBiometricOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### getCredentials(...)\n\n```typescript\ngetCredentials(options: GetCredentialOptions) =\u003e Promise\u003cCredentials\u003e\n```\n\nGets the stored credentials for a given server.\n\n| Param         | Type                                                                  |\n| ------------- | --------------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#getcredentialoptions\"\u003eGetCredentialOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#credentials\"\u003eCredentials\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### setCredentials(...)\n\n```typescript\nsetCredentials(options: SetCredentialOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nStores the given credentials for a given server.\n\n| Param         | Type                                                                  |\n| ------------- | --------------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#setcredentialoptions\"\u003eSetCredentialOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### deleteCredentials(...)\n\n```typescript\ndeleteCredentials(options: DeleteCredentialOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nDeletes the stored credentials for a given server.\n\n| Param         | Type                                                                        |\n| ------------- | --------------------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#deletecredentialoptions\"\u003eDeleteCredentialOptions\u003c/a\u003e\u003c/code\u003e |\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### AvailableResult\n\n| Prop               | Type                                                  |\n| ------------------ | ----------------------------------------------------- |\n| **`isAvailable`**  | \u003ccode\u003eboolean\u003c/code\u003e                                  |\n| **`biometryType`** | \u003ccode\u003e\u003ca href=\"#biometrytype\"\u003eBiometryType\u003c/a\u003e\u003c/code\u003e |\n| **`errorCode`**    | \u003ccode\u003enumber\u003c/code\u003e                                   |\n\n\n#### IsAvailableOptions\n\n| Prop              | Type                 | Description                                                                                           |\n| ----------------- | -------------------- | ----------------------------------------------------------------------------------------------------- |\n| **`useFallback`** | \u003ccode\u003eboolean\u003c/code\u003e | Specifies if should fallback to passcode authentication if biometric authentication is not available. |\n\n\n#### BiometricOptions\n\n| Prop                       | Type                        | Description                                                                                                                                                | Default        |\n| -------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |\n| **`reason`**               | \u003ccode\u003estring\u003c/code\u003e         |                                                                                                                                                            |                |\n| **`title`**                | \u003ccode\u003estring\u003c/code\u003e         |                                                                                                                                                            |                |\n| **`subtitle`**             | \u003ccode\u003estring\u003c/code\u003e         |                                                                                                                                                            |                |\n| **`description`**          | \u003ccode\u003estring\u003c/code\u003e         |                                                                                                                                                            |                |\n| **`negativeButtonText`**   | \u003ccode\u003estring\u003c/code\u003e         |                                                                                                                                                            |                |\n| **`useFallback`**          | \u003ccode\u003eboolean\u003c/code\u003e        | Specifies if should fallback to passcode authentication if biometric authentication fails.                                                                 |                |\n| **`fallbackTitle`**        | \u003ccode\u003estring\u003c/code\u003e         | Only for iOS. Set the text for the fallback button in the authentication dialog. If this property is not specified, the default text is set by the system. |                |\n| **`maxAttempts`**          | \u003ccode\u003enumber\u003c/code\u003e         | Only for Android. Set a maximum number of attempts for biometric authentication. The maximum allowed by android is 5.                                      | \u003ccode\u003e1\u003c/code\u003e |\n| **`allowedBiometryTypes`** | \u003ccode\u003eBiometryType[]\u003c/code\u003e | Only for Android. Specify which biometry types are allowed for authentication. If not specified, all available types will be allowed.                      |                |\n\n\n#### Credentials\n\n| Prop           | Type                |\n| -------------- | ------------------- |\n| **`username`** | \u003ccode\u003estring\u003c/code\u003e |\n| **`password`** | \u003ccode\u003estring\u003c/code\u003e |\n\n\n#### GetCredentialOptions\n\n| Prop         | Type                |\n| ------------ | ------------------- |\n| **`server`** | \u003ccode\u003estring\u003c/code\u003e |\n\n\n#### SetCredentialOptions\n\n| Prop           | Type                |\n| -------------- | ------------------- |\n| **`username`** | \u003ccode\u003estring\u003c/code\u003e |\n| **`password`** | \u003ccode\u003estring\u003c/code\u003e |\n| **`server`**   | \u003ccode\u003estring\u003c/code\u003e |\n\n\n#### DeleteCredentialOptions\n\n| Prop         | Type                |\n| ------------ | ------------------- |\n| **`server`** | \u003ccode\u003estring\u003c/code\u003e |\n\n\n### Enums\n\n\n#### BiometryType\n\n| Members                   | Value          |\n| ------------------------- | -------------- |\n| **`NONE`**                | \u003ccode\u003e0\u003c/code\u003e |\n| **`TOUCH_ID`**            | \u003ccode\u003e1\u003c/code\u003e |\n| **`FACE_ID`**             | \u003ccode\u003e2\u003c/code\u003e |\n| **`FINGERPRINT`**         | \u003ccode\u003e3\u003c/code\u003e |\n| **`FACE_AUTHENTICATION`** | \u003ccode\u003e4\u003c/code\u003e |\n| **`IRIS_AUTHENTICATION`** | \u003ccode\u003e5\u003c/code\u003e |\n| **`MULTIPLE`**            | \u003ccode\u003e6\u003c/code\u003e |\n\n\u003c/docgen-api\u003e\n## Face ID (iOS)\n\nTo use FaceID Make sure to provide a value for NSFaceIDUsageDescription, otherwise your app may crash on iOS devices with FaceID.\n\nThis value is just the reason for using FaceID. You can add something like the following example to App/info.plist:\n\n```xml\n\u003ckey\u003eNSFaceIDUsageDescription\u003c/key\u003e\n\u003cstring\u003eFor an easier and faster log in.\u003c/string\u003e\n```\n\n## Biometric (Android)\n\nTo use android's BiometricPrompt api you must add the following permission to your AndroidManifest.xml:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.USE_BIOMETRIC\"\u003e\n```\n\nAnd register the plugin by adding it to you MainActivity's onCreate (Not needed for Capacitor 3):\n\n```java\nimport ee.forgr.biometric.NativeBiometric;\n\npublic class MainActivity extends BridgeActivity {\n  @Override\n  public void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    // Initializes the Bridge\n    this.init(savedInstanceState, new ArrayList\u003cClass\u003c? extends Plugin\u003e\u003e() {{\n      // Additional plugins you've installed go here\n      // Ex: add(TotallyAwesomePlugin.class);\n      add(NativeBiometric.class);\n    }});\n  }\n}\n```\n\n## Contributors\n\n[Jonthia](https://github.com/jonthia)\n[QliQ.dev](https://github.com/qliqdev)\n[Brian Weasner](https://github.com/brian-weasner)\n[Mohamed Diarra](https://github.com/mohdiarra)\n### Want to Contribute?\n\nLearn about contributing [HERE](./CONTRIBUTING.md)\n\n## Notes\n\nHasn't been tested on Android API level 22 or lower.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCap-go%2Fcapacitor-native-biometric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCap-go%2Fcapacitor-native-biometric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCap-go%2Fcapacitor-native-biometric/lists"}