cktap_transport_nfc_manager 0.1.2 copy "cktap_transport_nfc_manager: ^0.1.2" to clipboard
cktap_transport_nfc_manager: ^0.1.2 copied to clipboard

An implementation of the cktap_transport package using the nfc_manager plugin

NFC Manager Transport for Coinkite Tap Protocol #

An implementation of cktap_transport using the nfc_manager plugin. This is currently designed for NFC Manager v3, when v4 is released this plugin will be reworked to support the new API.

Platform Support #

Please use the release/v3 branch or some devices may fail when performing the CKTapCard.wait command. The custom branch also allows you to update the NFC prompt text on iOS so you can provide a better UX.

  • ✅ Android
  • ✅ iOS

Getting Started #

dependencies:
  # This transport plugin is designed to be used specifically for the cktap_protocol plugin
  cktap_protocol: ^0.0.1
  
  # The recommended way to use this plugin, we use a fork of nfc_manager which supports setting the timeout value for 
  # IsoDep tags. Unfortunately the required function is missing in the official nfc_manager codebase
  cktap_transport_nfc_manager:
    git:
      url: https://github.com/PeteClubSeven/cktap-transport-nfc-manager.git
      ref: release/v3
  nfc_manager:
    git:
      url: https://github.com/PeteClubSeven/flutter-nfc-manager.git
      ref: release/v3

  # Uses an unmodified version of nfc_manager
  cktap_transport_nfc_manager: ^0.1.0
  nfc_manager: ^3.3.0

Usage #

import 'package:cktap_protocol/cktap_protocol.dart';
import 'package:cktap_protocol/cktapcard.dart';
import 'package:cktap_protocol/satscard.dart';
import 'package:cktap_protocol/tapsigner.dart';
import 'package:cktap_transport_nfc_manager/cktap_transport_nfc_manager.dart';
import 'package:nfc_manager/nfc_manager.dart';

void exampleFunction() {
  NfcManager.instance.startSession(
      onDiscovered: (NfcTag tag) async {
        // Create the transport from the given tag
        final transport = NfcManagerTransport(tag);
        // Attempt to read the card, exceptions are thrown when errors occur
        CKTapCard card = await CKTapProtocol.readCard(transport);
        
        // Cast to the correct card type and reuse the transport during the same NFC session
        if (card.isTapsigner) {
          Tapsigner tapsigner = card.toTapsigner();
          var result = await tapsigner.wait(transport);
        } else {
          Satscard satscard = card.toSatscard();
          var slots = await satscard.listSlots(transport);
        }
    },
  );
}

Additional Information #

See the cktap_protocol plugin for more information of how this transport plugin can be used.

0
likes
150
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

An implementation of the cktap_transport package using the nfc_manager plugin

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

app.mash.com

License

MIT (license)

Dependencies

cktap_transport, flutter, nfc_manager

More

Packages that depend on cktap_transport_nfc_manager