mtrust_sec_kit 1.0.1 copy "mtrust_sec_kit: ^1.0.1" to clipboard
mtrust_sec_kit: ^1.0.1 copied to clipboard

A comprehensive SDK for interfacing with the MTrust SEC Readers. Including an example to get you started as fast as possible.

SEC-Kit #

Description

Documentation Status

pub package pub points style: very good analysis

Overview #

The SEC-Kit simplifies the integration of the M-Trust SEC-Reader into your Flutter application, providing secure and efficient communication capabilities.

Prerequisites #

  • Flutter SDK installed on your system.
  • Basic knowledge of Flutter development.
  • Access to the M-Trust SEC-Reader hardware, or use the mtrust_virtual_strategy for development without the hardware.

Installation #

Add the mtrust_sec_kit to your Flutter project via the pub add command

flutter pub add mtrust_sec_kit

or manually add it to your pubspec.yaml

dependencies:
  mtrust_sec_kit: ˆ1.0.0

SEC-Kit can work with different URP Connection Strategy. The default for SEC Readers is BLE. Add the ble connection strategy to your project by including it in your pubspec.yaml file.

dependencies:
  mtrust_sec_kit: ˆ1.0.0
  # Add the BLE connection strategy
  mtrust_urp_ble_strategy: ˆ8.0.1

Please follow the instructions for configuring BLE for your respective platform in the README of the urp_ble_strategy!

Usage #

Fonts #

SEC-Kit utilizes the Lato font and custom icons. To include these assets, update your pubspec.yaml:

fluter:
  fonts: 
    - family: Lato
      fonts:
        - asset: packages/liquid_flutter/fonts/Lato-Regular.ttf
          weight: 500
        - asset: packages/liquid_flutter/fonts/Lato-Bold.ttf
          weight: 800
    - family: LiquidIcons
      fonts:
        - asset: packages/liquid_flutter/fonts/LiquidIcons.ttf

Localization #

To support multiple languages, add the necessary localization delegates to your application. For comprehensive guidance on internationalization, consult the flutter documentation.

  return const MaterialApp(
    title: 'Your awesome application',
      localizationsDelegates: [
        ...LiquidLocalizations.delegate,
        ...UrpUiLocalizations.delegate,
        ...SecLocalizations.localizationsDelegates,
      ],
      
      home: MyHomePage(),
    );

Adding UI dependencies #

To utilize SEC-Kit's UI components, incorporate the following providers and portals:

  1. Theme Provider: Wrap your app with LdThemeProvider:

    LdThemeProvider(
        child: MaterialApp(
          home: MyHomePage(),
        ),
    )
    
  2. Portal: Enclose your Scaffold with LdPortal:

    LdPortal(
      child: Scaffold(
        ...
      ),
    )
    

Use the SEC Sheet #

To display the SEC Sheet, utilize the SecSheet widget. It requires a connection strategy, a payload, and callbacks for the verification process:

  SecSheet(
    strategy: _connectionStrategy,
    payload: // Payload,
    onVerificationDone: () {},
    onVerificationFailed: () {},
    builder: (context, openSheet) {
      // Call openSheet to open the SEC Sheet
    },
  ),

Configuration Options #

  • Connection Strategies: While BLE is the default, SEC-Kit supports various connection strategies. Ensure you include and configure the appropriate strategy package as needed.

Troubleshooting #

  • BLE Connectivity Issues: Verify that your device's Bluetooth is enabled and that the M-Trust SEC-Reader is powered on and in range.

  • Font Rendering Problems: Ensure that the font assets are correctly referenced in your pubspec.yaml and that the files exist in the specified paths.

Contributing #

We welcome contributions! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to our coding standards and includes appropriate tests.

License #

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

0
likes
140
points
57
downloads

Publisher

verified publishermtrust.io

Weekly Downloads

A comprehensive SDK for interfacing with the MTrust SEC Readers. Including an example to get you started as fast as possible.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_localizations, intl, liquid_flutter, mtrust_urp_core, mtrust_urp_types, mtrust_urp_ui

More

Packages that depend on mtrust_sec_kit