Truvideo Core SDK

This Plugin demonstrates the integration of the TruvideoCoreSdk for authentication and platform-specific functionality. It includes features such as authentication, authentication status checking, and clearing authentication.

Supported Platforms

  • Android
  • iOS

Features

  • Authenticates using API Key and Secret Key
  • Checks authentication status
  • Clears authentication

Requirements

  • API Key & Secret Key: Required for authentication
  • TruvideoCoreSdk Plugin: Must be properly installed and configured in your Flutter project

Setup

  1. Add TruvideoCoreSdk Plugin to your project.
  2. Install dependencies using:
    flutter pub get
    
  3. Replace the placeholders with actual API keys:
    final String apiKey = "YOUR_API_KEY"; // Replace with your API Key
    final String secretKey = "YOUR_SECRET_KEY"; // Replace with your Secret Key
    
  4. Run the app:
    flutter run
    

Authentication Process

  1. Generates a payload for authentication
  2. Uses SHA256 HMAC to sign the payload
  3. Authenticates using TruvideoCoreSdk.authenticate()
  4. Initializes authentication with TruvideoCoreSdk.initAuthentication()
  5. Updates authentication status

Code Overview

The main authentication logic is implemented in _MyAppState:

Future<void> authenticate() async {
  try {
    String payload = await TruvideoCoreSdk.generatePayload();
    String signature = toSha256String(secret: secretKey, payload: payload) ?? '';
    await TruvideoCoreSdk.authenticate(
      apiKey: apiKey,
      signature: signature,
      payload: payload,
      externalId: "",
    );
    await TruvideoCoreSdk.initAuthentication();
  } catch (e) {
  } 
}

License

MIT

Support

If you have any questions or suggestions regarding the SDK, please contact us at support@truvideo.com.