yubioath-flutter/lib/desktop/qr_scanner.dart
2022-02-10 15:24:28 +01:00

21 lines
523 B
Dart
Executable File

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:yubico_authenticator/app/state.dart';
import 'package:yubico_authenticator/desktop/state.dart';
import 'rpc.dart';
class RpcQrScanner implements QrScanner {
final RpcSession _rpc;
RpcQrScanner(this._rpc);
@override
Future<String> scanQr() async {
final result = await _rpc.command('qr', []);
return result['result'];
}
}
final desktopQrScannerProvider = Provider<QrScanner?>(
(ref) => RpcQrScanner(ref.watch(rpcProvider)),
);