flutter_play_integrity_wrapper 0.0.1 copy "flutter_play_integrity_wrapper: ^0.0.1" to clipboard
flutter_play_integrity_wrapper: ^0.0.1 copied to clipboard

PlatformAndroid

A Flutter wrapper for the Google Play Integrity API on Android.

flutter_play_integrity_wrapper #

A Flutter plugin wrapper for the Google Play Integrity API on Android.

Features #

  • Request an integrity token from the Google Play Integrity API.
  • Supports providing a custom nonce or generating a secure random one.

Getting Started #

  1. Add flutter_play_integrity_wrapper to your pubspec.yaml dependencies.
  2. Enable the Play Integrity API in your Google Cloud Console project.
  3. Link your Google Cloud project to your app in the Google Play Console.

Usage #

Import the package:

import 'package:flutter_play_integrity_wrapper/flutter_play_integrity_wrapper.dart';

Create an instance of FlutterPlayIntegrityWrapper and call requestIntegrityToken:

final _playIntegrityWrapper = FlutterPlayIntegrityWrapper();

try {
  // Use your actual Cloud Project Number
  final String? token = await _playIntegrityWrapper.requestIntegrityToken(
    cloudProjectNumber: '1234567890', 
    // optional: nonce: 'your-custom-nonce' 
  );
  
  if (token != null) {
    print('Integrity Token: $token');
    // Send this token to your backend for verification
  }
} catch (e) {
  print('Error requesting integrity token: $e');
}

Security Note #

The nonce parameter is optional. If not provided, a secure random nonce is generated automatically. However, for better security against replay attacks, it is highly recommended to generate the nonce on your backend server and pass it to the app.

Android Configuration #

Ensure your minSdkVersion in android/app/build.gradle is at least 19 (Google Play Services requirement).

This plugin requires Google Play Services to be available on the device.

0
likes
160
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter wrapper for the Google Play Integrity API on Android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_play_integrity_wrapper

Packages that implement flutter_play_integrity_wrapper