sotaid_pluging 0.0.1+1 copy "sotaid_pluging: ^0.0.1+1" to clipboard
sotaid_pluging: ^0.0.1+1 copied to clipboard

A Flutter plugin for integrating SotaBoost's identity verification service into Flutter applications

SotaID Plugin #

A Flutter plugin for integrating SotaBoost's identity verification service into Flutter applications.

Features #

  • Session Management: Create and manage verification sessions
  • Document Verification: Verify document front (recto) and back (verso)
  • Face Verification: Record and verify face videos
  • Country Support: Get list of supported countries and document types
  • Status Tracking: Check verification session status
  • Complete UI Flow: Ready-to-use verification flow widget

API Endpoints #

The plugin integrates with the following SotaBoost API endpoints:

  • POST https://api.sotaboost.com/verification_sessions - Create verification session
  • POST https://app.sotaboost.com/verify/front/{sessionId} - Verify document front
  • POST https://app.sotaboost.com/verify/back/{sessionId} - Verify document back
  • POST https://app.sotaboost.com/verify/face/{sessionId} - Verify face
  • GET https://api.sotaboost.com/countries - Get available countries
  • GET https://api.sotaboost.com/verification_sessions/{sessionId} - Get verification status

Installation #

Add the plugin to your pubspec.yaml:

dependencies:
  sotaid_pluging: ^0.0.1

Environment Configuration #

The plugin defaults to sandbox mode for testing and development. The sandbox mode is used internally by the plugin for configuration and does not affect the API requests sent to SotaBoost.

Authentication #

The plugin supports bearer token authentication. You must provide a valid bearer token during initialization to authenticate with the SotaBoost API.

// Initialize with bearer token (defaults to sandbox mode)
plugin.initialize(bearerToken: 'your_bearer_token_here');

// Production mode with bearer token
plugin.initialize(sandboxMode: false, bearerToken: 'your_production_token');

// Initialize without bearer token (for testing only)
plugin.initialize();

Usage #

Basic Usage #

import 'package:sotaid_pluging/sotaid_pluging.dart';

final plugin = SotaidPluging();

// Initialize plugin with bearer token (defaults to sandbox mode)
plugin.initialize(bearerToken: 'your_bearer_token_here');

// Get available countries
final countries = await plugin.getCountries();

// Create a verification session
final session = await plugin.createVerificationSession({
  'user_id': 'user123',
  'created_at': DateTime.now().toIso8601String(),
});

// Verify document front
final frontResponse = await plugin.verifyDocumentFront(
  sessionId,
  {
    'document_type': 'passport',
    'country_code': 'US',
    'photo': base64EncodedImage,
  },
);

// Verify document back
final backResponse = await plugin.verifyDocumentBack(
  sessionId,
  {
    'photo': base64EncodedImage,
  },
);

// Verify face
final faceResponse = await plugin.verifyFace(
  sessionId,
  {
    'video': base64EncodedVideo,
  },
);

// Get verification status
final status = await plugin.getVerificationStatus(sessionId);

Complete Verification Flow #

Use the provided verification flow widget for a complete UI experience:

import 'package:sotaid_pluging/verification_flow.dart';

SotaIdVerificationFlow(
  bearerToken: 'your_bearer_token_here',
  onVerificationComplete: (response) {
    print('Verification completed: ${response.status}');
  },
  onError: (error) {
    print('Verification error: $error');
  },
)

Data Models #

Country #

class Country {
  final int id;
  final String lang;
  final String code;
  final String alpha3Code;
  final String name;
  final List<String> allowedDocs;
  final String flag;
  final Map<String, dynamic> avatar;
  final List<DocumentType> documents;
}

VerificationSession #

class VerificationSession {
  final String id;
  final String status;
  final DateTime createdAt;
  final DateTime? updatedAt;
}

VerificationResponse #

class VerificationResponse {
  final String status;
  final Map<String, dynamic>? errors;
  final String? message;
}

Error Handling #

The plugin throws exceptions for various error conditions:

  • Network errors
  • Invalid API responses
  • Missing required parameters
  • Authentication failures

Always wrap API calls in try-catch blocks:

try {
  final countries = await plugin.getCountries();
  // Handle success
} catch (e) {
  // Handle error
  print('Error: $e');
}

Permissions #

The plugin requires the following permissions:

  • Camera access for document and face capture
  • Storage access for saving temporary files
  • Internet access for API communication

Example #

See the example/ directory for a complete working example that demonstrates:

  • Loading countries from the API
  • Creating verification sessions
  • Using the complete verification flow UI
  • Error handling and user feedback

Contributing #

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
0
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for integrating SotaBoost's identity verification service into Flutter applications

License

unknown (license)

Dependencies

dropdown_button2, flutter, http, image_picker, plugin_platform_interface

More

Packages that depend on sotaid_pluging

Packages that implement sotaid_pluging