UNPKG

qz-tray

Version:

Connects a web client to the QZ Tray software. Enables printing and device communication from javascript.

798 lines (216 loc) 10.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Namespace: security</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Namespace: security</h1> <section> <header> <h2> <span class="ancestors"><a href="qz.html">qz</a>.</span>security</h2> </header> <article> <div class="container-overview"> <div class="description">Calls related to signing connection requests.</div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2742">line 2742</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".getSignatureAlgorithm"><span class="type-signature">(static) </span>getSignatureAlgorithm<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Get the signing algorithm QZ will be checking signatures against. </div> <dl class="details"> <dt class="tag-since">Since:</dt> <dd class="tag-since"><ul class="dummy"><li>2.1.0</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2811">line 2811</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The algorithm used in signing. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".setCertificatePromise"><span class="type-signature">(static) </span>setCertificatePromise<span class="signature">(promiseHandler, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Set promise resolver for calls to acquire the site's certificate. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>promiseHandler</code></td> <td class="type"> <span class="param-type">function</span> | <span class="param-type">AsyncFunction</span> | <span class="param-type">Promise.&lt;string></span> </td> <td class="attributes"> </td> <td class="description last">Either a function that will be used as a promise resolver (of format <code>Function({function} resolve, {function}reject)</code>), an async function, or a promise. Any of which should return the public certificate via their respective <code>resolve</code> call.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Configuration options for the certificate resolver <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>rejectOnFailure</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> [false] </td> <td class="description last">Overrides default behavior to call resolve with a blank certificate on failure.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2756">line 2756</a> </li></ul></dd> </dl> <h4 class="name" id=".setSignatureAlgorithm"><span class="type-signature">(static) </span>setSignatureAlgorithm<span class="signature">(algorithm)</span><span class="type-signature"></span></h4> <div class="description"> Set which signing algorithm QZ will check signatures against. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>algorithm</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The algorithm used in signing. Valid values: <code>[SHA1 | SHA256 | SHA512]</code></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-since">Since:</dt> <dd class="tag-since"><ul class="dummy"><li>2.1.0</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2790">line 2790</a> </li></ul></dd> </dl> <h4 class="name" id=".setSignaturePromise"><span class="type-signature">(static) </span>setSignaturePromise<span class="signature">(promiseFactory)</span><span class="type-signature"></span></h4> <div class="description"> Set promise factory for calls to sign API calls. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>promiseFactory</code></td> <td class="type"> <span class="param-type">function</span> | <span class="param-type">AsyncFunction</span> </td> <td class="description last">Either a function that accepts a string parameter of the data to be signed and returns a function to be used as a promise resolver (of format <code>Function({function} resolve, {function}reject)</code>), or an async function that can take a string parameter of the data to be signed. Either of which should return the signed contents of the passed string parameter via their respective <code>resolve</code> call.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="qz-tray.js.html">qz-tray.js</a>, <a href="qz-tray.js.html#line2778">line 2778</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>qz.security.setSignaturePromise(function(dataToSign) { return function(resolve, reject) { $.ajax("/signing-url?data=" + dataToSign).then(resolve, reject); } })</code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="qz.html">qz</a></li><li><a href="qz.api.html">api</a></li><li><a href="qz.configs.html">configs</a></li><li><a href="qz.file.html">file</a></li><li><a href="qz.hid.html">hid</a></li><li><a href="qz.networking.html">networking</a></li><li><a href="qz.printers.html">printers</a></li><li><a href="qz.security.html">security</a></li><li><a href="qz.serial.html">serial</a></li><li><a href="qz.socket.html">socket</a></li><li><a href="qz.usb.html">usb</a></li><li><a href="qz.websocket.html">websocket</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Thu Apr 02 2026 13:01:02 GMT-0400 (Eastern Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>