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

@fastify/auth

Package Overview
Dependencies
Maintainers
20
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/auth - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

54

auth.d.ts

@@ -1,27 +0,7 @@

import { ContextConfigDefault, FastifyInstance, FastifyPluginCallback, FastifyReply, FastifyRequest, FastifySchema, preHandlerHookHandler } from 'fastify';
import { RouteGenericInterface } from 'fastify/types/route';
import { ContextConfigDefault, RouteGenericInterface, FastifyInstance, FastifyPluginCallback, FastifyReply, FastifyRequest, FastifySchema, preHandlerHookHandler } from 'fastify';
export type FastifyAuthFunction = (
this: FastifyInstance,
request: FastifyRequest,
reply: FastifyReply,
done: (error?: Error) => void
) => void;
/**
* @link [`fastify-auth` options documentation](https://github.com/fastify/fastify-auth#options)
*/
export interface FastifyAuthPluginOptions {
/**
* The default relation between the functions. It can be either `or` or `and`.
*
* - Default value: `or`
*/
defaultRelation?: 'and' | 'or',
}
declare module 'fastify' {
interface FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> {
auth(
functions: FastifyAuthFunction[],
functions: fastifyAuth.FastifyAuthFunction[],
options?: {

@@ -35,3 +15,29 @@ relation?: 'and' | 'or',

declare const fastifyAuth: FastifyPluginCallback<FastifyAuthPluginOptions>
export default fastifyAuth;
type FastifyAuth = FastifyPluginCallback<fastifyAuth.FastifyAuthPluginOptions>
declare namespace fastifyAuth {
export type FastifyAuthFunction = (
this: FastifyInstance,
request: FastifyRequest,
reply: FastifyReply,
done: (error?: Error) => void
) => void;
/**
* @link [`fastify-auth` options documentation](https://github.com/fastify/fastify-auth#options)
*/
export interface FastifyAuthPluginOptions {
/**
* The default relation between the functions. It can be either `or` or `and`.
*
* - Default value: `or`
*/
defaultRelation?: 'and' | 'or',
}
export const fastifyAuth: FastifyAuth
export { fastifyAuth as default }
}
declare function fastifyAuth(...params: Parameters<FastifyAuth>): ReturnType<FastifyAuth>
export = fastifyAuth

@@ -8,3 +8,3 @@ 'use strict'

function checkAuth (fastify, opts, next) {
function fastifyAuth (fastify, opts, next) {
if (opts.defaultRelation && opts.defaultRelation !== 'or' && opts.defaultRelation !== 'and') {

@@ -136,5 +136,7 @@ return next(new Error("The value of default relation should be one of ['or', 'and']"))

module.exports = fp(checkAuth, {
module.exports = fp(fastifyAuth, {
fastify: '4.x',
name: '@fastify/auth'
})
module.exports.default = fastifyAuth
module.exports.fastifyAuth = fastifyAuth
{
"name": "@fastify/auth",
"version": "4.1.0",
"version": "4.2.0",
"description": "Run multiple auth functions in Fastify",

@@ -5,0 +5,0 @@ "repository": {

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