패키지, 저장소 및 앱 카테고리 검색

패키지 상세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은 고급 위험 분석을 사용하여 정상 사용자의 부담을 최소화합니다. 설정이 거의 필요 없고 쉽게 구현 가능하며, 폼, 로그인 화면 및 악용 위험이 있는 고-traffice 진입 지점에 적합합니다.

사용 사례

  • 로그인 폼 보호
  • 폼 제출 보안
  • 봇 기반 가입 방지
  • API 엔드포인트 보안 강화
  • 댓글 섹션에서 스팸 줄이기

주요 기능

  • 무료로 사용 가능
  • 낮은 사용자 부담
  • 개인정보 중심 디자인
  • 크로스 플랫폼 지원
  • 실시간 위험 분석

적합한 대상

  • 웹 및 모바일 앱
  • 고-traffice 웹사이트
  • 사용자 등록 시스템
  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위