public async Task <(Send send, EncByteArray encryptedFileData)> EncryptAsync(SendView model, byte[] fileData, string password, SymmetricCryptoKey key = null) { if (model.Key == null) { model.Key = _cryptoFunctionService.RandomBytes(16); model.CryptoKey = await _cryptoService.MakeSendKeyAsync(model.Key); } var send = new Send { Id = model.Id, Type = model.Type, Disabled = model.Disabled, DeletionDate = model.DeletionDate, ExpirationDate = model.ExpirationDate, MaxAccessCount = model.MaxAccessCount, Key = await _cryptoService.EncryptAsync(model.Key, key), Name = await _cryptoService.EncryptAsync(model.Name, model.CryptoKey), Notes = await _cryptoService.EncryptAsync(model.Notes, model.CryptoKey), HideEmail = model.HideEmail }; EncByteArray encryptedFileData = null; if (password != null) { var passwordHash = await _cryptoFunctionService.Pbkdf2Async(password, model.Key, CryptoHashAlgorithm.Sha256, 100000); send.Password = Convert.ToBase64String(passwordHash); } switch (send.Type) { case SendType.Text: send.Text = new SendText { Text = await _cryptoService.EncryptAsync(model.Text.Text, model.CryptoKey), Hidden = model.Text.Hidden }; break; case SendType.File: send.File = new SendFile(); if (fileData != null) { send.File.FileName = await _cryptoService.EncryptAsync(model.File.FileName, model.CryptoKey); encryptedFileData = await _cryptoService.EncryptToBytesAsync(fileData, model.CryptoKey); } break; default: break; } return(send, encryptedFileData); }
public static async Task ShareSendUrl(SendView send) { await Share.RequestAsync(new ShareTextRequest { Uri = new Uri(GetSendUrl(send)).ToString(), Title = AppResources.Send + " " + send.Name, Subject = send.Name }); }
private static string GetSendUrl(SendView send) { var environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); var webVaultUrl = environmentService.GetWebVaultUrl(); if (webVaultUrl != null) { return(webVaultUrl + "/#/send/" + send.AccessId + "/" + send.UrlB64Key); } return("https://send.bitwarden.com/#" + send.AccessId + "/" + send.UrlB64Key); }
private void OpenView() { this.ClearProps(); _sview = new SendView(); _wallet = Global.ActiveWallet; Balance = _wallet.AvailableBalance; TempBalance = _wallet.AvailableBalance; TempBalanceCurr = Math.Round(BalanceCurr,2); _sview.ShowDialog(); }
public static async Task CopySendUrlAsync(SendView send) { if (await IsSendDisabledByPolicyAsync()) { return; } var platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); await platformUtilsService.CopyToClipboardAsync(GetSendUrl(send)); platformUtilsService.ShowToast("info", null, string.Format(AppResources.ValueHasBeenCopied, AppResources.SendLink)); }
public static async Task CopySendUrlAsync(SendView send) { if (await IsSendDisabledByPolicyAsync()) { return; } var platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); var clipboardService = ServiceContainer.Resolve <IClipboardService>("clipboardService"); await clipboardService.CopyTextAsync(GetSendUrl(send)); platformUtilsService.ShowToastForCopiedValue(AppResources.SendLink); }
public static async Task ShareSendUrlAsync(SendView send) { if (await IsSendDisabledByPolicyAsync()) { return; } await Share.RequestAsync(new ShareTextRequest { Uri = new Uri(GetSendUrl(send)).ToString(), Title = AppResources.Send + " " + send.Name, Subject = send.Name }); }
KrateApplication() { Application.Init(); this.mainWindow = generateMainWindow(Application.Top); this.navigationMenu = new MenuBar(new MenuBarItem[] { new MenuBarItem("_File", new MenuItem [] { new MenuItem("_Quit", "", () => { Application.Top.Running = false; }), }), new MenuBarItem("Views", new MenuItem [] { new MenuItem("Dashboard", "", () => { var subView = this.mainWindow.Subviews[0]; subView.RemoveAll(); var dashboardView = DashboardView.generateWindow(this.mainWindow); this.mainWindow.Add(dashboardView); dashboardView.FocusFirst(); dashboardView.LayoutSubviews(); }), new MenuItem("Miner", "", () => { var subView = this.mainWindow.Subviews[0]; subView.RemoveAll(); var minerView = MinerView.generateWindow(this.mainWindow); this.mainWindow.Add(minerView); minerView.FocusFirst(); minerView.LayoutSubviews(); }), new MenuItem("Send Krates", "", () => { var subView = this.mainWindow.Subviews[0]; subView.RemoveAll(); var costView = SendView.generateWindow(this.mainWindow); this.mainWindow.Add(costView); costView.FocusFirst(); costView.LayoutSubviews(); }), new MenuItem("All Transactions", "", () => { var subView = this.mainWindow.Subviews[0]; subView.RemoveAll(); var transactionsView = TransactionsView.generateWindow(this.mainWindow); this.mainWindow.Add(transactionsView); transactionsView.FocusFirst(); transactionsView.LayoutSubviews(); }) }) }); }
public static async Task <string> SendListOptions(ContentPage page, SendView send) { var platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); var vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); var options = new List <string> { AppResources.Edit }; options.Add(AppResources.CopyLink); options.Add(AppResources.ShareLink); if (send.HasPassword) { options.Add(AppResources.RemovePassword); } var selection = await page.DisplayActionSheet(send.Name, AppResources.Cancel, AppResources.Delete, options.ToArray()); if (await vaultTimeoutService.IsLockedAsync()) { platformUtilsService.ShowToast("info", null, AppResources.VaultIsLocked); } else if (selection == AppResources.Edit) { await page.Navigation.PushModalAsync(new NavigationPage(new SendAddEditPage(send.Id))); } else if (selection == AppResources.CopyLink) { await platformUtilsService.CopyToClipboardAsync(GetSendUrl(send)); platformUtilsService.ShowToast("info", null, string.Format(AppResources.ValueHasBeenCopied, AppResources.ShareLink)); } else if (selection == AppResources.ShareLink) { await ShareSendUrl(send); } else if (selection == AppResources.RemovePassword) { await RemoveSendPasswordAsync(send.Id); } else if (selection == AppResources.Delete) { await DeleteSendAsync(send.Id); } return(selection); }
private void SendCommand_Execute(object o) { SendView sendView = new SendView() { Owner = mainView }; SendViewModel sendViewModel = new SendViewModel(sendView); sendView.DataContext = sendViewModel; if (sendView.ShowDialog() == true) { Thread createFSThread = new Thread(() => { xmlfs = new XMLFileSystem(); server.Action = Resource.CreateFileSystem; foreach (FSItem fsItem in sendViewModel.Items) { if (fsItem.Type == FSItemType.Folder) { xmlfs.AddFolder(fsItem.Path); } else { xmlfs.AddFile(fsItem.Path); } } xmlfs.Save("fs.xml", true); App.Current.Dispatcher.Invoke(new Action(() => { server.Send(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(sendViewModel.Address), int.Parse(sendViewModel.Port)), xmlfs); })); }); createFSThread.Start(); } }
public SendViewCellViewModel(SendView sendView, bool showOptions) { Send = sendView; ShowOptions = showOptions; }
public static string GetSendUrl(SendView send) { var environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); return(environmentService.BaseUrl + "/#/send/" + send.AccessId + "/" + send.UrlB64Key); }
private static string GetSendUrl(SendView send) { var environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); return(environmentService.GetWebSendUrl() + send.AccessId + "/" + send.UrlB64Key); }