# @digitalbranch/jwt

> JWT library for nodejs

Latest version **1.0.2** (published 2021-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @digitalbranch/jwt
pnpm add @digitalbranch/jwt
yarn add @digitalbranch/jwt
bun add @digitalbranch/jwt
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-04-15 |
| First published | 2021-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | V.J.M. Corbee |
| Maintainers | vincentcorbee |
| Keywords | JWT |

## Links

- npm: https://www.npmjs.com/package/@digitalbranch/jwt
- Repository: https://github.com/vincentcorbee/JWT
- Homepage: https://github.com/vincentcorbee/JWT#readme
- Issues: https://github.com/vincentcorbee/JWT/issues
- npm.io page: https://npm.io/package/@digitalbranch/jwt

## 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

- 1.0.2 (latest) — 2021-04-15
- 1.0.1 — 2021-04-15
- 1.0.0 — 2021-04-15

## README

# JWT

JWT library for nodejs

Supports HS256 and RS256

## Usage

install with npm

```bash
npm i @digitalbranch/jwt
```

Creating and verifying a HS256 token

```javascript
const secret = 'my secret'

const token = JWT.sign(
  { alg: 'HS256' },
  { name: 'john', exp: new Date(Date.now() + 900000).getTime() },
  secret
)

assert(JWT.verify(token, secret))
```

Creating and verifying a RS256 token

```javascript
JWT.createKeys().then(({ privateKey }) => {
  const token = JWT.sign(
    { alg: 'RS256' },
    { name: 'john', exp: new Date(Date.now() + 900000).getTime() },
    privateKey
  )

  assert(JWT.verify(token, privateKey))
})
```

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