secure_flutter 0.0.2
secure_flutter: ^0.0.2 copied to clipboard
A secure license validation plugin for Flutter using API key and bundle ID verification.
secure_flutter #
A Flutter plugin for secure API key validation using bundle ID and server-side verification.
Features #
-
Secure API key validation with backend verification
-
Uses package info to send app bundle ID and version info
-
Easy integration with
.env
for storing API keys securely -
Throws exceptions on invalid keys or network failures
Getting Started #
1. Register your app and get API key #
Go to https://jasperazerbaijan.com/developers
Register your app by providing your app's bundle ID (Android package name or iOS bundle identifier).
After registration, you will receive an API key.
2. Add .env
file #
Create a .env
file at the root of your Flutter project and add your API key like this:
API_KEY=your_api_key_here
Make sure your .env file is added to your app assets by updating your #
pubspec.yaml:
flutter:
assets:
- .env
Important: Add .env to your .gitignore file to keep your API key secure and avoid uploading it to version control.
Usage Example #
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:secure_flutter/secure_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await dotenv.load(fileName: ".env");
final apiKey = dotenv.env['API_KEY'] ?? '';
await SecureFlutter.init(apiKey);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SecureFlutter Example',
home: Scaffold(
appBar: AppBar(title: const Text('SecureFlutter')),
body: const Center(
child: Text('SecureFlutter initialized successfully!'),
),
),
);
}
}
Error Handling #
If the API key is invalid or verification fails, an exception is thrown.
Network or server errors also throw exceptions.
You should handle exceptions when calling SecureFlutter.init().
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Contact #
For more information, visit https://jasperazerbaijan.com/developers