flutter_safetynet_attestation 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 77

Flutter SafetyNet Attestation plugin for Android #

What is SafetyNet? #

The SafetyNet Attestation API helps you assess the security and compatibility of the Android environments in which your apps run. You can use this API to analyze devices that have installed your app.'

Please check the documentation here.

Getting Started #

iOS #

The plugin won't work iOS, because SafetyNet is only available for Android devices.

Android #

  1. Open the Google APIs console and enable Android Device Verification API
  2. Create your API key
  3. In your Android project, please add the SafetyNet API key in your AndroidManifest.xml:
<meta-data android:name="safetynet_api_key"
            android:value="yourapikey"/>

Dart #

The SafetyNet API is requiring a working version of the Google Play Services. A method is available to check if they are available on the device:

FlutterSafetynetAttestation.googlePlayServicesAvailability();

Then you have to pass a nonce (in a String or a byte array) to the following method:

FlutterSafetynetAttestation.safetyNetAttestationJwt('<your-nonce>');

It will then return a JWT string. Google recommends to check this JWT on your server. Please read the official documentation for more details.

If you want to get directly the payload from the JWT string, you can call instead:

FlutterSafetynetAttestation.safetyNetAttestationPayload('<your-nonce>');

You will then receive a JWSPayload object with this kind of content:

{
  "nonce": "R2Rra24fVm5xa2Mg",
  "timestampMs": 9860437986543,
  "apkPackageName": "com.package.name.of.requesting.app",
  "apkCertificateDigestSha256": ["base64 encoded, SHA-256 hash of the
                                  certificate used to sign requesting app"],
  "apkDigestSha256": ["base64 encoded, SHA-256 hash of
                      the APK installed on a user's device"],
  "ctsProfileMatch": true,
  "basicIntegrity": true,
}

[0.1.3] - 26th January 2018

  • [Breaking change] Migration to AndroidX

[0.0.3] - 21th January 2018

  • The JWSPayload can now be exported in a JSON format

[0.0.2] - 26th October 2018

  • SafetyNet dependency updated to 16.0.0
  • Check that the nonce has at least a length of 16
  • The INTERNET permission is now requested by the plugin
  • Instead of the error code, the message now contains a brief explanation (from CommonStatusCodes)

[0.0.1] - 6th July 2018

  • Initial release.

example/README.md

flutter_safetynet_attestation_example #

Demonstrates how to use the flutter_safetynet_attestation plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_safetynet_attestation: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_safetynet_attestation/flutter_safetynet_attestation.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jan 26, 2019 Go to the documentation of flutter_safetynet_attestation 0.1.0 Download flutter_safetynet_attestation 0.1.0 archive
0.0.3 Jan 21, 2019 Go to the documentation of flutter_safetynet_attestation 0.0.3 Download flutter_safetynet_attestation 0.0.3 archive
0.0.2 Oct 26, 2018 Go to the documentation of flutter_safetynet_attestation 0.0.2 Download flutter_safetynet_attestation 0.0.2 archive
0.0.1 Jul 6, 2018 Go to the documentation of flutter_safetynet_attestation 0.0.1 Download flutter_safetynet_attestation 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

We analyzed this package on Jun 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

The package description is too short. (-8 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8