# anvil-connect-jwt

> Anvil Connect JWT library for Node.js

Latest version **0.1.8** (published 2016-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install anvil-connect-jwt
pnpm add anvil-connect-jwt
yarn add anvil-connect-jwt
bun add anvil-connect-jwt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2016-05-25 |
| First published | 2014-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+20 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Christian Smith |
| Maintainers | christiansmith |
| Keywords | JWT, JWS, JWE, OpenID, OpenID Connect, OAuth, OAuth 2.0 |

## Links

- npm: https://www.npmjs.com/package/anvil-connect-jwt
- Repository: https://github.com/anvilresearch/connect-jwt
- Issues: https://github.com/anvilresearch/connect-jwt/issues
- npm.io page: https://npm.io/package/anvil-connect-jwt

## Dependencies (5)

- [jwa](https://npm.io/package/jwa.md) ^1.0.0
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [base64url](https://npm.io/package/base64url.md) ^1.0.4
- [jsrsasign](https://npm.io/package/jsrsasign.md) ^5.0.0
- [valid-url](https://npm.io/package/valid-url.md) ^1.0.9

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 0.1.8 (latest) — 2016-05-25
- 0.1.7 — 2016-05-05
- 0.1.6 — 2015-10-14
- 0.1.5 — 2015-08-13
- 0.1.4 — 2015-07-31
- 0.1.3 — 2015-06-11
- 0.1.2 — 2014-10-24
- 0.1.1 — 2014-10-20
- 0.1.0 — 2014-08-14

## README

# Anvil Connect JWT
**[Anvil Connect](https://github.com/christiansmith/anvil-connect)** aims to be a scalable, full-featured, ready-to-run [**OpenID Connect**](http://openid.net/connect/) + [**OAuth 2.0**](http://tools.ietf.org/html/rfc6749) **Provider**. This package contains the JWT modeling library used by [Anvil Connect](https://github.com/anvilresearch/connect).


[![Join the chat at https://gitter.im/anvilresearch/connect](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/anvilresearch/connect?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/anvilresearch/connect-jwt.svg?branch=master)](https://travis-ci.org/anvilresearch/connect-jwt) ![Dependencies](https://img.shields.io/david/anvilresearch/connect-jwt.svg) ![License](https://img.shields.io/github/license/anvilresearch/connect-jwt.svg) ![Downloads](https://img.shields.io/npm/dm/anvil-connect-jwt.svg) ![npm](https://img.shields.io/npm/v/anvil-connect-jwt.svg)


## Install

    $ npm install anvil-connect-jwt --save

## Usage

All JWTs must conform to the JWT/JWS/JWE/JW\* specifications, but applications may impose additional requirements. For example, an OpenID Connect ID Token must require certain claims and headers, restrict the use of others, set default values, etc. Anvil Connect JWT is an abstract class that can be used to define JWTs conforming to application specfic requirements.

    // require the package
    var JWT = require('anvil-connect-jwt');


    // define a subclass
    var IDToken = JWT.define({

      // default header
      header: {
        alg: 'RS256'
      },

      // permitted headers
      headers: [
        'alg'
      ],

      // modify header schema
      registeredHeaders: {
        alg:   { format: 'StringOrURI', required: true, enum: ['RS256'] }
      },

      // permitted claims
      claims: ['iss', 'sub', 'aud', 'exp', 'iat', 'nonce', 'acr', 'at_hash'],

      // modify payload schema
      registeredClaims: {
        iss:      { format: 'StringOrURI', required: true },
        sub:      { format: 'StringOrURI', required: true },
        aud:      { format: 'StringOrURI', required: true },
        exp:      { format: 'IntDate',     required: true, default: expires('day')  },
        iat:      { format: 'IntDate',     required: true, default: Date.now },
        nonce:    { format: 'String' },
        acr:      { format: 'String' },
        at_hash:  { format: 'String' }
      }

    });


## The MIT License (MIT)

Copyright (c) 2015 Anvil Research, Inc.

---
_Source: https://npm.io/package/anvil-connect-jwt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
