yubidart 1.0.4 copy "yubidart: ^1.0.4" to clipboard
yubidart: ^1.0.4 copied to clipboard

outdated

Yubico Services for Dart and Flutter. OTP Validation with Yubikey

example/example.dart

import 'package:nfc_manager/nfc_manager.dart';
import 'package:yubidart/src/model/verification_response.dart';
import 'package:yubidart/yubidart.dart' show YubicoService;

Future<void> main(List<String> args) async {
  /// Verify if NFC is avalaible
  final bool isAvailable = await NfcManager.instance.isAvailable();
  if (isAvailable) {
    NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
      final String otp = YubicoService().getOTPFromYubiKeyNFC(tag);

      /// Verify OTP with YubiCloud
      final VerificationResponse verificationResponse = await YubicoService()
          .verifyYubiCloudOTP(otp, 'mG5be6ZJU1qBGz24yPh/ESM3UdU=', '1');
      NfcManager.instance.stopSession();
      if (verificationResponse.status == 'OK') {
        print('OTP valid');
      } else {
        print('Error : ${verificationResponse.status}');
      }
    });
  }
}
1
likes
40
pub points
65%
popularity

Publisher

verified publisherarchethic.net

Yubico Services for Dart and Flutter. OTP Validation with Yubikey

Repository (GitHub)
View/report issues

License

AGPL-3.0 (license)

Dependencies

crypto, http, nfc_manager, nonce

More

Packages that depend on yubidart