esp_provisioning 1.0.0+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

esp_provisioning #

Made with love in Vietnam Pub Version

Espressif BLE Provisioning library for ESP32

A library for Flutter was developed to provide network credentials and/or custom data to an ESP32 over Bluetooth BLE. The company makes chips ESP32, Espresif, they have 2 libraries for each Platform iOS and Android

However, the mobile application development on Flutter is easier now, and many will need this.

Getting Started #

 EspProv prov = EspProv(
        transport: TransportBLE(ble_peripheral), security: Security1(pop: pop));
 var success = await prov.establishSession();
 await prov.sendWifiConfig(ssid: event.ssid, password: event.password);
 await prov.applyWifiConfig();

Protocol Communication Overview #

Protocol Communication (protocomm) component manages secure sessions and provides framework for multiple transports. The application can also use protocomm layer directly to have application specific extensions for the provisioning (or non-provisioning) use cases.

Following features are available for provisioning :

  • Communication security at application level

    • protocomm_security1 (curve25519 key exchange + AES-CTR encryption)
  • Proof-of-possession (support with protocomm_security1 only)

Protocomm internally uses protobuf (protocol buffers) for secure session establishment. Though users can implement their own security (even without using protobuf). One can even use protocomm without any security layer.

Protocomm provides framework for various transports - WiFi (SoftAP+HTTPD), BLE, console - in which case the handler invocation is automatically taken care of on the device side (see Transport Examples below for code snippets).

Note that the client still needs to establish session (only for protocomm_security1) by performing the two way handshake. See Unified Provisioning for more details about the secure handshake logic.

License #

Apache License Version 2.0

1.0.0+1 #

  • Support BLE Provisioning Security1

1.0.0+2 #

  • Using github image URL & add homepage

example/lib/main.dart

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

typedef ItemTapCallback = void Function(Map<String, dynamic> item);

void main() {
  runApp(MaterialApp(home: HomeScreen()));
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.redAccent,
          title: const Text('ESP Provisioning'),
        ),
        body: Center(
          child: MaterialButton(
            color: Colors.redAccent,
            elevation: 5,
            padding: EdgeInsets.all(15.0),
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(5))),
            onPressed: () {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (BuildContext context) => BleScreen()));
            },
            child: Text(
              'Start Provisioning',
              style: Theme.of(context)
                  .textTheme
                  .headline6
                  .copyWith(color: Colors.white),
            ),
          ),
        ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  esp_provisioning: ^1.0.0+5

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:esp_provisioning/esp_provisioning.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:esp_provisioning/esp_provisioning.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:esp_provisioning/esp_provisioning.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:esp_provisioning/esp_provisioning.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:esp_provisioning/esp_provisioning.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • esp_provisioning that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.58 points)

69 out of 70 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/esp_provisioning.dart.

Run flutter format to format lib/esp_provisioning.dart.

Format lib/src/crypt.dart.

Run flutter format to format lib/src/crypt.dart.

Format lib/src/esp_prov.dart.

Run flutter format to format lib/src/esp_prov.dart.

Fix additional 28 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/proto/dart/constants.pb.dart (Run flutter format to format lib/src/proto/dart/constants.pb.dart.)
  • lib/src/proto/dart/constants.pbenum.dart (Run flutter format to format lib/src/proto/dart/constants.pbenum.dart.)
  • lib/src/proto/dart/constants.pbjson.dart (Run flutter format to format lib/src/proto/dart/constants.pbjson.dart.)
  • lib/src/proto/dart/constants.pbserver.dart (Run flutter format to format lib/src/proto/dart/constants.pbserver.dart.)
  • lib/src/proto/dart/sec0.pb.dart (Run flutter format to format lib/src/proto/dart/sec0.pb.dart.)
  • lib/src/proto/dart/sec0.pbenum.dart (Run flutter format to format lib/src/proto/dart/sec0.pbenum.dart.)
  • lib/src/proto/dart/sec0.pbjson.dart (Run flutter format to format lib/src/proto/dart/sec0.pbjson.dart.)
  • lib/src/proto/dart/sec0.pbserver.dart (Run flutter format to format lib/src/proto/dart/sec0.pbserver.dart.)
  • lib/src/proto/dart/sec1.pb.dart (Run flutter format to format lib/src/proto/dart/sec1.pb.dart.)
  • lib/src/proto/dart/sec1.pbenum.dart (Run flutter format to format lib/src/proto/dart/sec1.pbenum.dart.)
  • lib/src/proto/dart/sec1.pbjson.dart (Run flutter format to format lib/src/proto/dart/sec1.pbjson.dart.)
  • lib/src/proto/dart/sec1.pbserver.dart (Run flutter format to format lib/src/proto/dart/sec1.pbserver.dart.)
  • lib/src/proto/dart/session.pb.dart (Run flutter format to format lib/src/proto/dart/session.pb.dart.)
  • lib/src/proto/dart/session.pbenum.dart (Run flutter format to format lib/src/proto/dart/session.pbenum.dart.)
  • lib/src/proto/dart/session.pbjson.dart (Run flutter format to format lib/src/proto/dart/session.pbjson.dart.)
  • lib/src/proto/dart/session.pbserver.dart (Run flutter format to format lib/src/proto/dart/session.pbserver.dart.)
  • lib/src/proto/dart/wifi_config.pb.dart (Run flutter format to format lib/src/proto/dart/wifi_config.pb.dart.)
  • lib/src/proto/dart/wifi_config.pbenum.dart (Run flutter format to format lib/src/proto/dart/wifi_config.pbenum.dart.)
  • lib/src/proto/dart/wifi_config.pbjson.dart (Run flutter format to format lib/src/proto/dart/wifi_config.pbjson.dart.)
  • lib/src/proto/dart/wifi_config.pbserver.dart (Run flutter format to format lib/src/proto/dart/wifi_config.pbserver.dart.)
  • lib/src/proto/dart/wifi_constants.pb.dart (Run flutter format to format lib/src/proto/dart/wifi_constants.pb.dart.)
  • lib/src/proto/dart/wifi_constants.pbenum.dart (Run flutter format to format lib/src/proto/dart/wifi_constants.pbenum.dart.)
  • lib/src/proto/dart/wifi_constants.pbjson.dart (Run flutter format to format lib/src/proto/dart/wifi_constants.pbjson.dart.)
  • lib/src/proto/dart/wifi_constants.pbserver.dart (Run flutter format to format lib/src/proto/dart/wifi_constants.pbserver.dart.)
  • lib/src/proto/dart/wifi_scan.pb.dart (Run flutter format to format lib/src/proto/dart/wifi_scan.pb.dart.)
  • lib/src/proto/dart/wifi_scan.pbenum.dart (Run flutter format to format lib/src/proto/dart/wifi_scan.pbenum.dart.)
  • lib/src/proto/dart/wifi_scan.pbjson.dart (Run flutter format to format lib/src/proto/dart/wifi_scan.pbjson.dart.)
  • lib/src/proto/dart/wifi_scan.pbserver.dart (Run flutter format to format lib/src/proto/dart/wifi_scan.pbserver.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

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

The package description is too short. (-20 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.1.0 <3.0.0
cryptography ^0.2.6 0.2.6 1.4.1
flutter 0.0.0
flutter_ble_lib ^2.2.5 2.2.5
protobuf ^1.0.1 1.0.1
Transitive dependencies
async 2.4.2
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
fixnum 0.10.11
js 0.6.2
meta 1.1.8 1.2.2
pointycastle 1.0.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test