सुरक्षित स्टोरेज: बायोमेट्रिक लॉक के साथ वैकल्पिक रूप से सुरक्षित एन्क्रिप्टेड डेटा स्टोर, iOS, Android, MacOS के लिए समर्थन। Linux, Windows और वेब (localStorage) के लिए आंशिक समर्थन।
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Biometric Storage एक Flutter पैकेज है जो सुरक्षित, एन्क्रिप्टेड डेटा स्टोरेज प्रदान करता है और समर्थित प्लेटफॉर्म पर वैकल्पिक बायोमेट्रिक प्रमाणीकरण (फिंगरप्रिंट या चेहरे की पहचान) प्रदान करता है। यह Android और iOS पर मूल सुरक्षा विशेषताओं का उपयोग करता है, और अन्य प्लेटफॉर्मों पर फॉलबैक एन्क्रिप्शन प्रदान करता है, जिसमें web (localStorage का उपयोग करके), macOS, Windows और Linux शामिल हैं। संवेदनशील डेटा जैसे पासवर्ड या टोकन के लिए डिज़ाइन किया गया, यह सुनिश्चित करता है कि डेटा भले ही डिवाइस को चोरी कर लिया गया हो भी, वह सुरक्षित रहे। यह पैकेज गोपनीयता-केंद्रित स्थानीय स्थायित्व की आवश्यकता वाले ऐप्स में बिना किसी दिक्कत के एकीकृत हो सकता है।
उपयोग
सुरक्षित पासवर्ड स्टोरेज
प्रमाणीकरण टोकन स्थायित्व
उपयोगकर्ता पसंदीदा एन्क्रिप्शन
जैविक लक्षण-सुरक्षित डेटा पहुँच
ऑफलाइन डेटा सुरक्षा
गोपनीयता-पहल ऐप विकास
मुख्य विशेषताएँ
एंड-टू-एंड एन्क्रिप्टेड स्टोरेज
जैविक ऑथेंटिकेशन समर्थन
प्लेटफॉर्म के अनुकूलता
एन्क्रिप्टेड स्थानीय भंडारण पर फॉलबैक करें
पठन/लेखन संचालन के लिए सरल API
प्लेटफॉर्म-विशिष्ट सुरक्षा एकीकरण
इनके लिए उपयुक्त
संवेदनशील उपयोगकर्ता डेटा का प्रबंधन करने वाले एप्स
पासवर्ड मैनेजर
सुरक्षित नोट लेने वाले ऐप्स
प्रमाणीकरण प्रणाली
गोपनीयता-केंद्रित एप्लिकेशन
डेटा सुरक्षा को प्राथमिकता देने वाले विकासकर्ता
विचार योग्य बातें
गैर-मोबाइल प्लेटफॉर्म पर सीमित जैविक अनुकूलन समर्थन
वेब संस्करण localStorage का उपयोग करता है (मूल अनुप्रयोग की तुलना में कम सुरक्षित)
सही अनुमति प्रबंधन की आवश्यकता है
कोई क्लाउड सिंक क्षमता नहीं
डेस्कटॉप प्लेटफॉर्म के लिए अतिरिक्त सेटअप की आवश्यकता हो सकती है
लेआउट ऑपरेटिंग सिस्टम सुरक्षा तंत्र पर निर्भर करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
biometric_storage
Encrypted file store, optionally secured by biometric lock
for Android, iOS, MacOS and partial support for Linux, Windows and Web.
Meant as a way to store small data in a hardware encrypted fashion. E.g. to
store passwords, secret keys, etc. but not massive amounts
of data.
Android: Uses androidx with KeyStore.
iOS and MacOS: LocalAuthentication with KeyChain.
Linux: Stores values in Keyring using libsecret. (No biometric authentication support).
Web: Warning Uses unauthenticated, unencrypted storage in localStorage.
If you have a better idea for secure storage on web platform, please open an Issue.
API Level >= 23 (android/app/build.gradleminSdkVersion 23)
Required only if you actually prompt for authentication, that is, if any
storage uses the default authenticationRequired: true. Storage created with
authenticationRequired: false never shows a BiometricPrompt, so neither of
the following applies to it:
MainActivity must extend FlutterFragmentActivity.BiometricPrompt
needs a FragmentActivity to host its dialog. If the plugin is attached to a
plain FlutterActivity it logs an error and every authenticated read or write
fails with AuthError:Failed — unauthenticated storage keeps working.
The activity theme must descend from Theme.AppCompat — but only for
devices where androidx.biometric falls back to drawing its own fingerprint
dialog, which it builds with androidx.appcompat.app.AlertDialog. That
fallback is used below API 28, on API 28 devices without a fingerprint
sensor, and on a short manufacturer allow-list where a crypto object forces
it. From API 28 onwards the system BiometricPrompt is used and the theme
does not matter.
The plugin writes to android.util.Log under the tag BiometricStorage. A
debug build logs everything; a release build logs nothing below INFO until you
ask for it:
That suits reading logs off a device. If your app collects its own — a file
appender, a crash reporter, slf4j, Timber — install a sink instead, from
Application.onCreate or your FlutterActivity, before the first call into
the plugin:
Installing a sink turns every level on, since it says something wants the
records. To decide the level yourself — including keeping verbose logging in a
release build without touching a device property — set it explicitly:
BiometricStorageLogging.level = Log.VERBOSE
throwable is passed separately rather than flattened into message, so you
can hand the real exception to whatever you report to. The sink is called on
whichever thread produced the record, so it must be safe to call from the main
thread and from a background executor.
include the NSFaceIDUsageDescription key in your app’s Info.plist file
Deployment target >= iOS 13 (below whatever Flutter itself requires, so in
practice this never binds).
Known Issue: since iOS 15 the simulator seem to no longer support local authentication:
https://developer.apple.com/forums/thread/685773
IosPromptInfo.saveTitle / accessTitle are invisible on Face ID devices.
Face ID authenticates against a HUD that shows its glyph and the words "Face ID"
and nothing else, and the "not recognized" alert after a failure offers only
retry and cancel. The strings do reach the system — they are set as
LAContext.localizedReason — but iOS does not draw them. Touch ID devices and
macOS do show them, so they are still worth setting.
Mac OS
include the NSFaceIDUsageDescription key in your app’s Info.plist file
enable keychain sharing and signing. (not sure why this is required. but without it
You will probably see an error like:
SecurityError, Error while writing data: -34018: A required entitlement isn't present.
Deployment target >= macOS 10.15.
Swift Package Manager (iOS and Mac OS)
The iOS and macOS implementations ship both a Package.swift and a podspec, so
they work with either dependency manager. Adding this plugin to an app that has
migrated to Swift Package Manager
does not bring CocoaPods back — no Podfile is generated.
Usage
You basically only need 4 methods.
Check whether biometric authentication is supported by the device
final response = awaitBiometricStorage().canAuthenticate()
if (response != CanAuthenticateResponse.success) {
// panic..
}
Create the access object
final storageFile = awaitBiometricStorage().getStorage('mystorage');
Read data
final data = await storageFile.read();
Write data
final myNewData = 'Hello World';
await storageFile.write(myNewData);
Storing without a biometric prompt — for a value a background task has to be
able to refresh, for example — is authenticationRequired: false. The value is
still encrypted at rest; it is simply not gated behind an authentication.
final storageFile = awaitBiometricStorage().getStorage(
'mystorage',
options: StorageFileInitOptions(authenticationRequired: false),
);
See also the API documentation: https://pub.dev/documentation/biometric_storage/latest/biometric_storage/BiometricStorageFile-class.html#instance-methods