Beispiel #1
0
 private void HandleScanResult(Result result)
 {
     if (result != null)
     {
         scannedAccount = TOTPUtilities.UriToAccount(result.Text);
     }
 }
        public void TestVersio()
        {
            string  input   = "otpauth://totp/12345?secret=R6H7USVWDYQLNQWD&issuer=Versio";
            Account account = TOTPUtilities.UriToAccount(input);

            Validate("12345", "R6H7USVWDYQLNQWD", "Versio", account);
        }
        public void TestDiskStation()
        {
            string  input   = "otpauth://totp/Administrator@DiskStation?secret=A7LAL5KRDBZWRRHT";
            Account account = TOTPUtilities.UriToAccount(input);

            Validate("Administrator", "A7LAL5KRDBZWRRHT", "DiskStation", account);
        }
        public void TestDropbox()
        {
            string  input   = "otpauth://totp/Dropbox:[email protected]?secret=EK6VFBVGIGJ4FX6KYONLBQSJH4&issuer=Dropbox";
            Account account = TOTPUtilities.UriToAccount(input);

            Validate("*****@*****.**", "EK6VFBVGIGJ4FX6KYONLBQSJH4", "Dropbox", account);
        }
        public void TestGoogle()
        {
            string  input   = "otpauth://totp/Google%3Auser%40gmail.com?secret=uhs6vc47fttwgglvsyevlbjoczoyyeem&issuer=Google";
            Account account = TOTPUtilities.UriToAccount(input);

            Validate("*****@*****.**", "uhs6vc47fttwgglvsyevlbjoczoyyeem", "Google", account);
        }
        public void TestMicrosoft()
        {
            string  input   = "otpauth://totp/Microsoft:[email protected]?secret=2FA662OCY6FLRKY5&issuer=Microsoft";
            Account account = TOTPUtilities.UriToAccount(input);

            Validate("*****@*****.**", "2FA662OCY6FLRKY5", "Microsoft", account);
        }
Beispiel #7
0
        private async void Grid_DragEnter(object sender, DragEventArgs e)
        {
            e.AcceptedOperation = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Copy;

            try
            {
                var files = await e.DataView.GetStorageItemsAsync();

                if (files.Count == 1)
                {
                    StorageFile file = files.FirstOrDefault() as StorageFile;

                    if (file != null)
                    {
                        IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

                        Result result = await Decode(stream);

                        if (result != null)
                        {
                            dragAndDropAccount = TOTPUtilities.UriToAccount(result.Text);

                            if (dragAndDropAccount != null)
                            {
                                BitmapImage bi = new BitmapImage();
                                bi.SetSource(stream);

                                QRCodeImage.Source = bi;

                                VisualStateManager.GoToState(this, ShowDrop.Name, true);
                            }
                        }
                    }
                }
            }
            catch
            {
                // Could not read dragged items. Since this is definitely not a QR code, ignore it.
            }
        }