New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@qnzl/auth

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qnzl/auth

Authenticate JWT claims with dot-seperated claims, scoping to subject and issuer

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

@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}`)

FAQs

Package last updated on 31 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts