mirror of
https://github.com/chenasraf/express-otp.git
synced 2026-05-18 01:49:07 +00:00
deploy: 45490860a3
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -31,7 +31,7 @@
|
||||
<h5>_options: <a href="../interfaces/TotpOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">TotpOptions</a><span class="tsd-signature-symbol"> & </span><a href="../interfaces/TotpApiOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">TotpApiOptions</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">U</span><span class="tsd-signature-symbol">></span></h5></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <a href="../interfaces/TotpMiddlewares.html" class="tsd-signature-type" data-tsd-kind="Interface">TotpMiddlewares</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">U</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L197">index.ts:197</a></li></ul></aside></li></ul></section></div>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/index.ts#L41">index.ts:41</a></li></ul></aside></li></ul></section></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">
|
||||
|
||||
@@ -36,7 +36,7 @@ auth mechanism for your app.</p>
|
||||
<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/><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/><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/><span class="hl-1">})</span>
|
||||
<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/><span class="hl-1">})</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="#generate-a-user-secret" id="generate-a-user-secret" style="color: inherit; text-decoration: none;">
|
||||
@@ -59,8 +59,9 @@ use in their authenticator apps.</p>
|
||||
<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. If the
|
||||
<code>req</code> object contains a <code>user</code>, that means your user is authenticated!</p>
|
||||
user provided the token by your specified method, the user is injected into the request. 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>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>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<ul class="tsd-hierarchy">
|
||||
<li><span class="target">TotpApiOptions</span></li></ul></section><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L55">index.ts:55</a></li></ul></aside>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L52">types.ts:52</a></li></ul></aside>
|
||||
<section class="tsd-panel-group tsd-index-group">
|
||||
<section class="tsd-panel tsd-index-panel">
|
||||
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
||||
@@ -33,13 +33,42 @@
|
||||
<div class="tsd-accordion-details">
|
||||
<section class="tsd-index-section">
|
||||
<h3 class="tsd-index-heading">Methods</h3>
|
||||
<div class="tsd-index-list"><a href="TotpApiOptions.html#getToken" class="tsd-index-link tsd-kind-method tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-2048-path"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)" id="icon-2048-text"></path></svg><span>get<wbr/>Token?</span></a>
|
||||
<div class="tsd-index-list"><a href="TotpApiOptions.html#errorResponse" class="tsd-index-link tsd-kind-method tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-2048-path"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)" id="icon-2048-text"></path></svg><span>error<wbr/>Response?</span></a>
|
||||
<a href="TotpApiOptions.html#getToken" class="tsd-index-link tsd-kind-method tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>get<wbr/>Token?</span></a>
|
||||
<a href="TotpApiOptions.html#getUser" class="tsd-index-link tsd-kind-method tsd-parent-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg><span>get<wbr/>User</span></a>
|
||||
</div></section></div></details></section></section>
|
||||
<section class="tsd-panel-group tsd-member-group">
|
||||
<h2>Methods</h2>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="errorResponse" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>error<wbr/>Response</span><a href="#errorResponse" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
<li class="tsd-signature tsd-anchor-link" id="errorResponse.errorResponse-1">error<wbr/>Response<span class="tsd-signature-symbol">(</span>req<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">ParamsDictionary</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">ParsedQs</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, res<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, next<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">NextFunction</span>, reason<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">OTPError</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#errorResponse.errorResponse-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-comment tsd-typography"><p>If this function is provided, it will be used to respond to the user with an error when OTP verification fails.
|
||||
The response ends after this function is called.</p>
|
||||
</div>
|
||||
<div class="tsd-parameters">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameter-list">
|
||||
<li>
|
||||
<h5>req: <span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">ParamsDictionary</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">ParsedQs</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>The request object.</p>
|
||||
</div></li>
|
||||
<li>
|
||||
<h5>res: <span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>The response object.</p>
|
||||
</div></li>
|
||||
<li>
|
||||
<h5>next: <span class="tsd-signature-type">NextFunction</span></h5>
|
||||
<div class="tsd-comment tsd-typography"><p>The next function.</p>
|
||||
</div></li>
|
||||
<li>
|
||||
<h5>reason: <span class="tsd-signature-type">OTPError</span></h5></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L88">types.ts:88</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getToken" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>get<wbr/>Token</span><a href="#getToken" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>get<wbr/>Token</span><a href="#getToken" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
<li class="tsd-signature tsd-anchor-link" id="getToken.getToken-1">get<wbr/>Token<span class="tsd-signature-symbol">(</span>req<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">ParamsDictionary</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">ParsedQs</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PromiseOrValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#getToken.getToken-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
@@ -56,7 +85,7 @@
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PromiseOrValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L81">index.ts:81</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L78">types.ts:78</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getUser" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>get<wbr/>User</span><a href="#getUser" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -83,7 +112,7 @@ checking headers, etc.</p>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PromiseOrValue</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="UserData.html" class="tsd-signature-type" data-tsd-kind="Interface">UserData</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">U</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L73">index.ts:73</a></li></ul></aside></li></ul></section></section></div>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L70">types.ts:70</a></li></ul></aside></li></ul></section></section></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">
|
||||
@@ -109,6 +138,7 @@ checking headers, etc.</p>
|
||||
<ul>
|
||||
<li class="current tsd-kind-interface"><a href="TotpApiOptions.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><span>Totp<wbr/>Api<wbr/>Options</span></a>
|
||||
<ul>
|
||||
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="TotpApiOptions.html#errorResponse" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>error<wbr/>Response?</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="TotpApiOptions.html#getToken" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>get<wbr/>Token?</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="TotpApiOptions.html#getUser" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>get<wbr/>User</a></li></ul></li></ul></nav></div></div>
|
||||
<div class="container tsd-generator">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<ul class="tsd-hierarchy">
|
||||
<li><span class="target">TotpMiddlewares</span></li></ul></section><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L84">index.ts:84</a></li></ul></aside>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L91">types.ts:91</a></li></ul></aside>
|
||||
<section class="tsd-panel-group tsd-index-group">
|
||||
<section class="tsd-panel tsd-index-panel">
|
||||
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
||||
@@ -80,7 +80,7 @@ further requests.</p>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L93">index.ts:93</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L100">types.ts:100</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="generateNewSecret" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>generate<wbr/>New<wbr/>Secret</span><a href="#generateNewSecret" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -90,7 +90,7 @@ further requests.</p>
|
||||
</div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L144">index.ts:144</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L151">types.ts:151</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="generateSecretQR" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>generate<wbr/>SecretQR</span><a href="#generateSecretQR" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -114,7 +114,7 @@ further requests.</p>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L115">index.ts:115</a></li></ul></aside></li>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L122">types.ts:122</a></li></ul></aside></li>
|
||||
<li class="tsd-signature tsd-anchor-link" id="generateSecretQR.generateSecretQR-2">generate<wbr/>SecretQR<span class="tsd-signature-symbol">(</span>username<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, filename<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#generateSecretQR.generateSecretQR-2" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-comment tsd-typography"><p>Function for generating a QR code for a user from a given <code>secret</code> and <code>username</code>.</p>
|
||||
@@ -137,7 +137,7 @@ further requests.</p>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L126">index.ts:126</a></li></ul></aside></li>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L133">types.ts:133</a></li></ul></aside></li>
|
||||
<li class="tsd-signature tsd-anchor-link" id="generateSecretQR.generateSecretQR-3">generate<wbr/>SecretQR<span class="tsd-signature-symbol">(</span>username<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, secret<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, filename<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#generateSecretQR.generateSecretQR-3" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-comment tsd-typography"><p>Function for generating a QR code for a user from a given <code>secret</code> and <code>username</code>.</p>
|
||||
@@ -164,7 +164,7 @@ user.</li>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L139">index.ts:139</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L146">types.ts:146</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="generateSecretURL" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>generate<wbr/>SecretURL</span><a href="#generateSecretURL" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -187,7 +187,7 @@ user.</li>
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L103">index.ts:103</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L110">types.ts:110</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="verifyToken" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>verify<wbr/>Token</span><a href="#verifyToken" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -211,7 +211,7 @@ secret, it returns <code>true</code>. Otherwise, it returns <code>false</code>.<
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L155">index.ts:155</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L162">types.ts:162</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="verifyUser" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>verify<wbr/>User</span><a href="#verifyUser" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
|
||||
@@ -230,7 +230,7 @@ secret, it returns <code>true</code>. Otherwise, it returns <code>false</code>.<
|
||||
</div></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">U</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L163">index.ts:163</a></li></ul></aside></li></ul></section></section></div>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L170">types.ts:170</a></li></ul></aside></li></ul></section></section></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">
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<ul class="tsd-hierarchy">
|
||||
<li><span class="target">TotpOptions</span></li></ul></section><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L17">index.ts:17</a></li></ul></aside>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L14">types.ts:14</a></li></ul></aside>
|
||||
<section class="tsd-panel-group tsd-index-group">
|
||||
<section class="tsd-panel tsd-index-panel">
|
||||
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
||||
@@ -43,35 +43,35 @@
|
||||
SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128, or SHAKE256).</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L26">index.ts:26</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L23">types.ts:23</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="digits" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>digits</span><a href="#digits" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">digits<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>Amount of token digits to use. Defaults to 6</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L39">index.ts:39</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L36">types.ts:36</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="issuer" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>issuer</span><a href="#issuer" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">issuer<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>The issuer for your app (required)</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L19">index.ts:19</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L16">types.ts:16</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="period" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>period</span><a href="#period" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">period<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>The time it takes for a new token to generate, in seconds. Defaults to 30</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L21">index.ts:21</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L18">types.ts:18</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="timestamp" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>timestamp</span><a href="#timestamp" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">timestamp<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>The epoch time. Defaults to 0 (unix epoch)</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L41">index.ts:41</a></li></ul></aside></section></section></div>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L38">types.ts:38</a></li></ul></aside></section></section></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">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<ul class="tsd-hierarchy">
|
||||
<li><span class="target">UserData</span></li></ul></section><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L44">index.ts:44</a></li></ul></aside>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L41">types.ts:41</a></li></ul></aside>
|
||||
<section class="tsd-panel-group tsd-index-group">
|
||||
<section class="tsd-panel tsd-index-panel">
|
||||
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
||||
@@ -45,21 +45,21 @@
|
||||
<div class="tsd-comment tsd-typography"><p>The secret key of the user, used for generating a comparison key.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L48">index.ts:48</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L45">types.ts:45</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="user" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>user</span><a href="#user" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">user<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type" data-tsd-kind="Type parameter">U</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>The user object that will get injected into further requests.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L46">index.ts:46</a></li></ul></aside></section>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L43">types.ts:43</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="username" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>username</span><a href="#username" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">username<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
||||
<div class="tsd-comment tsd-typography"><p>The username used for generating the token URL/QR.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/29de0b2/src/index.ts#L50">index.ts:50</a></li></ul></aside></section></section></div>
|
||||
<li>Defined in <a href="https://github.com/chenasraf/express-otp/blob/4549086/src/types.ts#L47">types.ts:47</a></li></ul></aside></section></section></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">
|
||||
|
||||
Reference in New Issue
Block a user