New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fastify-openid-auth

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-openid-auth - npm Package Compare versions

Comparing version 5.1.0 to 6.0.0

dist/fastify-openid-auth-6.0.0.tgz

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# [6.0.0](https://github.com/mikaelkaron/fastify-openid-auth/compare/v5.1.0...v6.0.0) (2023-07-05)
### Features
* simplify return type of `openIDJWTVerify` ([54ed7f7](https://github.com/mikaelkaron/fastify-openid-auth/commit/54ed7f759b3200780084c8e3af4d32d322f70a86))
### BREAKING CHANGES
* now returns `OpenIDJWTVerified` object instead of `Map<OpenIDTokens, JWTVerifyResult>`
# [5.1.0](https://github.com/mikaelkaron/fastify-openid-auth/compare/v5.0.0...v5.1.0) (2023-07-04)

@@ -2,0 +14,0 @@

5

dist/types.d.ts

@@ -5,3 +5,6 @@ import { type FastifyInstance, type FastifyReply, type FastifyRequest } from 'fastify';

export type OpenIDTokens = keyof Pick<TokenSetParameters, 'id_token' | 'access_token' | 'refresh_token'>;
export type OpenIDJWTVerified = {
[key in OpenIDTokens]?: JWTVerifyResult;
};
export type OpenIDReadTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply) => Promise<TokenSetParameters> | TokenSetParameters;
export type OpenIDWriteTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply, tokenset: TokenSetParameters, verified?: Map<OpenIDTokens, JWTVerifyResult>) => Promise<void> | void;
export type OpenIDWriteTokens = (this: FastifyInstance, request: FastifyRequest, reply: FastifyReply, tokenset: TokenSetParameters, verified?: OpenIDJWTVerified) => Promise<void> | void;

6

dist/verify.d.ts
import { type RouteHandlerMethod } from 'fastify';
import { type JWTVerifyGetKey, type JWTVerifyOptions, type JWTVerifyResult, type KeyLike } from 'jose';
import { type JWTVerifyGetKey, type JWTVerifyOptions, type KeyLike } from 'jose';
import { type TokenSetParameters } from 'openid-client';
import { type OpenIDReadTokens, type OpenIDTokens, type OpenIDWriteTokens } from './types';
import { type OpenIDJWTVerified, type OpenIDReadTokens, type OpenIDTokens, type OpenIDWriteTokens } from './types';
export interface OpenIDVerifyOptions {

@@ -10,3 +10,3 @@ options?: JWTVerifyOptions;

}
export type OpenIDJWTVerify = (tokenset: TokenSetParameters, options: OpenIDVerifyOptions) => Promise<Map<OpenIDTokens, JWTVerifyResult>>;
export type OpenIDJWTVerify = (tokenset: TokenSetParameters, options: OpenIDVerifyOptions) => Promise<OpenIDJWTVerified>;
export declare const openIDJWTVerify: OpenIDJWTVerify;

@@ -13,0 +13,0 @@ export interface OpenIDVerifyHandlerOptions extends OpenIDVerifyOptions {

@@ -6,3 +6,3 @@ "use strict";

const openIDJWTVerify = async (tokenset, { key, options, tokens }) => {
const verified = new Map();
const verified = {};
for (const token of tokens) {

@@ -14,3 +14,3 @@ const jwt = tokenset[token];

: await (0, jose_1.jwtVerify)(jwt, key, options);
verified.set(token, result);
verified[token] = result;
}

@@ -17,0 +17,0 @@ }

{
"name": "fastify-openid-auth",
"version": "5.1.0",
"version": "6.0.0",
"description": "Fastify auth plugin for openid-client",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -10,2 +10,5 @@ import { type FastifyInstance, type FastifyReply, type FastifyRequest } from 'fastify'

export type OpenIDJWTVerified = {
[key in OpenIDTokens]?: JWTVerifyResult
}
export type OpenIDReadTokens = (

@@ -22,3 +25,3 @@ this: FastifyInstance,

tokenset: TokenSetParameters,
verified?: Map<OpenIDTokens, JWTVerifyResult>
verified?: OpenIDJWTVerified
) => Promise<void> | void
import { type RouteHandlerMethod } from 'fastify'
import { jwtVerify, type JWTVerifyGetKey, type JWTVerifyOptions, type JWTVerifyResult, type KeyLike } from 'jose'
import { jwtVerify, type JWTVerifyGetKey, type JWTVerifyOptions, type KeyLike } from 'jose'
import { type TokenSetParameters } from 'openid-client'
import { type OpenIDReadTokens, type OpenIDTokens, type OpenIDWriteTokens } from './types'
import { type OpenIDJWTVerified, type OpenIDReadTokens, type OpenIDTokens, type OpenIDWriteTokens } from './types'

@@ -12,6 +12,6 @@ export interface OpenIDVerifyOptions {

export type OpenIDJWTVerify = (tokenset: TokenSetParameters, options: OpenIDVerifyOptions) => Promise<Map<OpenIDTokens, JWTVerifyResult>>
export type OpenIDJWTVerify = (tokenset: TokenSetParameters, options: OpenIDVerifyOptions) => Promise<OpenIDJWTVerified>
export const openIDJWTVerify: OpenIDJWTVerify = async (tokenset, { key, options, tokens }) => {
const verified = new Map<OpenIDTokens, JWTVerifyResult>()
const verified: OpenIDJWTVerified = {}
for (const token of tokens) {

@@ -23,3 +23,3 @@ const jwt = tokenset[token]

: await jwtVerify(jwt, key, options)
verified.set(token, result)
verified[token] = result
}

@@ -26,0 +26,0 @@ }

Sorry, the diff of this file is not supported yet

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