Added hash example
authorDavid Dahl <ddahl@mozilla.com>
Fri, 25 Jan 2013 10:31:14 -0600
changeset 2 b63f163cc987
parent 1 f58f6b8aa0a0
child 3 be02e044185a
Added hash example
highlevel-api-source.html
--- a/highlevel-api-source.html	Fri Jan 25 10:22:21 2013 -0600
+++ b/highlevel-api-source.html	Fri Jan 25 10:31:14 2013 -0600
@@ -130,7 +130,7 @@
       <p>The Privacy considerations of [[!WEBCRYPTO]] apply to this specification.</p>
       <section>
           <p>
-            TBD
+            TODO
           </p>
       </section>
     </section>
@@ -228,7 +228,7 @@
           <dt>[TreatNonCallableAsNull] attribute Function? onVerifyError</dt>
           <dd>onVerifyError event handler</dd>
 
-          <dt>void hash(in DOMString aData)</dt>
+          <dt>void hash(in DOMString aJWAlgID, in DOMString aData)</dt>
           <dd>Create a cryptographic hash</dd>
           <dt>[TreatNonCallableAsNull] attribute Function? onHashComplete</dt>
           <dd>onHashComplete event handler</dd>
@@ -358,7 +358,23 @@
 };
 
 cryptoAPI.verify(RECEIVED_JWS, SIGNER_JWK);        
-</pre>        
+</pre>
+
+<h3>Hash creation</h3>
+<pre class="example sh_html sh_sourceCode">
+var stringToHash = "Please hash me";
+
+cryptoAPI.onHashComplete = function (aHashString) {
+  // save this hash, compare to another, etc
+};
+
+cryptoAPI.onHashError = function (aError) {
+  // console.log(aError), etc.
+};
+
+cryptoAPI.hash("SHA512", stringToHash);
+</pre>
+        
       </section> 
     </section>
     <!--