パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.3.2

flutter_otp

OTPの送信および検証用のFlutterパッケージ。4桁のOTP(カスタマイズ可能)が、指定された電話番号(および国コード)にSMSで送信されます。

30日間ダウンロード
111
いいね数
85
Pub ポイント
40

パッケージをインストール

flutter pub add flutter_otp

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

SMS経由でワンタイムパスワード(OTP)を送信および検証するプロセスを簡素化することを目的としたFlutterパッケージです。カスタマイズ可能なOTPの長さ(通常4桁)をサポートし、国コード付きの電話番号と統合されています。このパッケージは、OTPの生成、配信、検証を安全かつ効率的に処理することで、ユーザー認証フローを簡素化します。二要素認証が必要なログイン、登録、アカウント回復ワークフローに最適です。

用途

  • OTPを使用したユーザーのログイン
  • アカウントの確認
  • パスワードのリセット
  • 二要素認証
  • セキュアなオンボーディング
  • SMSベースの認証

主な機能

  • カスタマイズ可能なOTP長さ
  • OTP配信のためのSMS統合
  • 国コードのサポート
  • OTP 検証のためのシンプルな API
  • セキュアなOTP処理
  • 最小限の構成で簡単セットアップ

適している対象

  • OTP検証を必要とするモバイルアプリ
  • 認証システム
  • ユーザー登録フロー
  • セキュリティを重視したアプリケーション
  • SMSベースの2FAを使用するアプリ
  • 迅速なOTP実装を求める開発者

注意事項

  • 外部SMSサービスに依存しています
  • SMS配信方法に限定
  • 組み込みのOTP有効期限管理なし
  • 失敗した配信に対する適切なエラーハンドリングが必要です
  • サードパーティのSMSプロバイダの信頼性に依存する
  • オフライン使用には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Awesome Flutter contributions welcome Known Vulnerabilities Build Status

flutter_otp

A Flutter package for Android and iOS for sending and verifying OTP to a Phone number.

Important message for existing Users
NEW FEATURE !!

Now you can send the message to any country code passed as a parameter to the interface (sendOtp() function)

Installing

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_otp: ^0.3.2
2. Install it

You can install packages from the command line: with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_otp/flutter_otp.dart';

Functions

The important functions used in the package are :

  1. sendOtp() to send a OTP (four digit by default, but customizable):
void sendOtp(String phoneNumber, [String messageText]) {
    ...        
}

NOTE:

  1. 10 digit phoneNumber should be passed.
  2. parameter "messageText" is optional. By default the message text is "Your OTP is : XXXX". If "messageText" parameter is passed then message is sent as " XXXX".
  1. resultChecker() which takes the OTP entered by the user as a parameter. The function returns true if OTP is matched, else false is returned.
bool resultChecker(int enteredOtp) {
    ...
} 

NOTE: The OTP entered by user (say, through TextField widget or TextFormField widget etc) is to be passed as a parameter to this function.

Usage

To use this package in your application you need to have a sim card in your mobile.

Example Usage:

...
sendOtp('958347XXXX');  //Pass phone number as String

...

int enteredOtp;
TextField(
  onChanged: (val) {
    enteredOtp = val;    
  }
)

...

bool isCorrectOTP = resultChecker();
if(isCorrectOTP) {
    print('Success');
} else {
    print('Failure');
}
...

OR custom "messageText" can be passed as parameter to sendOTP

...
sendOtp('958347XXXX', 'OTP is : ');  //Pass phone number and Custom messaseText as String

...

int enteredOtp;
TextField(
  onChanged: (val) {
    enteredOtp = val;    
  }
)

...

bool isCorrectOTP = resultChecker();
if(isCorrectOTP) {
    print('Success');
} else {
    print('Failure');
}
...

Contributors

  1. Fawaz Hussain
  2. Jerin Francis

:star: the repo to show support!

More Information

Pub package Flutter documentation.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。