[rs-commit] r11 - in /rst-interop/trunk: ./ src/site/resources/js/signtext-form.js src/site/resources/js/signtext.js src/site/xhtml5/crypto.signText/index.xhtml5

rs-commit at redwax.eu rs-commit at redwax.eu
Sun Sep 19 12:25:48 CEST 2021


Author: minfrin at redwax.eu
Date: Sun Sep 19 12:25:47 2021
New Revision: 11

Log:
Use the signtext.js library.

Added:
    rst-interop/trunk/src/site/resources/js/signtext-form.js
      - copied, changed from r10, rst-interop/trunk/src/site/resources/js/signtext.js
Removed:
    rst-interop/trunk/src/site/resources/js/signtext.js
Modified:
    rst-interop/trunk/   (props changed)
    rst-interop/trunk/src/site/xhtml5/crypto.signText/index.xhtml5

Propchange: rst-interop/trunk/
------------------------------------------------------------------------------
--- svn:externals	(added)
+++ svn:externals	Sun Sep 19 12:25:47 2021
@@ -0,0 +1,2 @@
+src/site/resources/crypto.signText https://source.redwax.eu/svn/redwax/rst/redwax-signtext/trunk/src/common
+

Copied: rst-interop/trunk/src/site/resources/js/signtext-form.js (from r10, rst-interop/trunk/src/site/resources/js/signtext.js)
==============================================================================
--- rst-interop/trunk/src/site/resources/js/signtext.js	(original)
+++ rst-interop/trunk/src/site/resources/js/signtext-form.js	Sun Sep 19 12:25:47 2021
@@ -1,4 +1,16 @@
+
+
+
 function signRequest(form) {
+  if (crypto.signText) {
+    crypto.signText(form['tobesigned'].value).then(response => { form['signed'].value = response });
+  }
+  else {
+    alert('An implementation of crypto.signText() is not installed in this browser.');
+  }
+}
+
+function signLegacyRequest(form) {
   if (crypto.signText) {
     form['signed'].value = crypto.signText(form['tobesigned'].value, 'ask');
     return true;
@@ -8,3 +20,4 @@
   }
 }
 
+

Removed: rst-interop/trunk/src/site/resources/js/signtext.js
==============================================================================
--- rst-interop/trunk/src/site/resources/js/signtext.js	(original)
+++ rst-interop/trunk/src/site/resources/js/signtext.js	(removed)
@@ -1,10 +0,0 @@
-function signRequest(form) {
-  if (crypto.signText) {
-    form['signed'].value = crypto.signText(form['tobesigned'].value, 'ask');
-    return true;
-  }
-  else {
-    alert('An implementation of crypto.signText() is not installed in this browser.');
-  }
-}
-

Modified: rst-interop/trunk/src/site/xhtml5/crypto.signText/index.xhtml5
==============================================================================
--- rst-interop/trunk/src/site/xhtml5/crypto.signText/index.xhtml5	(original)
+++ rst-interop/trunk/src/site/xhtml5/crypto.signText/index.xhtml5	Sun Sep 19 12:25:47 2021
@@ -6,6 +6,7 @@
     <meta name="description" content="Interoperate with traditional crypto.signText()."/>
     <link rel="canonical" href="https://interop.redwax.eu/rst/crypto.signText/"/>
     <script language="javascript" src="signtext.js"></script>
+    <script language="javascript" src="signtext-form.js"></script>
   </head>
   <body>
     <section class="spotlight style2 orient-right content-align-left image-position-left">
@@ -23,10 +24,14 @@
     <div class="none">
       <section class="wrapper style1 align-center" id="ceertenroll">
         <div class="inner">
-          <h2>Traditional Javascript crypto.signText()</h2>
+          <h2>Javascript crypto.signText()</h2>
           <p>
             The following example form shows how to trigger <code>crypto.signText()</code>
             to sign the given text.
+          </p>
+          <p>
+            <code>crypto.signText()</code> returns a <code>Promise</code> which, when resolved,
+            contains the signed text.
           </p>
           <div class="index align-left">
             <section>



More information about the rs-commit mailing list