@drefrajo/capacitor-biometric-keychain
v5.0.0
Published
Uses Keychain and Keystore on ios and android respectively to give a secure localStorage like API that uses a biometric lock for read and update operations
Readme
capacitor-biometric-keychain
Uses Keychain and Keystore on ios and android respectively to give a secure localStorage like API that uses a biometric lock for read and update operations
This is a fork of @flowmoco/capacitor-biometric-keychain, this way I can maintain it more easily.
Capacitor v8 Android minSdkVersion 24 iOS min version 15.0 Android builds require Java 21.
For Capacitor v7, use version 4.0.0 of this plugin. For Capacitor v6, use version 3.0.0 of this plugin. For Capacitor v5, use version 2.0.4 of this plugin.
Install
npm install @drefrajo/capacitor-biometric-keychain
npx cap synciOS
To enable FaceID, you must set the the NSFaceIDUsageDescription key.
<key>NSFaceIDUsageDescription</key>
<string>[Reason why your app needs FaceID]</string>Import
import { BiometricNative } from "@drefrajo/capacitor-biometric-keychain";API
getItem(...)
getItem(options: { key: string; }) => Promise<{ value: string; error?: any; }>Async get an item from the secure storage. Will invoke device biometric authentication.
| Param | Type |
| ------------- | ----------------------------- |
| options | { key: string; } |
Returns: Promise<{ value: string; error?: any; }>
setItem(...)
setItem(options: { key: string; value: string; }) => Promise<{ error?: any; }>Async set an item in secure storage. Will invoke device biometric authentication on Android and only on iOS if overwriting an existing key.
| Param | Type |
| ------------- | -------------------------------------------- |
| options | { key: string; value: string; } |
Returns: Promise<{ error?: any; }>
removeItem(...)
removeItem(options: { key: string; }) => Promise<{ error?: any; }>Async remove an item from the secure storage. Will not invoke device biometric authentication either platform.
| Param | Type |
| ------------- | ----------------------------- |
| options | { key: string; } |
Returns: Promise<{ error?: any; }>
