Giter VIP home page Giter VIP logo

esp_provisioning's Introduction

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

esp_provisioning's People

Contributors

krystofm avatar mircopz avatar thuanpham98 avatar tuanpmt avatar zadenrb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp_provisioning's Issues

Please remove the hardcoded MTU

In TransportBle I recommend removing the hardcoded MTU await peripheral.connect(requestMtu: 512); or allowing the user to pass in a value. This higher value breaks certain BLE stacks on some phones like Samsung.

My current workaround is to connect to the device myself to short circuit TransportBle.connect() which is called by EspProv.establishSesision()

Thanks

esp_provisioning sample app does not find my esp32 hardware which runs protocomm_security0 profile

Hi,

I am using this sample app to valid POC which can configure SSID, Password to ESP32 FW - over BLE.

But as soon as the scan starts this does keep scanning without any results at all for infinitely.

Note: Our HW device is build with protocomm_security0 - profile. (Not protocomm_security1 profile)
Can this be a problem ? If so - Is there any guidance on what I need to change in library in order to support for security0 profile.

esp_provisioning-master.zip

ESP32 firmware

My friend, could you quote the esp-idf example that you used to make your tests. No working in the first hand here? With the IDF version as well.

Thanks in advance.

Null safety?

Do you plan to migrate the package to null safety?

Is library maintained?

Is this library maintained or it is not, and can it be used, I do not see any alternatives for the provisioning over ble in flutter, I found one library but it only provides the most basic functionality, this library has all functions but seems unsafe to use and not being maintained

Upgrade dependencies

Hi,
to upgrade this dependencies:

protobuf: ^1.1.1
cryptography: ^1.4.1

To

protobuf: ^2.0.0
cryptography: ^2.0.1

A refactoring of Security1 is needed due to new API of "cryptography" library.
Can you help me in the migration please?

Thanks.
Sandro

To further users...

The app is still on development stage... It only find devices if your bluetooth is turned off, so the app can turn the bluetooth on itself. And worse than that, it wil only start to scan wifi if the wifi is off too, but in this case, is not a solution, the behaviour is still random to me. It also could not find my wifi network, maybe cause of the max number of the names in the network list.
Despite all of that, its a great idea, and the esp32 does receive the wifi network name. Just need more work.

Wifi screen not coming up

Hi,

This is a very great library and its very handy too.

I see an issue. I found ESP32 device and discovered, but When i click discovered device following error is thrown. Could you help please?

I/flutter (31505): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (31505): EstablishSession error NoSuchMethodError: The method 'isConnected' was called on null.
I/flutter (31505): Receiver: null
I/flutter (31505): Tried calling: isConnected()
I/flutter (31505): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (31505): │ #0 WifiBloc._mapLoadToState
package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:32
I/flutter (31505): │
I/flutter (31505): │ #1 WifiBloc.mapEventToState
package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:21
I/flutter (31505): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (31505): │ ⛔ Error conencting to device Exception: Error establishSession
I/flutter (31505): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (31505): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (31505): │ #0 WifiBloc._mapLoadToState
package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:42
I/flutter (31505): │
I/flutter (31505): │ #1 WifiBloc.mapEventToState
package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:21
I/flutter (31505): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (31505): │ ⛔ Error scan WiFi network NoSuchMethodError: The method 'startScanWiFi' was called on null.
I/flutter (31505): │ ⛔ Receiver: null
I/flutter (31505): │ ⛔ Tried calling: startScanWiFi()
I/flutter (31505): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

establishSession method call below Error code: 302,

scanBle Ble Method code change uuids: []


  Stream<ScanResult> scanBle() {
    stopScanBle();
    return _bleManager.startPeripheralScan(
        uuids: [], //[TransportBLE.PROV_BLE_SERVICE],
        scanMode: ScanMode.balanced,
        allowDuplicates: true);
  }

Error code: 302, ATT error code: null, iOS error code: null, Android error code: null, reason: null, internal message: null, device ID: null, service UUID: 021a9004-0382-4aea-bff4-6b3f1c5adfb4, characteristic UUID: null, descriptor UUID: null

Screenshot 2022-01-21 at 12 58 44 PM

Not received wifi list

Error

Screenshot 2022-01-21 at 1 02 07 PM

Cryptography hang GUI loader

Cryptography library not use Isolates so there are 2 points in the code of security1.dart :

line88 :await _generateKey();
line105 :final sharedKey = await x25519.sharedSecretKey;

that cause the hang of GUI loader for some seconds.

I try to add Isolate, but I'm unable to do it works.
Can you help me pelase?

Unable to build the app

Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 18,
or use tools:overrideLibrary="com.polidea.flutter_ble_lib" to force usage (may lead to runtime failures)

Incompatibility with mqtt_client

I am hitting the following incompatibility when trying to use esp_provisioning and mqtt_client in the same app.

Because mqtt_client >=9.1.0 depends on crypto ^3.0.1 and cryptography >=0.2.6 <2.0.0-nullsafety.0 depends on crypto ^2.0.0, mqtt_client >=9.1.0 is incompatible with cryptography >=0.2.6 <2.0.0-nullsafety.0.
Because esp_provisioning <=1.0.0+5 depends on cryptography ^0.2.6 and esp_provisioning >=1.0.0+6 depends on cryptography ^1.4.1, every version of esp_provisioning requires cryptography ^0.2.6 or ^1.4.1.
Thus, mqtt_client >=9.1.0 is incompatible with esp_provisioning.
So, because flutter_mqtt depends on both mqtt_client ^9.6.1 and esp_provisioning any, version solving failed.

Any suggestions on how to fix or workaround this?

unable to find wifi

with this example, it is searching wifi forever and never be done. Does anyone have solution ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.