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
Capacitor v5 Android minSdkVersion 23 iOS min version 13.0
Install
npm install @flowmoco/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 "@flowmoco/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; }>