Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

express-oauth2-jwt-bearer

Package Overview
Dependencies
Maintainers
49
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-oauth2-jwt-bearer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

122

dist/index.d.ts

@@ -0,17 +1,119 @@

/// <reference types="node" />
import { Handler } from 'express';
import { JwtVerifierOptions, ClaimCheck, ClaimEquals, ClaimIncludes, RequiredScopes, VerifyJwtResult as AuthResult } from 'access-token-jwt';
import type { JWTPayload } from 'access-token-jwt';
import { Agent } from 'http';
import { Agent as Agent$1 } from 'https';
interface JWK {
alg?: string
crv?: string
d?: string
dp?: string
dq?: string
e?: string
ext?: boolean
k?: string
key_ops?: string[]
kid?: string
kty?: string
n?: string
oth?: Array<{
d?: string
r?: string
t?: string
}>
p?: string
q?: string
qi?: string
use?: string
x?: string
y?: string
x5c?: string[]
x5t?: string
'x5t#S256'?: string
x5u?: string
[propName: string]: unknown
}
interface JoseHeaderParameters {
kid?: string
x5t?: string
x5c?: string[]
x5u?: string
jku?: string
jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n'>
typ?: string
cty?: string
}
interface JWSHeaderParameters extends JoseHeaderParameters {
alg?: string
b64?: boolean
crit?: string[]
[propName: string]: unknown
}
interface JWTPayload {
iss?: string
sub?: string
aud?: string | string[]
jti?: string
nbf?: number
exp?: number
iat?: number
[propName: string]: unknown
}
declare type FunctionValidator = (value: unknown, claims: JWTPayload, header: JWSHeaderParameters) => Promise<boolean> | boolean;
declare type Validator = FunctionValidator | string | false | undefined;
interface Validators {
alg: Validator;
typ: Validator;
iss: Validator;
aud: Validator;
exp: Validator;
iat: Validator;
sub: Validator;
client_id: Validator;
jti: Validator;
[key: string]: Validator;
}
interface JwtVerifierOptions {
issuerBaseURL?: string;
audience?: string | string[];
issuer?: string;
jwksUri?: string;
agent?: Agent | Agent$1;
cooldownDuration?: number;
timeoutDuration?: number;
validators?: Partial<Validators>;
clockTolerance?: number;
maxTokenAge?: number;
strict?: boolean;
secret?: string;
tokenSigningAlg?: string;
}
interface VerifyJwtResult {
header: JWSHeaderParameters;
payload: JWTPayload;
token: string;
}
declare type JSONPrimitive = string | number | boolean | null;
declare type ClaimChecker = (payload?: JWTPayload) => void;
declare type RequiredScopes<R = ClaimChecker> = (scopes: string | string[]) => R;
declare type ClaimIncludes<R = ClaimChecker> = (claim: string, ...expected: JSONPrimitive[]) => R;
declare type ClaimEquals<R = ClaimChecker> = (claim: string, expected: JSONPrimitive) => R;
declare type ClaimCheck<R = ClaimChecker> = (fn: (payload: JWTPayload) => boolean, errMsg?: string) => R;
declare global {
namespace Express {
interface Request {
auth?: AuthResult;
auth?: VerifyJwtResult;
}
}
}
export declare const auth: (opts?: JwtVerifierOptions) => Handler;
export declare const claimCheck: ClaimCheck<Handler>;
export declare const claimEquals: ClaimEquals<Handler>;
export declare const claimIncludes: ClaimIncludes<Handler>;
export declare const requiredScopes: RequiredScopes<Handler>;
export { JwtVerifierOptions as AuthOptions, AuthResult, JWTPayload };
export { FunctionValidator, Validator, Validators, JWTHeader, JSONPrimitive, } from 'access-token-jwt';
declare const auth: (opts?: JwtVerifierOptions) => Handler;
declare const claimCheck: ClaimCheck<Handler>;
declare const claimEquals: ClaimEquals<Handler>;
declare const claimIncludes: ClaimIncludes<Handler>;
declare const requiredScopes: RequiredScopes<Handler>;
export { JwtVerifierOptions as AuthOptions, VerifyJwtResult as AuthResult, FunctionValidator, JSONPrimitive, JWSHeaderParameters as JWTHeader, JWTPayload, Validator, Validators, auth, claimCheck, claimEquals, claimIncludes, requiredScopes };

3

package.json
{
"name": "express-oauth2-jwt-bearer",
"description": "Authentication middleware for Express.js that validates JWT bearer access tokens.",
"version": "1.0.0",
"version": "1.0.1",
"main": "dist/index.js",

@@ -36,2 +36,3 @@ "types": "dist/index.d.ts",

"rollup": "^2.45.1",
"rollup-plugin-dts": "^4.0.0",
"rollup-plugin-typescript2": "^0.30.0",

@@ -38,0 +39,0 @@ "ts-jest": "^26.5.4",

@@ -32,3 +32,3 @@ # express-oauth2-jwt-bearer

The library requires [issuerBaseURL](https://auth0.github.io/node-oauth2-jwt-bearer/interfaces/authoptions.html#issuerbaseurl) and [audience](http://localhost:8000/docs/interfaces/authoptions.html#audience), which can be configured with environmental variables:
The library requires [issuerBaseURL](https://auth0.github.io/node-oauth2-jwt-bearer/interfaces/authoptions.html#issuerbaseurl) and [audience](https://auth0.github.io/node-oauth2-jwt-bearer/interfaces/authoptions.html#audience), which can be configured with environmental variables:

@@ -35,0 +35,0 @@ ```shell

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc