FAQ

Telgat edited this page May 13, 2016 · 6 revisions

FAQ

How to check the presence of signing capability

The easiest way is to use the debug() method like below

<html>
<body>
     <script src="./hwcrypto.js"></script>

     <p id="p1"></p>
     <a href="http://www.id.ee/index.php?id=36636" id="a1"></a>

     <script>
          window.hwcrypto.debug().then(
                function(response) {
                     if (response.indexOf("No implementation") > -1) {
                          document.getElementById("p1").innerHTML = 
                          "Allkirjastamise plugin ei ole installitud või lubatud.<br> Täpsemad juhised leiate";
                          document.getElementById("a1").innerHTML = "http://www.id.ee/index.php?id=36636";
                     }
                },
                function (err) {
                     document.getElementById("p1").innerHTML = "Allkirjastamise plugin ei ole installitud või lubatud.<br> Täpsemad juhised leiate";
                     document.getElementById("a1").innerHTML = "http://www.id.ee/index.php?id=36636";
                }
          );
     </script>
</body>
</html>

See https://open-eid.github.io/hwcrypto.js/sign.html for a more comprehensive example of the library use.