1.0.1 • Published 4 years ago

archiveservices-node-jwt v1.0.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
4 years ago

archiveservices-node-jwt

Installation

npm install @bbc/archiveservices-node-jwt

Usage

import { getKeyStore, validateJWT } from 'archiveservices-node-jwt';

const jwt = 'someBase64EncodedJWT';
const wellKnownURL = 'https://example.com/.well-known/openid-configuration';

const keyStore = getKeyStore(wellKnownURL);

try {
  const decodedJWT = validateJWT(keyStore, jwt);  // this refreshes the keyStore if stale
} catch (e) {
  console.error(e) // an error is thrown if the JWT validation fails
}

Errors

For more information about the errors thrown from the verification process, see the errors section of the jsonwebtoken documentation.

Development

The target node environment is v12.13_

Install

  npm install

Run unit test in watch mode, really handy while developing

  npm test -- --watch

Run lint checking and unit tests

  make test
1.0.1

4 years ago

1.0.0

4 years ago