<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://www.jwtauthn.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.jwtauthn.com/" rel="alternate" type="text/html" /><updated>2021-12-01T06:26:20-06:00</updated><id>https://www.jwtauthn.com/feed.xml</id><title type="html">jwt-authn</title><subtitle>jwt-authn is an npm package for decoding, encoding, verifying, and signing JWTs.</subtitle><author><name>Anthony Dombrowski</name></author><entry><title type="html">Appendix - Converting Public Key to PEM Format</title><link href="https://www.jwtauthn.com/appendix/appendix-converting-public-key-to-pem/" rel="alternate" type="text/html" title="Appendix - Converting Public Key to PEM Format" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/appendix/appendix-converting-public-key-to-pem</id><content type="html" xml:base="https://www.jwtauthn.com/appendix/appendix-converting-public-key-to-pem/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;changing-public-key-generated-with-ssh-keygen-instructions-in-appendix-into-pem-format&quot;&gt;Changing public key generated with ssh-keygen (&lt;a href=&quot;/appendix/appendix-generating-rsa256-private-public-key-pair/&quot;&gt;instructions in appendix&lt;/a&gt;) into PEM format&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;*You need to do this so it’s in the right format to use as the public key to verify a signed JWT.&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# reads from file jwtRS256.key.pub&lt;/span&gt;
ssh-keygen &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; jwtRS256.key.pub &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; pem
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;or with openssl&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# reads from file jwtRS256.key.pub&lt;/span&gt;
openssl rsa &lt;span class=&quot;nt&quot;&gt;-in&lt;/span&gt; jwtRS256.key &lt;span class=&quot;nt&quot;&gt;-pubout&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-outform&lt;/span&gt; PEM &lt;span class=&quot;nt&quot;&gt;-out&lt;/span&gt; jwtRS256.key.pub
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="appendix" /><category term="appendix" /><category term="jwt" /><category term="rsa256" /><category term="rs256" /><category term="public" /><category term="key pair" /><category term="key" /><category term="pem" /><category term="ssh-keygen" /><category term="bash" /><category term="openssl" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Appendix - Generating RSA256 Private and Public Key Pairs</title><link href="https://www.jwtauthn.com/appendix/appendix-generating-rsa256-private-public-key-pair/" rel="alternate" type="text/html" title="Appendix - Generating RSA256 Private and Public Key Pairs" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/appendix/appendix-generating-rsa256-private-public-key-pair</id><content type="html" xml:base="https://www.jwtauthn.com/appendix/appendix-generating-rsa256-private-public-key-pair/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;generating-rsa256-private-and-public-key-pair&quot;&gt;Generating RSA256 private and public key pair&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;with javascript&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;crypto&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;crypto&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;publicKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateKey&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;crypto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;generateKeyPairSync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rsa&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;modulusLength&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;publicKeyEncoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;spki&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;privateKeyEncoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pkcs8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;aes-256-cbc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;passphrase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;top secret&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// this creates an encrypted private key. Make sure to pass it in when trying to sign a JWT. Omit for an unencrypted private key.&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;or from a bash shell&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; rsa &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 4096 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; PEM &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; jwtRS256.key
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="appendix" /><category term="appendix" /><category term="jwt" /><category term="rsa256" /><category term="rs256" /><category term="private" /><category term="public" /><category term="key pair" /><category term="key" /><category term="bash" /><category term="javascript" /><category term="js" /><category term="node" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Appendix - What is a JWT?</title><link href="https://www.jwtauthn.com/appendix/appendix-what-is-a-jwt/" rel="alternate" type="text/html" title="Appendix - What is a JWT?" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/appendix/appendix-what-is-a-jwt</id><content type="html" xml:base="https://www.jwtauthn.com/appendix/appendix-what-is-a-jwt/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;what-is-a-jwt&quot;&gt;What is a JWT?&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A JWT (JSON Web Token), pronounced like “jot”, passes along information in the form of claims. It’s often used because it’s url safe and compact. Its components are also in the form of JSON objects, a popular way to read information across the internet. The cryptographic mechanisms of a JWS provide integrity protection as well.&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://tools.ietf.org/html/rfc7519&quot;&gt;RFC 7519 JSON Web Token (JWT)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://tools.ietf.org/html/rfc7515&quot;&gt;RFC 7515 JSON Web Signature (JWS)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://tools.ietf.org/html/rfc6749&quot;&gt;RFC 6749 The OAuth 2.0 Authorization Framework&lt;/a&gt;&lt;/p&gt;</content><author><name>Anthony Dombrowski</name></author><category term="appendix" /><category term="appendix" /><category term="jwt" /><category term="what is a jwt" /><category term="jot" /><category term="json" /><category term="url" /><category term="safe" /><category term="compact" /><category term="jws" /><category term="json web token" /><category term="token" /><category term="rfc 7519" /><category term="rfc 7515" /><category term="rfc 6749" /><category term="oauth" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Utility Methods - Base64URL Encode</title><link href="https://www.jwtauthn.com/utility/base64url-encode-json/" rel="alternate" type="text/html" title="Utility Methods - Base64URL Encode" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/utility/base64url-encode-json</id><content type="html" xml:base="https://www.jwtauthn.com/utility/base64url-encode-json/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;base64urlencodejson&quot;&gt;&lt;strong&gt;base64URLEncode(json)&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;json: the input in JSON object format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use to create the base64url encoding of the the input.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;base64urlEncode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwt-authn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;payload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;iss&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;joe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;exp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1300819380&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://example.com/is_root&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;base64URLEncode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// expected output:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="utility" /><category term="utility" /><category term="jwt" /><category term="base64url" /><category term="encode" /><category term="utility" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">CLI - Base64URL Encoding</title><link href="https://www.jwtauthn.com/documentation/cli-base64url-encoding/" rel="alternate" type="text/html" title="CLI - Base64URL Encoding" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/documentation/cli-base64url-encoding</id><content type="html" xml:base="https://www.jwtauthn.com/documentation/cli-base64url-encoding/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;cli---base64url-encoding&quot;&gt;CLI - Base64URL Encoding&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Use the -b flag and a string to base64url encode the string&lt;/p&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;jwt-authn &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;hello&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# expected output&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# aGVsbG8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or use the –base64url flag and a string to base64url encode the string&lt;/p&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;jwt-authn &lt;span class=&quot;nt&quot;&gt;--base64url&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;hello&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# expected output&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# aGVsbG8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="documentation" /><category term="docs" /><category term="jwt" /><category term="encoding" /><category term="base64url" /><category term="cli" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Contributing</title><link href="https://www.jwtauthn.com/contributing/contributing/" rel="alternate" type="text/html" title="Contributing" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/contributing/contributing</id><content type="html" xml:base="https://www.jwtauthn.com/contributing/contributing/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;contributing&quot;&gt;Contributing&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.&lt;/p&gt;

