Exemplo n.º 1
0
        public void Constructor()
        {
            var url = new SqrlUrl(ValidResponseUri);

            Assert.AreEqual(5, url.Depth);
            Assert.AreEqual("domain.com/path", url.Domain);
            Assert.AreEqual("127.0.0.1", url.IpAddress.ToString());
            Assert.AreEqual("client-nonce", url.Nonce);
            Assert.AreEqual("1", url.Options["opt1"]);
            Assert.AreEqual("2", url.Options["opt2"]);
            Assert.AreEqual("public-keyid", url.PublicKey);
            Assert.AreEqual("sqrl", url.Scheme);
            Assert.AreEqual("crypt-signat", url.Signature);
            Assert.AreEqual("sqrl-version", url.Version);
            Assert.AreEqual("session-tag", url.WebNonce);
        }
Exemplo n.º 2
0
 private void ScanPreviewBuffer()
 {
     try {
         _photoCamera.GetPreviewBufferY(_luminance.PreviewBufferY);
         var binarizer = new HybridBinarizer(_luminance);
         var binBitmap = new BinaryBitmap(binarizer);
         var result    = _reader.decode(binBitmap);
         if (result != null)
         {
             Dispatcher.BeginInvoke(() => DisplayResult(result.Text));
             var client = new WebClient();
             var sqrl   = new SqrlUrl(result.Text);
             var nonce  = SqrlUtils.CreateClientNonce();
             client.DownloadStringAsync(new Uri(sqrl.GetClientResponse(nonce)));
         }
     } catch {
     }
 }
Exemplo n.º 3
0
        public void GetClientResponse()
        {
            var url = new SqrlUrl(ValidChallengeUri);

            Assert.AreEqual("", url.GetClientResponse(SqrlUtils.CreateClientNonce()));
        }