UNPKG

@dedis/kyber

Version:

A typescript implementation of Kyber interfaces

325 lines (324 loc) 16.1 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>@dedis/kyber</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base="."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="index.html" class="title">@dedis/kyber</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="globals.html">Globals</a> </li> </ul> <h1> @dedis/kyber</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <div class="tsd-panel tsd-typography"> <a href="#kyberjs" id="kyberjs" style="color: inherit; text-decoration: none;"> <h1>KyberJS</h1> </a> <p>Javascript implementation of <a href="https://github.com/dedis/kyber/blob/master/group.go">Kyber interfaces</a></p> <ol> <li><strong>This is developmental, and not ready for protecting production data.</strong></li> <li><strong>This is not a constant time implementation, and likely has timing side channels that can be attacked.</strong></li> </ol> <a href="#usage" id="usage" style="color: inherit; text-decoration: none;"> <h2>Usage</h2> </a> <p>In the browser:</p> <p>The bundle is compiled using the command:</p> <pre><code>npm <span class="hljs-keyword">run</span><span class="bash"> bundle</span></code></pre><p>Check index.html for a browser-based usage</p> <p>In NodeJS:</p> <pre><code class="language-js"><span class="hljs-keyword">import</span> kyber <span class="hljs-keyword">from</span> <span class="hljs-string">"@dedis/kyber"</span>; <span class="hljs-keyword">import</span> { newCurve } <span class="hljs-keyword">from</span> <span class="hljs-string">"@dedis/kyber/curve"</span>; ...</code></pre> <a href="#dev-setup" id="dev-setup" style="color: inherit; text-decoration: none;"> <h2>Dev Setup</h2> </a> <p>The simplest way to use a kyber development version in an app and being able to add debug-lines and change the code is to add the following to your <code>tsconfig.json</code>:</p> <pre><code class="language-json">{ <span class="hljs-attr">"compilerOptions"</span>: { <span class="hljs-attr">"paths"</span>: { <span class="hljs-attr">"@dedis/kyber"</span>: [ <span class="hljs-string">"../cothority/external/js/kyber/src"</span>, <span class="hljs-string">"node_modules/@dedis/kyber/*"</span> ], <span class="hljs-attr">"@dedis/kyber/*"</span>: [ <span class="hljs-string">"../cothority/external/js/kyber/src/*"</span>, <span class="hljs-string">"node_modules/@dedis/kyber/*"</span> ] } } }</code></pre> <p>This will look for the cothority-sources in the parent directory of your app and include those. If it doesn&#39;t find them, it will use the sources found in the <code>node_modules</code> directory.</p> <p>It is important that the cothority-repository is in the parent directory, else typescript will try to include it in the compilation.</p> <p>Also, the cothority/external/js/kyber-sources need to have all the libraries installed with <code>npm ci</code>, else the compilation will fail.</p> <a href="#old-way" id="old-way" style="color: inherit; text-decoration: none;"> <h3>Old way</h3> </a> <pre><code><span class="hljs-attr">git</span> <span class="hljs-string">clone https://github.com/dedis/cothority</span> <span class="hljs-attr">cd</span> <span class="hljs-string">cothority/external/js/kyber</span> <span class="hljs-attr">npm</span> <span class="hljs-string">run link</span> <span class="hljs-attr">cd</span> <span class="hljs-string">$WORK_DIR</span> <span class="hljs-attr">npm</span> <span class="hljs-string">link @dedis/kyber</span></code></pre> <a href="#browser-build" id="browser-build" style="color: inherit; text-decoration: none;"> <h2>Browser Build</h2> </a> <p><code>npm run build</code> will transpile the typescript files of the <em>src</em> folder into <em>dist</em> and <code>npm run bundle</code> will pack everything inside a minimalistic bundle again in <em>dist</em></p> <a href="#running-tests" id="running-tests" style="color: inherit; text-decoration: none;"> <h2>Running Tests</h2> </a> <p>Execute <code>npm test</code> to run the unit tests and get the coverage</p> <a href="#generate-documentation" id="generate-documentation" style="color: inherit; text-decoration: none;"> <h2>Generate Documentation</h2> </a> <p>Execute <code>npm run doc</code> to generate the documentation and browse doc/index.html</p> <a href="#releases" id="releases" style="color: inherit; text-decoration: none;"> <h1>Releases</h1> </a> <p>Please have a look at <a href="../../../PUBLISH.md">PUBLISH.md</a> for how to create releases.</p> </div> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="globals.html"><em>Globals</em></a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_constants_.html">"constants"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_edwards25519_curve_.html">"curve/edwards25519/curve"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_edwards25519_index_.html">"curve/edwards25519/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_edwards25519_point_.html">"curve/edwards25519/point"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_edwards25519_scalar_.html">"curve/edwards25519/scalar"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_index_.html">"curve/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_nist_curve_.html">"curve/nist/curve"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_nist_index_.html">"curve/nist/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_nist_params_.html">"curve/nist/params"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_nist_point_.html">"curve/nist/point"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_curve_nist_scalar_.html">"curve/nist/scalar"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_index_.html">"index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_bn_.html">"pairing/bn"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_constants_.html">"pairing/constants"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_curve_point_.html">"pairing/curve-<wbr>point"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_gfp_.html">"pairing/gfp"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_gfp12_.html">"pairing/gfp12"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_gfp2_.html">"pairing/gfp2"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_gfp6_.html">"pairing/gfp6"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_index_.html">"pairing/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_opt_ate_.html">"pairing/opt-<wbr>ate"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_point_.html">"pairing/point"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_scalar_.html">"pairing/scalar"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_pairing_twist_point_.html">"pairing/twist-<wbr>point"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_point_factory_.html">"point-<wbr>factory"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_random_.html">"random"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_anon_index_.html">"sign/anon/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_bdn_index_.html">"sign/bdn/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_bls_index_.html">"sign/bls/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_index_.html">"sign/index"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_mask_.html">"sign/mask"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_sign_schnorr_schnorr_.html">"sign/schnorr/schnorr"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_suite_.html">"suite"</a> </li> <li class=" tsd-kind-external-module"> <a href="modules/_utils_tonelli_shanks_.html">"utils/tonelli-<wbr>shanks"</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li> <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li> <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li> <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li> <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li> <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li> <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li> <li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li> <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li> <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li> <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li> <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li> <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="assets/js/main.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script> </body> </html>