skaletek_kyc 0.0.1-dev.2
skaletek_kyc: ^0.0.1-dev.2 copied to clipboard
A Flutter SDK for integrating Skaletek's eKYC verification services.
Skaletek KYC Flutter Plugin #
A comprehensive Flutter plugin for Know Your Customer (KYC) verification services, featuring document scanning, face liveness detection, and identity verification powered by AWS Amplify.
✨ Features #
- 🆔 Document Verification: Passport, National ID, Driver's License, and more
- 👤 Face Liveness Detection: Real-time biometric verification using AWS Amplify
- 📸 Camera Integration: Live document capture with auto-detection
- 📁 File Upload: Support for gallery/file-based document upload
- 🎨 Customizable UI: Branded verification experience
- 🔒 Secure: Enterprise-grade security with AWS infrastructure
- 📱 Cross-platform: iOS and Android support
🚀 Quick Start #
1. Installation #
Add the dependency to your pubspec.yaml:
dependencies:
skaletek_kyc: ^0.0.1
Run:
flutter pub get
2. Platform Setup #
📱 Android Setup #
Overview #
Android setup includes automated AWS Amplify configuration with some manual build configuration required.
Step 1: Update Project Build Configuration #
1.1. Update android/build.gradle (Project Level)
buildscript {
ext.kotlin_version = '2.0.0'
ext.compose_version = '1.6.7'
ext.compose_compiler_version = '1.5.14'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.0"
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
}
}
// Apply Compose plugin for face liveness detection
subprojects {
afterEvaluate {
if (project.name == "app" || project.name == "face_liveness_detector") {
apply plugin: "org.jetbrains.kotlin.plugin.compose"
}
}
}
1.2. Update android/app/build.gradle (App Level)
android {
compileSdk 35
ndkVersion "27.0.12077973"
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
coreLibraryDesugaringEnabled true
}
kotlinOptions {
jvmTarget = '11'
}
defaultConfig {
minSdk 24
// ... your other configurations
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
// Jetpack Compose (required for face liveness UI)
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.activity:activity-compose:1.8.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0"
// AWS Amplify Face Liveness SDK
implementation 'com.amplifyframework.ui:liveness:1.4.0'
implementation 'com.amplifyframework:core:2.27.0'
implementation 'com.amplifyframework:aws-auth-cognito:2.27.0'
}
// Automated configuration copying
tasks.register('copyAmplifyConfig') {
doLast {
def sourceFile = file('../../../assets/amplifyconfiguration.json')
def targetDir = file('src/main/res/raw')
if (sourceFile.exists()) {
targetDir.mkdirs()
sourceFile.copyTo(file("${targetDir.path}/amplifyconfiguration.json"), overwrite: true)
println '✅ AWS Amplify configuration copied'
} else {
println '⚠️ amplifyconfiguration.json not found'
}
}
}
tasks.named('preBuild') {
dependsOn 'copyAmplifyConfig'
}
Step 2: Add Permissions #
Add to android/app/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:label="your_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<!-- ... rest of your manifest -->
</application>
</manifest>
Step 3: Update MainActivity #
Ensure your MainActivity extends FlutterFragmentActivity:
// android/app/src/main/kotlin/com/yourpackage/yourapp/MainActivity.kt
package com.yourpackage.yourapp
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity : FlutterFragmentActivity()
🍎 iOS Setup #
Overview #
iOS setup includes automated configuration file copying with manual Swift Package Manager and Xcode configuration.
Step 1: iOS Platform Configuration #
First, ensure your ios/Podfile specifies the minimum iOS version:
platform :ios, '14.0'
Step 2: Automated iOS Setup (One-time Podfile Update) #
Add this automation block to your ios/Podfile in the post_install hook:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
# Skaletek KYC Auto Setup
setup_script_paths = [
'Pods/skaletek_kyc/skaletek_kyc_setup.rb', # For published plugin
File.expand_path('~/.pub-cache/hosted/pub.dev/skaletek_kyc-*/ios/skaletek_kyc_setup.rb') # Alternative pub cache path
]
setup_script_path = setup_script_paths.find { |path| File.exist?(path) }
if setup_script_path
load setup_script_path
SkaletekKYC.setup_ios_project
else
puts "⚠️ Skaletek KYC setup script not found. Please ensure the plugin is installed."
end
end
Step 3: Add Swift Package Dependencies (Manual) #
-
Open your iOS project in Xcode:
open ios/Runner.xcworkspace -
Add Package Dependencies:
- Go to File > Add Package Dependencies...
-
Add AWS Amplify Swift:
- URL:
https://github.com/aws-amplify/amplify-swift - Version:
2.46.1or later - Select:
Amplify,AWSCognitoAuthPlugin
- URL:
-
Add AWS Amplify UI Liveness:
- URL:
https://github.com/aws-amplify/amplify-ui-swift-liveness - Version:
1.3.5or later - Select:
FaceLiveness
- URL:
Step 3: Camera Permissions (Automated) #
Camera permissions are automatically added by the setup script. If you need to customize the message, edit this entry in ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app needs camera access for document scanning and face verification.</string>
Step 4: Run Pod Install #
cd ios && pod install
That's it! The setup runs automatically and configures:
- ✅ Updates AppDelegate.swift with Amplify initialization
- ✅ Adds camera permissions to Info.plist
- ✅ No additional commands needed
📖 API Reference #
KYCUserInfo #
final userInfo = KYCUserInfo(
firstName: "John",
lastName: "Doe",
documentType: DocumentType.passport.value,
issuingCountry: "USA",
);
KYCCustomization #
final customization = KYCCustomization(
docSrc: DocumentSource.camera.value,
partnerName: "Your Company",
logoUrl: "https://example.com/logo.png", // optional
primaryColor: Colors.blue, // optional
);
Document Types #
| Type | Description |
|---|---|
DocumentType.passport |
International passport |
DocumentType.nationalId |
National ID card |
DocumentType.driverLicense |
Driver's license |
DocumentType.residencePermit |
Residence permit |
DocumentType.healthCard |
Health/medical card |
Document Sources #
| Source | Description |
|---|---|
DocumentSource.camera |
Live camera capture with auto-detection |
DocumentSource.file |
File upload from device gallery |
Complete Example #
import 'package:flutter/material.dart';
import 'package:skaletek_kyc/skaletek_kyc.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Skaletek KYC Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
home: const DemoApp(),
);
}
}
class DemoApp extends StatefulWidget {
const DemoApp({super.key});
@override
State<DemoApp> createState() => _DemoAppState();
}
class _DemoAppState extends State<DemoApp> {
bool _isVerifying = false;
String _status = '';
bool _hasVerificationResult = false;
void _startVerification() async {
setState(() {
_isVerifying = true;
_status = 'Starting verification...';
_hasVerificationResult = false;
});
final userInfo = KYCUserInfo(
firstName: "Whyte",
lastName: "Peter",
documentType: DocumentType.passport.value,
issuingCountry: "USA",
);
final customization = KYCCustomization(
docSrc: DocumentSource.file.value,
logoUrl: null,
partnerName: "My Company",
primaryColor: null,
);
SkaletekKYC.instance.startVerification(
context: context,
token: "your-token-here",
userInfo: userInfo,
customization: customization,
onComplete: (result) {
setState(() {
_isVerifying = false;
_hasVerificationResult = true;
if (result['success'] == true) {
_status = 'Verification completed successfully!';
} else {
_status =
'Verification failed: {result['status'] ?? 'Unknown error'}';
}
});
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Skaletek KYC'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.verified_user, size: 80, color: Color(0xFF1261C1)),
const SizedBox(height: 24),
const Text(
'Skaletek KYC SDK Demo',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 16),
const Text(
'This demo shows how to integrate the Skaletek KYC Flutter SDK for identity verification.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.grey),
),
const SizedBox(height: 32),
if (_isVerifying)
const Column(
children: [
CircularProgressIndicator(),
SizedBox(height: 16),
Text('Verification in progress...'),
],
)
else
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: _startVerification,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF1261C1),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('Start Identity Verification'),
),
),
const SizedBox(height: 20),
if (_hasVerificationResult && _status.isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: _status.contains('success')
? Colors.green[50]
: Colors.red[50],
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: _status.contains('success')
? Colors.green
: Colors.red,
),
),
child: Text(
_status,
textAlign: TextAlign.center,
style: TextStyle(
color: _status.contains('success')
? Colors.green[700]
: Colors.red[700],
),
),
),
],
),
),
);
}
}
🔧 Troubleshooting #
Common Issues #
Android Build Errors:
- Ensure Kotlin version is 2.0.0+
- Verify Compose dependencies are correctly added
- Check that
minSdkis set to 24 or higher
iOS Build Errors:
- Confirm Swift Package Manager dependencies are added
- Verify configuration files are added to Xcode project
- Check iOS deployment target is 14.0+
Face Liveness Issues:
- Verify camera permissions are granted
- Check network connectivity for AWS services