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

パッケージ詳細v3.8.1

cloudflare_turnstile

セキュリティを強化し、ボットから保護するための無料のCAPTCHA代替策。

AndroidiOSWebmacOSWindows
30日間ダウンロード
6万
いいね数
50
Pub ポイント
160

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

flutter pub add cloudflare_turnstile

パッケージ概要

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

Cloudflare Turnstile を統合するための Flutter パッケージで、ボットからアプリケーションを保護するための無料の CAPTCHA の代替手段として設計されており、ユーザー体験をスムーズに保ちます。従来の CAPTCHA を、複雑な操作なしに人間のユーザーを検証できるシンプルでプライバシー重視のチャレンジに置き換えます。このパッケージは、Android、iOS、Web、macOS、Windows など複数のプラットフォームをサポートしており、ロバストなボット保護が必要なクロスプラットフォームアプリに最適です。Turnstile は高度なリスク分析を使用して、正当なユーザーの負担を最小限に抑えます。最小限の設定で簡単に導入でき、フォーム、ログイン画面、およびあらゆる高トラフィックのエントリポイント(悪用のリスクがあるもの)に適しています。

用途

  • ログインフォームの保護
  • フォーム送信のセキュリティ
  • ボットによる登録の防止
  • APIエンドポイントのセキュリティ向上
  • コメントセクションにおけるスパムの削減

主な機能

  • 無料で利用可能
  • ユーザーの摩擦が少ない
  • プライバシーを最優先とするデザイン
  • クロスプラットフォーム対応
  • リアルタイムリスク分析

適している対象

  • Webおよびモバイルアプリ
  • 高トラフィックサイト
  • ユーザー登録システム
  • APIエンドポイント
  • グローバルな視聴者をターゲットにしたアプリケーション

注意事項

  • インターネット接続が必要です
  • Cloudflareのインフラストラクチャに依存
  • カスタマイズオプションが限られている
  • バックエンド検証が必要になる場合があります
  • オフライン環境には適していません

元の README

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

Flutter Cloudflare Turnstile Pub

head

Cloudflare turnstile is a free CAPTCHAs Alternative, Turnstile delivers frustration-free, CAPTCHA-free web experiences to website visitors - with just a simple snippet of free code. Moreover, Turnstile stops abuse and confirms visitors are real without the data privacy concerns or awful user experience of CAPTCHAs.

[!WARNING]

This package is unofficial and not endorsed by Cloudflare. Use it at your own discretion.

Installation

flutter pub add cloudflare_turnstile

For Windows platform, please follow the inappwebview windows setup instructions.

Example

Here's a quick example that shows how to add Cloudflare Turnstile widget to your flutter app

import 'package:flutter/material.dart';
import 'package:cloudflare_turnstile/cloudflare_turnstile.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Turnstile widget configuration
    final TurnstileOptions options = const TurnstileOptions(
      size: TurnstileSize.normal,
      theme: TurnstileTheme.light,
      language: 'ar',
      retryAutomatically: false,
      refreshTimeout: TurnstileRefreshTimeout.manual,
    );

    return Scaffold(
      body: Center(
        child: CloudflareTurnstile(
          siteKey: '3x00000000000000000000FF', //Change with your site key
          baseUrl: 'http://localhost/',
          onTokenReceived: (token) {
            print(token);
          },
        ),
      ),
    );
  }
}

For Android and iOS platforms you need to provide the baseUrl parameter with the actual URL of your Turnstile Widget Domains list. baseUrl must be the same as the list of domains when creating a Widget.

Using Turnstile invisible mode

Here's how to use Cloudflare's invisible Turnstile, which automatically solves the challenge in the background

import 'package:cloudflare_turnstile/cloudflare_turnstile.dart';


class TurnstileService {
  /// Retrieves the CloudFlare Turnstile token using invisible mode.
  static Future<String?> get token async {
    // Initialize an instance of invisible Cloudflare Turnstile with your site key
    final turnstile = CloudflareTurnstile.invisible(
      siteKey: '1x00000000000000000000BB', // Replace with your actual site key
    );

    try {
      // Get the Turnstile token
      final token = await turnstile.getToken();
      return token; // Return the token upon success
    } on TurnstileException catch (e) {
      // Handle Turnstile failure
      print('Challenge failed: ${e.message}');
    } finally {
      // Ensure the Turnstile instance is properly disposed of
      turnstile.dispose();
    }

    // Return null if the token couldn't be generated
    return null;
  }
}

[!WARNING]

It's important to call dispose() on the CloudflareTurnstile instance when you no longer need it. This ensures that resources are properly cleaned up, preventing any potential memory issues.

Contribution

Your contributions are welcome and greatly valued! If you have ideas, suggestions, or improvements, feel free to open an issue or submit a pull request. Every bit of help is appreciated, and your input can make a big difference. Just ensure your contributions fit with the project's goals and guidelines.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

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

ランキング