&lt;p&gt;Please make sure to update tests as appropriate.&lt;/p&gt;</content><author><name>Anthony Dombrowski</name></author><category term="contributing" /><category term="contributing" /><category term="pull requests" /><category term="tests" /><category term="issue" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Decoding JWTs</title><link href="https://www.jwtauthn.com/documentation/decoding-jwts/" rel="alternate" type="text/html" title="Decoding JWTs" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/documentation/decoding-jwts</id><content type="html" xml:base="https://www.jwtauthn.com/documentation/decoding-jwts/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;decoding-a-jwt&quot;&gt;Decoding a JWT&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;jwtdecodejwt&quot;&gt;&lt;strong&gt;jwtDecode(jwt)&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;*Decoding example taken from &lt;a href=&quot;https://tools.ietf.org/html/rfc7515#appendix-A.1.2&quot;&gt;RFC 7515 JSON Web Signature (JWS)&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Decoding&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jwtAuthn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwt-authn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;jwtAuthn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jwtDecode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;cm&quot;&gt;/*
* Output is an object that looks like this:
*
* {
*   header: { alg: &quot;RS256&quot; },
*   payload: {
*     iss: &quot;joe&quot;,
*     exp: 1300819380,
*     &quot;http://example.com/is_root&quot;: true,
*   },
*   signature: &quot;cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw&quot;,
* };
*
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="documentation" /><category term="docs" /><category term="jwt" /><category term="decode" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Encoding JWTs</title><link href="https://www.jwtauthn.com/documentation/encoding-jwts/" rel="alternate" type="text/html" title="Encoding JWTs" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/documentation/encoding-jwts</id><content type="html" xml:base="https://www.jwtauthn.com/documentation/encoding-jwts/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;encoding-a-jwt&quot;&gt;Encoding a JWT&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;jwtencodeheader-payload-key-options&quot;&gt;&lt;strong&gt;jwtEncode(header, payload, key[, options])&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;where &lt;em&gt;options&lt;/em&gt; contains:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;keyFormat - format of the rs256 private key&lt;/li&gt;
  &lt;li&gt;passphrase - if using an encrypted private key, passphrase is also required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*Encoding example taken from &lt;a href=&quot;https://tools.ietf.org/html/rfc7515#appendix-A.1.1&quot;&gt;RFC 7515 JSON Web Signature (JWS)&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jwtAuthn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwt-authn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;jwt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jwtEncode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;{&quot;typ&quot;:&quot;JWT&quot;,&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; &quot;alg&quot;:&quot;HS256&quot;}&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;{&quot;iss&quot;:&quot;joe&quot;,&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; &quot;exp&quot;:1300819380,&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; &quot;http://example.com/is_root&quot;:true}&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// returns&lt;/span&gt;
