flutter_cie_id 0.1.0
flutter_cie_id: ^0.1.0 copied to clipboard
Flutter plugin for app-to-app authentication with the Italian CIE ID (Carta d'Identità Elettronica) app on Android and iOS.
flutter_cie_id #
Flutter plugin for app-to-app authentication with the Italian CIE ID (Carta d'Identità Elettronica / electronic ID card) app on Android and iOS.
This plugin does not talk to the physical ID card or perform NFC reads
itself. It launches the official CieID app (deep link on iOS, explicit
Intent on Android), lets the user complete authentication there, and
receives the resulting callback URL back in your app.
Requirements #
- You must be a federated Service Provider registered with IPZS/AgID to use "Entra con CIE" authentication in production. This plugin only provides the client-side integration; it does not grant you SP status. See the official CIE ID SDK documentation.
- The CieID app must be installed on the test/end-user device. NFC authentication cannot be tested on a simulator or emulator — a physical device is required.
- Android: minSdk 24. iOS: 13.0+.
Setup #
Android #
No manifest changes are required. The plugin declares the <queries> entry
needed for checkCieId() to see the CieID app on Android 11+ (API 30+), and
launches CieID via an explicit Intent (unaffected by package visibility).
iOS #
Add the following to your app's ios/Runner/Info.plist:
<key>SP_URL_SCHEME</key>
<string>your-app-scheme</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>your.bundle.id</string>
<key>CFBundleURLSchemes</key>
<array>
<string>your-app-scheme</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>CIEID</string>
</array>
SP_URL_SCHEME/CFBundleURLSchemes: a URL scheme unique to your app. CieID uses it to hand control back to your app once authentication completes.LSApplicationQueriesSchemes: required forcheckCieId()to be able to detect whether the CieID app is installed.
See example/ios/Runner/Info.plist for a complete working example.
Usage #
import 'package:flutter_cie_id/flutter_cie_id.dart';
// Check whether the CieID app is installed.
final isInstalled = await FlutterCieId.checkCieId();
if (isInstalled == true) {
// spUrl is the identity provider's authentication URL for your Service
// Provider (obtained from your own backend/CAS flow).
final continuationUrl = await FlutterCieId.getAuth(spUrl);
// continuationUrl is the URL to load next (e.g. in a WebView) to
// complete the authentication session server-side.
}
getAuth throws a PlatformException if the user cancels, CieID is not
installed, the request times out, or CieID reports an error — handle it with
a try/catch.
Limitations #
- No NFC/PIN interaction happens inside this plugin — that's entirely handled by the CieID app itself.
- Requires a physical device for any real end-to-end test.
- The shape of the URL/parameters CieID expects and returns is dictated by IPZS and may change between CieID app versions; this plugin does not pin or validate a specific protocol version.
License #
BSD-3-Clause, see LICENSE.
Portions of the iOS implementation (QueryString.swift,
StringURLValidator.swift) are adapted from the official
CieID iOS SDK (Copyright © 2021
IPZS, BSD-3-Clause).