उपयोगकर्ता सहमति API और प्राप्त करने वाले API के उपयोग करके OTP स्वचालित भरने का Android कार्यान्वयन। अन्य इनपुट से OTP कोड प्राप्त करने की संभावना जोड़ें।
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
otp_autofill पैकेज उपयोगकर्ता सहमति API और रिट्रीवर API का उपयोग करके Android OTP स्वचालित भरने की अनुमति देता है, जिससे एप्लिकेशन सिंगल-टाइम पासवर्ड को SMS से स्वचालित रूप से पहचान और भर सकते हैं। यह ओटीपी कोड को विकल्प इनपुट स्रोतों से प्राप्त करने का समर्थन करता है, जिससे प्रमाणीकरण के दौरान उपयोगकर्ता अनुभव में सुधार होता है। पैकेज iOS पर भी काम करता है, जिससे पिन और ओटीपी फ़ील्ड के लिए क्रॉस-प्लेटफॉर्म संगतता प्रदान करता है। फॉर्म इनपुट के साथ बिना किसी बाधा के एकीकरण के लिए डिज़ाइन किया गया है, जिससे हस्तलिखित एंट्री त्रुटियों को कम किया जाता है और लॉगिन प्रक्रिया को तेज किया जाता है।
उपयोग
लॉगिन फॉर्म में स्वचालित OTP डिटेक्शन
द्विकारक प्रमाणीकरण के दौरान उपयोगकर्ता अनुभव में सुधार
SMS-आधारित सत्यापन प्रवाहों का समर्थन करना
मौजूदा पिन या पासवर्ड इनपुट फ़ील्ड के साथ एकीकरण
प्रतिस्थापन स्रोतों से फॉलबैक OTP प्राप्त करना सक्षम करें
मुख्य विशेषताएँ
Android के उपयोगकर्ता सहमति और रिट्रीवर API का उपयोग करता है
क्रॉस-प्लेटफॉर्म समर्थन (Android और iOS)
SMS से स्वचालित OTP कोड निकालें
OTP प्राप्त करने के लिए फॉलबैक इनपुट विधि
पाठ फ़ील्ड के साथ सरल एकीकरण
इनके लिए उपयुक्त
सुरक्षित OTP इनपुट की आवश्यकता वाले ऐप्स
SMS सत्यापन के साथ प्रमाणीकरण फ़्लो
कम उपयोगकर्ता बाधा की तलाश में विकासकर्ता
एंड्रॉइड और आईओएस प्लेटफॉर्म के लिए प्रोजेक्ट्स
PIN/OTP फ़ील्ड वाले फॉर्म-भारी एप्लिकेशन
विचार योग्य बातें
पूर्ण कार्यक्षमता के लिए Android SDK 28+ की आवश्यकता होती है
अतिरिक्त सेटअप के बिना Android SMS ऑटोफिल के सीमित
iOS कार्यान्वयन प्रणाली-स्तरीय OTP संभाल पर निर्भर करता है
Android पर SMS एक्सेस के लिए आवश्यक अनुमतियाँ
विभिन्न उपकरण निर्माताओं के बीच परीक्षण की आवश्यकता हो सकती है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
You could use autofill from another input by using the OTPStrategy (e.g. from push-notification).
For testing you could create a TestStrategy.
iOS
On iOS, the OTP autofill feature is integrated into the TextField component.
The code received from an SMS is stored for a duration of 3 minutes.
Rules for sms
Sms must contain the word code or its translation in iOS supported localizations.
The sms should contain only one sequence of digits.
iOS Testing
The iOS platform is capable of receiving OTP from any phone number, not just a specific sender.
Android
OTPInteractor.hint - displays a system dialog that allows the user to select from their saved phone numbers (recommendation from Google).
OTPInteractor.getAppSignature - creates the hash code of your application, which is used in the SMS Retriever API.
OTPInteractor.startListenUserConsent - the broadcast receiver that starts listening for OTP codes using the SMS User Consent API. It listens for a duration of 5 minutes, after which a timeout exception occurs.
OTPInteractor.startListenRetriever - the broadcast receiver that starts listening for OTP codes using the SMS Retriever API. It listens for a duration of 5 minutes, after which a timeout exception occurs.
OTPInteractor.stopListenForCode - used in dispose.
The plugin is designed to receive the full text of an SMS message and requires a parser to extract the relevant information from the message.
If you use the SMS User Consent API, the system will prompt the user for permission to access and read incoming messages.
It should contain a one-time code that the client sends back to your server to complete the verification process.
It should include an 11-character hash string that identifies your app (refer to the documentation for server for more details). For testing, you can obtain it from OTPInteractor.getAppSignature.
Android Testing
The OTPInteractor.startListenForCode method allows the application to start receiving verification codes from a specific phone number, specified by the senderPhone argument.
You also can use Android Emulator to test the plugin. To do this, you need to send an SMS to the emulator with the following command:
adb emu sms send <senderPhone> <message>
E.g.:
adb emu sms send 900 "Your code is 12345. Do not share it with anyone."
Make sure senderPhone is the same as the one you specified in the startListenForCode method.
Usage
You should use OTPInteractor to interact with OTP.
To simplify implementation, consider using the OTPTextEditController as a controller for your TextField.
OTPTextEditController.startListenUserConsent - uses the SMS User Consent API and listens to user strategies.
OTPTextEditController.startListenRetriever - uses the SMS Retriever API and listens to user strategies.
OTPTextEditController.startListenOnlyStrategies - only listens to user strategies.
OTPTextEditController.stopListen - used in dispose.
Installation
Add otp_autofill to your pubspec.yaml file:
dependencies:otp_autofill:$currentVersion$
At this moment, the current version of otp_autofill is .
Android Installation
Set minSdkVersion at least to 19 in <project root>/android/app/build.gradle.
To receive a new code when a timeout exception occurs, you can pass a callback function to the onTimeOutException parameter and start listen for a new code.
All significant changes to this project will be documented in this file.
Issues
To report any issues, submit them directly in the Issues section.
Contribute
If you wish to contribute to the package (for instance, by enhancing the documentation, fixing a bug, or introducing a new feature), please review our contribution guide first and then submit your pull request.
Your PRs are always welcome.
How to reach us
Please don't hesitate to ask any questions about this package. Join our community chat on Telegram. We communicate in both English and Russian.