@drefrajo/capacitor-biometric-keychain
v3.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
Downloads
58
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 v6 Android minSdkVersion 23 iOS min version 13.0
For Capacitor v5, use version 2.0.4 of this plugin.
Install
npm install @drefrajo/capacitor-biometric-keychain
npx cap sync
iOS
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; }>