Skip to content
Snippets Groups Projects
Select Git revision
  • 644785707b3cecd63b7bae097918c79b01ea43c5
  • master default protected
  • tmp
  • refactoWidgetInsteadMethods
  • implementLightnode
  • subscribesSplit
  • hugo_RML16
  • refactorOnboardingSlideshow
  • duniterV1Latest
  • scanNetwork
  • dubp_rs
  • v0.0.12+34
  • v0.0.12+33
  • v0.0.11+32
  • v0.0.11+31
  • v0.0.11+30
  • v0.0.11+28
  • v0.0.10+27
  • v0.0.10+26
  • v0.0.10+25
  • v0.0.9+24
  • v0.0.9+23
  • v0.0.9+20
  • v0.0.9+19
  • v0.0.9+18
  • v0.0.9+17
  • v0.0.9+16
  • v0.0.9+15
  • v0.0.9+14
  • v0.0.9+13
  • v0.0.9+12
31 results

walletOptions.dart

Blame
  • Forked from clients / Ğecko
    940 commits behind the upstream repository.
    walletOptions.dart 11.21 KiB
    import 'dart:io';
    import 'dart:typed_data';
    import 'package:crypto/crypto.dart';
    import 'package:dubp/dubp.dart';
    import 'package:fast_base58/fast_base58.dart';
    import 'package:flutter/foundation.dart';
    import 'package:flutter/material.dart';
    import 'dart:async';
    import 'package:gecko/globals.dart';
    import 'package:image_picker/image_picker.dart';
    import 'package:truncate/truncate.dart';
    import 'package:qrscan/qrscan.dart' as scanner;
    
    class WalletOptionsProvider with ChangeNotifier {
      TextEditingController pubkey = TextEditingController();
      TextEditingController _newWalletName = TextEditingController();
      bool isWalletUnlock = false;
      bool ischangedPin = false;
      TextEditingController newPin = new TextEditingController();
      bool isEditing = false;
      bool isBalanceBlur = true;
      FocusNode walletNameFocus = FocusNode();
      TextEditingController nameController = TextEditingController();
      String walletID;
      bool isDefaultWallet;
    
      Future<NewWallet> get badWallet => null;
    
      Future _getPubkeyFromDewif(
          String _dewif, _pin, int _pinLenght, int derivation) async {
        String _pubkey;
        RegExp regExp = new RegExp(
          r'^[A-Z0-9]+$',
          caseSensitive: false,
          multiLine: false,
        );
    
        if (regExp.hasMatch(_pin) == true && _pin.length == _pinLenght) {
          print("Le format du code PIN est correct.");
        } else {
          print('Format de code PIN invalide');
          return 'false';
        }
        if (derivation != -1) {
          try {
            List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys(
                dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]);
            _pubkey = _pubkeysTmp[0];
            this.pubkey.text = _pubkey;
            notifyListeners();
    
            return _pubkey;
          } catch (e) {
            print('Bad PIN code !');
            print(e);
            notifyListeners();
    
            return 'false';
          }
        } else {
          try {
            _pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin);
            this.pubkey.text = _pubkey;
            notifyListeners();
            return _pubkey;
          } catch (e) {
            print('Bad PIN code !');
            print(e);
            notifyListeners();