flutter_safetynet_attestation 0.0.2

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

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.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.0.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_safetynet_attestation/flutter_safetynet_attestation.dart';
  
Version Uploaded Documentation 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]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

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
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8