&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="documentation" /><category term="docs" /><category term="jwt" /><category term="encode" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">License</title><link href="https://www.jwtauthn.com/license/license/" rel="alternate" type="text/html" title="License" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/license/license</id><content type="html" xml:base="https://www.jwtauthn.com/license/license/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;license&quot;&gt;License&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://spdx.org/licenses/MIT-Modern-Variant.html&quot;&gt;MIT-Modern-Variant&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://choosealicense.com/licenses/mit/&quot;&gt;MIT&lt;/a&gt;&lt;/p&gt;</content><author><name>Anthony Dombrowski</name></author><category term="license" /><category term="license" /><category term="mit-modern-variant" /><category term="mit" /><summary type="html">link to npm jwt-authn</summary></entry><entry><title type="html">Signing with HS256</title><link href="https://www.jwtauthn.com/documentation/signing-hs256/" rel="alternate" type="text/html" title="Signing with HS256" /><published>2021-09-30T00:00:00-05:00</published><updated>2021-09-30T00:00:00-05:00</updated><id>https://www.jwtauthn.com/documentation/signing-hs256</id><content type="html" xml:base="https://www.jwtauthn.com/documentation/signing-hs256/">&lt;p&gt;&lt;img src=&quot;https://img.shields.io/npm/v/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/bundlephobia/min/jwt-authn?style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm bundle size&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/languages/code-size/akdombrowski/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;codesize&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/dw/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;npm&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/npm/l/jwt-authn?&amp;amp;style=for-the-badge&amp;amp;logo=npm&quot; alt=&quot;NPM&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/sponsors/akdombrowski?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Sponsors&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/stars/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub Repo stars&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/forks/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub forks&quot; /&gt;
&lt;img src=&quot;https://img.shields.io/github/watchers/akdombrowski/jwt-authn?style=for-the-badge&amp;amp;logo=github&quot; alt=&quot;GitHub watchers&quot; /&gt;
&lt;a href=&quot;https://www.jsdelivr.com/package/npm/jwt-authn&quot;&gt;&lt;img src=&quot;https://data.jsdelivr.com/v1/package/npm/jwt-authn/badge&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://openbase.com/js/jwt-authn?utm_source=embedded&amp;amp;utm_medium=badge&amp;amp;utm_campaign=rate-badge&quot;&gt;&lt;img src=&quot;https://badges.openbase.com/js/rating/jwt-authn.svg&quot; alt=&quot;Rate on Openbase&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.npmjs.com/package/jwt-authn&quot;&gt;link to npm&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;jwt-authn&quot;&gt;jwt-authn&lt;/h1&gt;

&lt;h2 id=&quot;hs256signheaderpayload-key&quot;&gt;&lt;strong&gt;hs256Sign(headerPayload, key)&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;/documentation/full-documentation/&quot;&gt;Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;headerPayload: The combined base64url(header) and base64url(payload) separated by a “.”.&lt;/li&gt;
  &lt;li&gt;key: The signing key or passphrase.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hs256Sign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createHeaderPayload&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwt-authn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;decodedHeader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;typ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;JWT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;HS256&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;decodedPayload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;iss&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;joe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;exp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1300819380&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://example.com/is_root&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;passphrase&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;headerPayload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createHeaderPayload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;decodedHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;decodedPayload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hs256Sign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;headerPayload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;passphrase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// expected output&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// &quot;lliDzOlRAdGUCfCHCPx_uisb6ZfZ1LRQa0OJLeYTTpY&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Anthony Dombrowski</name></author><category term="documentation" /><category term="docs" /><category term="jwt" /><category term="sign" /><category term="hs256" /><summary type="html">link to npm jwt-authn</summary></entry></feed>