otp_autofill 1.0.0 copy "otp_autofill: ^1.0.0" to clipboard
otp_autofill: ^1.0.0 copied to clipboard

outdated

Android implementation of OTP autofill with using User Consent API and Retriever API. Add possibility to receive OTP code from another input.

OTP autofill #

Build Status Coverage Status Pub Version Pub Likes Flutter Platform

This package is part of the SurfGear toolkit made by Surf.

About #

For sms autofill plugin use SMS User Consent API and SMS Retriever API on Android. IOS sms autofill built in TextField widget.

You could use autofill from another input by using OTPStrategy. (e.g. from push-notification)

For testing you could create TestStrategy.

iOS #

in iOS OTP autofill is built in TextField. Code from sms store for 3 minutes.

Rules for sms #

  1. Sms must contain the word code or it translation to ios supported localizations.
  2. Must be only one digit sequence in sms.

iOS Testing #

iOS can receive number from any other number.

Android #

OTPInteractor.hint - show system dialog to select saved phone numbers (recommendation from google) OTPInteractor.getAppSignature - create hash-code of your application, that used in SMS Retriever API OTPInteractor.startListenUserConsent - BroadcastReceiver start listen for code from Google Services for 5 minutes. Above 5 minutes raise timeout exception. Using SMS User Consent API OTPInteractor.startListenRetriever - BroadcastReceiver start listen for code from Google Services for 5 minutes. Above 5 minutes raise timeout exception. Using SMS Retriever API OTPInteractor.stopListenForCode - use in dispose

Plugin receive full sms text, need parser for sms.

If you use SMS User Consent API then system ask for permission to reed incoming message.

  1. The message contains a 4-10 character alphanumeric string with at least one number.
  2. The message was sent by a phone number that's not in the user's contacts.
  3. If you specified the sender's phone number, the message was sent by that number.

Rules for sms. SMS Retriever API #

  1. Be no longer than 140 bytes
  2. Contain a one-time code that the client sends back to your server to complete the verification flow
  3. Include an 11-character hash string that identifies your app (documentation for server, for testing you can get in from OTPInteractor.getAppSignature)

Android Testing #

OTPInteractor.startListenForCode has senderPhone argument. Application start receiving code from this number.

Usage #

You could user OTPInteractor to interact with OTP.

For easy implementation you could use OTPTextEditController as a controller to your TextField.

OTPTextEditController.startListenUserConsent - use SMS User Consent API, and custom strategies. OTPTextEditController.startListenRetriever - use SMS Retriever API, and custom strategies. OTPTextEditController.startListenOnlyStrategies - listen only custom strategies. OTPTextEditController.stopListen - use in dispose.

Installation #

Add otp_autofill to your pubspec.yaml file:

dependencies:
  otp_autofill: ^1.0.0

You can use both stable and dev versions of the package listed above in the badges bar.

Changelog #

All notable changes to this project will be documented in this file.

Issues #

For issues, file directly in the main SurfGear repo.

Contribute #

If you would like to contribute to the package (e.g. by improving the documentation, solving a bug or adding a cool new feature), please review our contribution guide first and send us your pull request.

You PRs are always welcome.

How to reach us #

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

Telegram

License #

Apache License, Version 2.0

206
likes
0
pub points
97%
popularity

Publisher

verified publishersurf.ru

Android implementation of OTP autofill with using User Consent API and Retriever API. Add possibility to receive OTP code from another input.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on otp_autofill