2.0.1 • Published 4 years ago

@qnzl/auth v2.0.1

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

@qnzl/auth

Drop-in JWT authentication against specific claims (todoist.read.all) for a specific project / subject and issuer, to limit scope of keys

Installation

npm install --save @qnzl/auth

Usage

const Auth = require(`@qnzl/auth`)

const jwtPublicKey = `<public key>`

const auth = new Auth(jwtPublicKey)

// JWT has claim of `*`
const jwtToCheck = `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJjbGFpbXMiOlsiKiJdfQ.N9BGQcYOrjGnWXGWQlH9Gi-O_SL6kQrVd5n1QnlMOz0`

const hasClaim = auth.check(jwtToCheck, `todoist:read.*`, {
  issuer: `https://google.com`,
  subject: `watchers`,
})

console.log(`has 'todoist.read' claim: ${hasClaim}`)
2.0.1

4 years ago

2.0.0

4 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago