Exemplo n.º 1
0
 public BackUpViewModel(Config config, UiConfig uiConfig, IHsmStorage hsm, SensitiveStorage storage, ChaincaseWalletManager walletManager)
 {
     _config        = config;
     _uiConfig      = uiConfig;
     _hsm           = hsm;
     _storage       = storage;
     _walletManager = walletManager;
 }
Exemplo n.º 2
0
        public LoadWalletViewModel()
            : base(Locator.Current.GetService <IViewStackService>())
        {
            Global = Locator.Current.GetService <Global>();
            Hsm    = Locator.Current.GetService <IHsmStorage>();

            var canLoadWallet = this.WhenAnyValue(x => x.SeedWords, x => x.ACCOUNT_KEY_PATH, x => x.MIN_GAP_LIMIT,
                                                  (seedWords, keyPath, minGapLimit) =>
            {
                return(!string.IsNullOrWhiteSpace(seedWords) &&
                       !string.IsNullOrWhiteSpace(keyPath) &&
                       minGapLimit > KeyManager.AbsoluteMinGapLimit &&
                       minGapLimit < 1_000_000);
            });
        public NewPasswordViewModel()
            : base(Locator.Current.GetService <IViewStackService>())
        {
            Global = Locator.Current.GetService <Global>();
            Hsm    = Locator.Current.GetService <IHsmStorage>();

            SubmitCommand = ReactiveCommand.CreateFromObservable(() =>
            {
                PasswordHelper.Guard(Password);                 // Here we are not letting anything that will be autocorrected later. We need to generate the wallet exactly with the entered password bacause of compatibility.

                string walletFilePath = Path.Combine(Global.WalletManager.WalletDirectories.WalletsDir, $"{Global.Network}.json");
                KeyManager.CreateNew(out Mnemonic seedWords, Password, walletFilePath);

                Hsm.SetAsync($"{Global.Network}-seedWords", seedWords.ToString());                 // PROMPT
                Global.UiConfig.HasSeed = true;
                Global.UiConfig.ToFile();
                ViewStackService.PushPage(new MainViewModel()).Subscribe();
                return(Observable.Return(Unit.Default));
            });
        }
 public NewPasswordViewModel(Global global, IHsmStorage hsmStorage)
 {
     Global = global;
     Hsm    = hsmStorage;
 }
 public LoadWalletViewModel(Global global, IHsmStorage hsmStorage)
 {
     Global = global;
     Hsm    = hsmStorage;
 }
Exemplo n.º 6
0
 public SensitiveStorage(IHsmStorage hsm, Config config, UiConfig uiConfig)
 {
     _hsm      = hsm;
     _network  = config.Network;
     _uiConfig = uiConfig;
 }
Exemplo n.º 7
0
 public BackUpViewModel(Global global, IHsmStorage hsm)
 {
     Global = global;
     HSM    = hsm;
 }