ezto_pass 9.2.0 copy "ezto_pass: ^9.2.0" to clipboard
ezto_pass: ^9.2.0 copied to clipboard

Ezto Pass

ezto_pass #

A Flutter FFI plugin for NFC functionality with Rust native code integration. This plugin provides high-performance NFC operations for iOS and Android platforms using Rust bindings.

Features #

  • NFC Authentication: EV2 authentication protocol implementation
  • Master Key Management: Change and manage NFC tag master keys
  • SDM (Secure Dynamic Message): Create and manage secure dynamic messages
  • NDEF Management: Read and write NDEF records
  • Rust Integration: High-performance cryptographic operations using Rust

Getting Started #

Prerequisites #

  • Flutter SDK
  • Rust toolchain (for building)
  • iOS 12.0+ (for iOS support)
  • Android API level 21+ (for Android support)

Installation #

Add ezto_pass to your pubspec.yaml:

dependencies:
  ezto_pass:
    path: ../ezto_pass

Then run:

flutter pub get

Usage #

Import the plugin #

import 'package:ezto_pass/ezto_pass.dart';

Initialize NFC Pass #

NfcPass nfcPass = NfcPass.init();

Change Master Key #

final defaultKey = Uint8List.fromList(List<int>.filled(16, 0));
final newKey = Uint8List.fromList(List<int>.filled(16, 1));

final result = await nfcPass.changeMasterKey(
  currentKey: defaultKey,
  newKey: newKey,
  context: context,
);

Create SDM (Secure Dynamic Message) #

final result = await nfcPass.createSdm(
  privateKey: defaultKey,
  context: context,
);

Get NDEF #

final result = await nfcPass.getSdmNdef(context: context);

Project Structure #

ezto_pass/
├── lib/                  # Dart FFI bindings and plugin interface
├── ios/                  # iOS native code and configuration
│   ├── Classes/          # Swift/Objective-C source files
│   ├── Frameworks/       # EztoVerifyCore.xcframework (Rust binary)
│   └── ezto_pass.podspec
├── android/              # Android native code and configuration
├── src/                  # Rust source code
└── pubspec.yaml

Architecture #

iOS #

  • EztoVerifyCore.xcframework: Pre-built Rust library containing NFC operations
  • Architecture: arm64 only
  • Deployment Target: iOS 12.0+

Android #

  • EztoVerifyCore.so: Pre-built Rust shared library
  • Architectures: arm64-v8a, armeabi-v7a, x86_64
  • API Level: 21+

Building #

Building for iOS #

cd ios
pod install
cd ..
flutter build ios

Building for Android #

flutter build apk

Testing #

Run integration tests:

flutter test integration_test/nfc_dart_match_rust_test.dart

API Reference #

NfcPass Class #

changeMasterKey()

Changes the master key of an NFC tag.

Future<ChangeMasterKeyResult> changeMasterKey({
  required Uint8List currentKey,
  required Uint8List newKey,
  required BuildContext context,
})

createSdm()

Creates a Secure Dynamic Message on the NFC tag.

Future<CreateSdmResult> createSdm({
  required Uint8List privateKey,
  required BuildContext context,
})

getSdmNdef()

Retrieves the NDEF message containing the SDM URL.

Future<String> getSdmNdef({required BuildContext context})

Troubleshooting #

iOS Symbol Not Found Errors #

If you encounter "symbol not found" or "dlsym" errors:

  1. Ensure the XCFramework contains the required architectures:
lipo -info Frameworks/EztoVerifyCore.xcframework/ios-arm64/libEztoVerifyCore.a
  1. Clean and reinstall pods:
cd ios
pod deintegrate
pod cache clean --all
pod install

Build Issues #

  • Ensure Rust toolchain is installed: rustup update
  • Verify deployment target matches in Xcode and podspec
  • Check that framework search paths are correctly configured

Contributing #

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License #

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

Support #

For issues, questions, or suggestions, please create an issue on the GitHub repository.