mirror of
https://github.com/chenasraf/express-otp.git
synced 2026-05-18 01:49:07 +00:00
151 lines
28 KiB
HTML
151 lines
28 KiB
HTML
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>express-otp</title><meta name="description" content="Documentation for express-otp"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
<div class="tsd-toolbar-contents container">
|
|
<div class="table-cell" id="tsd-search" data-base=".">
|
|
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
<div class="field">
|
|
<div id="tsd-toolbar-links"></div></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">express-otp</a></div>
|
|
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
<div class="container container-main">
|
|
<div class="col-8 col-content">
|
|
<div class="tsd-page-title">
|
|
<h2>express-otp</h2></div>
|
|
<div class="tsd-panel tsd-typography">
|
|
<a href="#express-otp" id="express-otp" style="color: inherit; text-decoration: none;">
|
|
<h1>express-otp</h1>
|
|
</a>
|
|
<h2 align="center">
|
|
|
|
<p><a href="https://github.com/chenasraf/express-otp">GitHub</a> | <a href="https://casraf.dev/express-otp">Documentation</a>
|
|
| <a href="https://npmjs.com/package/express-otp">NPM</a> | <a href="https://casraf.dev">casraf.dev</a></p>
|
|
</h2>
|
|
|
|
<p>Incredibly simple TOTP authentication for your Node.JS/Express backend.</p>
|
|
<p>Use it for authenticating either select admins to perform sensitive actions, or use it as the main
|
|
auth mechanism for your app.</p>
|
|
<p>Set-up is incredibly easy!</p>
|
|
|
|
<a href="#getting-started" id="getting-started" style="color: inherit; text-decoration: none;">
|
|
<h2>Getting started</h2>
|
|
</a>
|
|
<p>See <a href="src/example/server.ts">src/example/server.ts</a> for a fully working example usage.</p>
|
|
|
|
<a href="#initialize" id="initialize" style="color: inherit; text-decoration: none;">
|
|
<h3>Initialize</h3>
|
|
</a>
|
|
<p>First, use the <code>otp</code> function to generate middleware and functions for your use:</p>
|
|
<pre><code class="language-typescript"><span class="hl-0">import</span><span class="hl-1"> </span><span class="hl-2">otp</span><span class="hl-1"> </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">'express-otp'</span><br/><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">totp</span><span class="hl-1"> = </span><span class="hl-6">otp</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-7">// Any identifier that is for your app</span><br/><span class="hl-1"> </span><span class="hl-2">issuer:</span><span class="hl-1"> </span><span class="hl-3">'my-issuer'</span><span class="hl-1">,</span><br/><br/><span class="hl-1"> </span><span class="hl-7">// This should return user information if a request contains a valid user</span><br/><span class="hl-1"> </span><span class="hl-7">// attempt (such as username or email)</span><br/><span class="hl-1"> </span><span class="hl-6">getUser</span><span class="hl-2">:</span><span class="hl-1"> </span><span class="hl-4">async</span><span class="hl-1"> (</span><span class="hl-2">req</span><span class="hl-1">) </span><span class="hl-4">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">user</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">db</span><span class="hl-1">.</span><span class="hl-2">users</span><span class="hl-1">.</span><span class="hl-6">findOne</span><span class="hl-1">({ </span><span class="hl-2">username:</span><span class="hl-1"> </span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">query</span><span class="hl-1">.</span><span class="hl-2">username</span><span class="hl-1"> })</span><br/><span class="hl-1"> </span><span class="hl-0">if</span><span class="hl-1"> (!</span><span class="hl-2">user</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-0">return</span><span class="hl-1"> </span><span class="hl-4">undefined</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-0">return</span><span class="hl-1"> { </span><span class="hl-2">user:</span><span class="hl-1"> </span><span class="hl-2">user</span><span class="hl-1">.</span><span class="hl-2">details</span><span class="hl-1">, </span><span class="hl-2">secret:</span><span class="hl-1"> </span><span class="hl-2">user</span><span class="hl-1">.</span><span class="hl-2">secret</span><span class="hl-1">, </span><span class="hl-2">username:</span><span class="hl-1"> </span><span class="hl-2">user</span><span class="hl-1">.</span><span class="hl-2">username</span><span class="hl-1"> }</span><br/><span class="hl-1"> },</span><br/><br/><span class="hl-1"> </span><span class="hl-7">// By default, the token is fetched using `req.query.token`. You can change</span><br/><span class="hl-1"> </span><span class="hl-7">// that by providing a `getToken` option:</span><br/><span class="hl-1"> </span><span class="hl-6">getToken</span><span class="hl-2">:</span><span class="hl-1"> (</span><span class="hl-2">req</span><span class="hl-1">) </span><span class="hl-4">=></span><span class="hl-1"> </span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">headers</span><span class="hl-1">[</span><span class="hl-3">'X-OTP-Token'</span><span class="hl-1">] </span><span class="hl-0">as</span><span class="hl-1"> </span><span class="hl-8">string</span><span class="hl-1">,</span><br/><br/><span class="hl-1"> </span><span class="hl-7">// Use this option to immediately respond with an error when a token is</span><br/><span class="hl-1"> </span><span class="hl-7">// missing/invalid. If this is omitted, the next route/middleware will fire</span><br/><span class="hl-1"> </span><span class="hl-7">// normally, but without `req.user` injected. Providing this function ends</span><br/><span class="hl-1"> </span><span class="hl-7">// the response if it's fired.</span><br/><span class="hl-1"> </span><span class="hl-6">errorResponse</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">, </span><span class="hl-2">res</span><span class="hl-1">, </span><span class="hl-2">next</span><span class="hl-1">, </span><span class="hl-2">error</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">send</span><span class="hl-1">(</span><span class="hl-2">error</span><span class="hl-1">.</span><span class="hl-2">message</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">status</span><span class="hl-1">(</span><span class="hl-9">401</span><span class="hl-1">)</span><br/><span class="hl-1"> },</span><br/><br/><span class="hl-1"> </span><span class="hl-7">// Use `true` for default OTP form, or respond with your own form in a function.</span><br/><span class="hl-1"> </span><span class="hl-7">// The default form will redirect to the same URL with the `token` URL</span><br/><span class="hl-1"> </span><span class="hl-7">// parameter added. To modify this behavior to use another token method,</span><br/><span class="hl-1"> </span><span class="hl-7">// you will have to supply your own form.</span><br/><span class="hl-1"> </span><span class="hl-2">tokenForm:</span><span class="hl-1"> </span><span class="hl-4">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">tokenForm</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">, </span><span class="hl-2">res</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">render</span><span class="hl-1">(</span><span class="hl-2">myFormPage</span><span class="hl-1">)</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">})</span>
|
|
</code></pre>
|
|
|
|
<a href="#generate-a-user-secret" id="generate-a-user-secret" style="color: inherit; text-decoration: none;">
|
|
<h3>Generate a user secret</h3>
|
|
</a>
|
|
<p>Tokens must be valid 32-bit strings (characters <code>A-Z</code> and <code>2-7</code> and <code>=</code>).</p>
|
|
<p>You can supply your own tokens, or generate one using <code>generateNewSecret()</code>.</p>
|
|
<pre><code class="language-typescript"><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">token</span><span class="hl-1"> = </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">generateNewSecret</span><span class="hl-1">()</span><br/><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-2">token</span><span class="hl-1">) </span><span class="hl-7">// example: 4XLM2M7UTOLK6JYUX7BR2KB5USM7HM6J</span>
|
|
</code></pre>
|
|
|
|
<a href="#generate-a-urlqr" id="generate-a-urlqr" style="color: inherit; text-decoration: none;">
|
|
<h4>Generate a URL/QR</h4>
|
|
</a>
|
|
<p>You can generate an OATH URI or a QR code containing that URI, for your users to scan and be able to
|
|
use in their authenticator apps.</p>
|
|
<pre><code class="language-typescript"><span class="hl-7">// generate URL</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">uri</span><span class="hl-1"> = </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">generateSecretURL</span><span class="hl-1">(</span><span class="hl-2">username</span><span class="hl-1">, </span><span class="hl-2">secret</span><span class="hl-1">)</span><br/><br/><span class="hl-7">// generate QR data URL (for use in `<img src="...">`)</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">qrDataURL</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">generateSecretQR</span><span class="hl-1">(</span><span class="hl-2">username</span><span class="hl-1">, </span><span class="hl-2">secret</span><span class="hl-1">)</span><br/><br/><span class="hl-7">// write QR image directly to file - add 3rd argument</span><br/><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">generateSecretQR</span><span class="hl-1">(</span><span class="hl-2">username</span><span class="hl-1">, </span><span class="hl-2">secret</span><span class="hl-1">, </span><span class="hl-3">'/path/to/qr.png'</span><span class="hl-1">)</span>
|
|
</code></pre>
|
|
|
|
<a href="#authenticate-a-user" id="authenticate-a-user" style="color: inherit; text-decoration: none;">
|
|
<h3>Authenticate a user</h3>
|
|
</a>
|
|
<p>To lock any endpoint behind authentication, use the provided <code>authenticate()</code> middleware. If the
|
|
user provided the token by your specified method, the user is injected into the request.</p>
|
|
<p>If you specified <code>tokenForm</code> as true or your own function, a missing token will trigger that form to
|
|
be responded to the user.</p>
|
|
<p>Otherwise, an error will be chained to the next middleware. You can make it respond immediately with
|
|
an error by using <code>errorResponse</code> option.</p>
|
|
<p>You can pass options to the <code>authenticate()</code> method to override options from the top-level call, for
|
|
example setting a custom error response, or token form page.</p>
|
|
<p>Further requests will still need to be validated with a correct token. The authentication state will
|
|
<strong>not be saved in memory</strong> between sessions - that is up to you to implement (if necessary).</p>
|
|
<pre><code class="language-typescript"><span class="hl-2">app</span><span class="hl-1">.</span><span class="hl-6">get</span><span class="hl-1">(</span><span class="hl-3">'/user/me'</span><span class="hl-1">, </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">authenticate</span><span class="hl-1">(), (</span><span class="hl-2">req</span><span class="hl-1">, </span><span class="hl-2">res</span><span class="hl-1">) </span><span class="hl-4">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-0">if</span><span class="hl-1"> (!</span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">user</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">status</span><span class="hl-1">(</span><span class="hl-9">401</span><span class="hl-1">).</span><span class="hl-6">json</span><span class="hl-1">(</span><span class="hl-3">'Unauthorized'</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-0">return</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">status</span><span class="hl-1">(</span><span class="hl-9">200</span><span class="hl-1">).</span><span class="hl-6">json</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">user</span><span class="hl-1">)</span><br/><span class="hl-1">})</span>
|
|
</code></pre>
|
|
|
|
<a href="#manual-authentication" id="manual-authentication" style="color: inherit; text-decoration: none;">
|
|
<h4>Manual authentication</h4>
|
|
</a>
|
|
<p>If you want to manually check the OTP in your own middleware, you can use the <code>verifyUser</code> and
|
|
<code>verifyToken</code> methods. You will need to inject the user yourself in that case. However, you would
|
|
get more fine-tuned control over the response timing & structure.</p>
|
|
<pre><code class="language-typescript"><span class="hl-0">if</span><span class="hl-1"> (</span><span class="hl-3">'token'</span><span class="hl-1"> </span><span class="hl-4">in</span><span class="hl-1"> </span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">query</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-3">'Token is valid:'</span><span class="hl-1">, </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">verifyToken</span><span class="hl-1">(</span><span class="hl-2">userSecret</span><span class="hl-1">, </span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">token</span><span class="hl-1">))</span><br/><span class="hl-1"> </span><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">user</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">totp</span><span class="hl-1">.</span><span class="hl-6">verifyUser</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-0">if</span><span class="hl-1"> (!</span><span class="hl-2">user</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-6">next</span><span class="hl-1">(</span><span class="hl-4">new</span><span class="hl-1"> </span><span class="hl-6">Error</span><span class="hl-1">(</span><span class="hl-3">'Invalid OTP token'</span><span class="hl-1">))</span><br/><span class="hl-1"> </span><span class="hl-0">return</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-2">req</span><span class="hl-1">.</span><span class="hl-2">user</span><span class="hl-1"> = </span><span class="hl-2">user</span><br/><span class="hl-1"> </span><span class="hl-6">next</span><span class="hl-1">(</span><span class="hl-4">null</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-0">return</span><br/><span class="hl-1">}</span>
|
|
</code></pre>
|
|
|
|
<a href="#customizing-errortoken-form" id="customizing-errortoken-form" style="color: inherit; text-decoration: none;">
|
|
<h3>Customizing error/token form</h3>
|
|
</a>
|
|
<p>You can supply functions that will act as middleware when getting a request with no token, or an
|
|
invalid token or a missing user.</p>
|
|
<p>When either of theses are specified, they are used instead of the default behaviors.</p>
|
|
<pre><code class="language-typescript"><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">totp</span><span class="hl-1"> = </span><span class="hl-6">otp</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-7">// custom token form</span><br/><span class="hl-1"> </span><span class="hl-6">tokenForm</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">, </span><span class="hl-2">res</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">status</span><span class="hl-1">(</span><span class="hl-9">200</span><span class="hl-1">).</span><span class="hl-6">render</span><span class="hl-1">(</span><span class="hl-2">myTokenForm</span><span class="hl-1">)</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-7">// custom error page</span><br/><span class="hl-1"> </span><span class="hl-6">errorResponse</span><span class="hl-1">(</span><span class="hl-2">req</span><span class="hl-1">, </span><span class="hl-2">res</span><span class="hl-1">, </span><span class="hl-2">next</span><span class="hl-1">, </span><span class="hl-2">error</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-2">res</span><span class="hl-1">.</span><span class="hl-6">status</span><span class="hl-1">(</span><span class="hl-9">400</span><span class="hl-1">).</span><span class="hl-6">json</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-2">code:</span><span class="hl-1"> </span><span class="hl-2">error</span><span class="hl-1">.</span><span class="hl-2">type</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">message:</span><span class="hl-1"> </span><span class="hl-2">error</span><span class="hl-1">.</span><span class="hl-2">message</span><span class="hl-1">,</span><br/><span class="hl-1"> })</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">})</span>
|
|
</code></pre>
|
|
|
|
<a href="#contributing" id="contributing" style="color: inherit; text-decoration: none;">
|
|
<h2>Contributing</h2>
|
|
</a>
|
|
<p>I am developing this package on my free time, so any support, whether code, issues, or just stars is
|
|
very helpful to sustaining its life. If you are feeling incredibly generous and would like to donate
|
|
just a small amount to help sustain this project, I would be very very thankful!</p>
|
|
<a href='https://ko-fi.com/casraf' target='_blank'>
|
|
<img height='36' style='border:0px;height:36px;'
|
|
src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'
|
|
alt='Buy Me a Coffee at ko-fi.com' />
|
|
</a>
|
|
|
|
<p>I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
|
|
don't hesitate to open an appropriate issue and I will do my best to reply promptly.</p>
|
|
<p>If you are a developer and want to contribute code, here are some starting tips:</p>
|
|
<ol>
|
|
<li>Fork this repository</li>
|
|
<li>Run <code>yarn install</code></li>
|
|
<li>Run <code>yarn start</code> to start file watch mode</li>
|
|
<li>Make any changes you would like</li>
|
|
<li>Create tests for your changes</li>
|
|
<li>Update the relevant documentation (readme, code comments, type comments)</li>
|
|
<li>Create a PR on upstream</li>
|
|
</ol>
|
|
</div></div>
|
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
<div class="tsd-navigation settings">
|
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
<div class="tsd-accordion-details">
|
|
<div class="tsd-filter-visibility">
|
|
<h4 class="uppercase">Member Visibility</h4><form>
|
|
<ul id="tsd-filter-options">
|
|
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
|
|
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
|
|
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
|
|
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
|
|
<div class="tsd-theme-toggle">
|
|
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
<nav class="tsd-navigation primary">
|
|
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
<div class="tsd-accordion-details">
|
|
<ul>
|
|
<li class="current selected"><a href="modules.html">express-<wbr/>otp</a>
|
|
<ul></ul></li></ul></div></details></nav>
|
|
<nav class="tsd-navigation secondary menu-sticky">
|
|
<ul>
|
|
<li class="tsd-kind-class"><a href="classes/OTPError.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg>OTPError</a></li>
|
|
<li class="tsd-kind-interface"><a href="interfaces/TokenFormOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-256-path"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)" id="icon-256-text"></path></svg>Token<wbr/>Form<wbr/>Options</a></li>
|
|
<li class="tsd-kind-interface"><a href="interfaces/TotpApiOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>Totp<wbr/>Api<wbr/>Options</a></li>
|
|
<li class="tsd-kind-interface"><a href="interfaces/TotpMiddlewares.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>Totp<wbr/>Middlewares</a></li>
|
|
<li class="tsd-kind-interface"><a href="interfaces/TotpOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>Totp<wbr/>Options</a></li>
|
|
<li class="tsd-kind-interface"><a href="interfaces/UserData.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>User<wbr/>Data</a></li>
|
|
<li class="tsd-kind-type-alias"><a href="types/AuthOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg>Auth<wbr/>Options</a></li>
|
|
<li class="tsd-kind-type-alias"><a href="types/OTPErrorReason.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>OTPError<wbr/>Reason</a></li>
|
|
<li class="tsd-kind-function"><a href="functions/default.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-64-path"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)" id="icon-64-text"></path></svg>default</a></li></ul></nav></div></div>
|
|
<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/main.js"></script></body></html> |