sima 1.0.1+2
sima: ^1.0.1+2 copied to clipboard
Flutter plugin for SIMA digital signature integration.
[assets/logo/sima_logo.png]
SIMA Flutter Plugin #
A Flutter plugin that enables secure digital signature and authentication flows using the SIMA mobile application.
This package provides a clean and reusable interface for launching the SIMA app from Flutter, sending a cryptographic challenge, and receiving the signed response back into your application.
🔐 All SIMA-specific native logic is encapsulated inside the plugin.
🧼 The Flutter app layer stays clean and platform-agnostic.
🔗 Package Links #
- 📦 pub.dev: https://pub.dev/packages/sima
- 📄 License: MIT
- 🛠 Platforms: Android, iOS
✨ Features #
- Secure challenge–response signing flow
- Native SIMA app integration
- iOS and Android support
- Simple and minimal Flutter API
- Asset-based logo handling (path only)
- No Base64 handling required in Flutter
- Plugin-managed native callbacks
- Production-ready architecture
📦 Installation #
Add the package from pub.dev:
dependencies:
sima: ^1.0.1
Then run:
flutter pub get
🎨 Asset Setup (Logo) #
The SIMA plugin requires a logo image to be displayed inside the SIMA application.
1️⃣ Add logo to your Flutter assets #
flutter:
assets:
- assets/logo.png
Supported formats:
- PNG
- JPG
⚠️ SVG is not supported for SIMA logos.
2️⃣ Pass only the asset path #
You do not need to convert the image to Base64.
logoPath: 'assets/logo.png'
The plugin will:
- load the asset natively
- convert it internally (Base64 on iOS, byte[] on Android)
🚀 Usage #
Basic Example #
import 'package:sima/sima.dart';
final response = await Sima.start(
clientId: '<YOUR_CLIENT_ID>',
clientMasterKey: '<YOUR_MASTER_KEY>',
returnScheme: 'your-app-scheme',
serviceName: 'Your App Name',
logoPath: 'assets/logo.png',
);
🔁 Handling the Result #
if (response == null) {
// Operation was cancelled or SIMA did not respond
} else if (!response.isSuccess) {
// SIMA returned an error
print(response.message);
} else {
// Success
print(response.signature);
print(response.certificate);
}
📄 Response Model #
class SimaResponse {
final String status;
final String? signature;
final String? certificate;
final String? challenge;
final String? requestId;
final String? message;
bool get isSuccess => status == 'success';
}
🧩 Platform Configuration #
🍎 iOS Setup #
1️⃣ URL Scheme
Add a custom URL scheme to your Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>your-app-scheme</string>
</array>
</dict>
</array>
This scheme must match the returnScheme passed to Sima.start.
2️⃣ AppDelegate Callback Forwarding
The AppDelegate must forward the SIMA callback to the plugin:
override func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true),
let items = components.queryItems else {
return false
}
var data: [String: String] = [:]
for item in items {
data[item.name] = item.value ?? ""
}
NotificationCenter.default.post(
name: NSNotification.Name("SIMA_CALLBACK"),
object: nil,
userInfo: data
)
return true
}
⚠️ Do not add any SIMA business logic here.
🤖 Android Setup #
1️⃣ Package Visibility (Android 11+)
Add the SIMA package to your AndroidManifest.xml:
<queries>
<package android:name="az.dpc.sima" />
</queries>
2️⃣ MainActivity
No SIMA-related code is required.
class MainActivity : FlutterFragmentActivity()
The plugin handles all Android intents internally.
❗ Error Handling #
| Case | Description |
|---|---|
null response |
Operation cancelled or no callback |
SIMA_NOT_FOUND |
SIMA app not installed |
LOGO_ERROR |
Logo asset not found |
BAD_URL |
iOS deep-link failed |
🔐 Security Notes #
- Never hardcode secrets in UI code
- Store
clientMasterKeysecurely - Always validate signatures server-side
- The plugin does not store sensitive data
🧠 Architecture Overview #
Flutter App
|
| MethodChannel
v
SIMA Plugin
|
|-- iOS: URL Scheme + NotificationCenter
|-- Android: Intent (implicit + explicit fallback)
|
SIMA Mobile App
📄 License #
MIT License
⚠️ Disclaimer #
This plugin is not officially affiliated with SIMA.
Use it in accordance with SIMA platform policies and security requirements.