Socket
Socket
Sign inDemoInstall

@types/passport

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/passport - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

95

passport/index.d.ts
// Type definitions for Passport 0.4
// Project: http://passportjs.org
// Definitions by: Horiuchi_H <https://github.com/horiuchi>, Eric Naeseth <https://github.com/enaeseth>, Igor Belagorudsky <https://github.com/theigor>
// Definitions by: Horiuchi_H <https://github.com/horiuchi>
// Eric Naeseth <https://github.com/enaeseth>
// Igor Belagorudsky <https://github.com/theigor>
// Tomek Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -34,10 +37,10 @@ // TypeScript Version: 2.3

assignProperty?: string;
failureFlash?: string|boolean;
failureMessage?: boolean|string;
failureFlash?: string | boolean;
failureMessage?: boolean | string;
failureRedirect?: string;
failWithError?: boolean;
session?: boolean;
scope?: string|string[];
successFlash?: string|boolean;
successMessage?: boolean|string;
scope?: string | string[];
successFlash?: string | boolean;
successMessage?: boolean | string;
successRedirect?: string;

@@ -50,14 +53,14 @@ successReturnToOrRedirect?: string;

interface Passport {
interface Authenticator<InitializeRet = express.Handler, AuthenticateRet = any, AuthorizeRet = AuthenticateRet> {
use(strategy: Strategy): this;
use(name: string, strategy: Strategy): this;
unuse(name: string): this;
framework(fw: Framework): this;
initialize(options?: { userProperty: string; }): express.Handler;
session(options?: { pauseStream: boolean; }): express.Handler;
framework<X, Y, Z>(fw: Framework<X, Y, Z>): Authenticator<X, Y, Z>;
initialize(options?: { userProperty: string; }): InitializeRet;
session(options?: { pauseStream: boolean; }): AuthenticateRet;
authenticate(strategy: string|string[], callback?: (...args: any[]) => any): express.Handler;
authenticate(strategy: string|string[], options: AuthenticateOptions, callback?: (...args: any[]) => any): express.Handler;
authorize(strategy: string|string[], callback?: (...args: any[]) => any): express.Handler;
authorize(strategy: string|string[], options: any, callback?: (...args: any[]) => any): express.Handler;
authenticate(strategy: string | string[], callback?: (...args: any[]) => any): AuthenticateRet;
authenticate(strategy: string | string[], options: AuthenticateOptions, callback?: (...args: any[]) => any): AuthenticateRet;
authorize(strategy: string | string[], callback?: (...args: any[]) => any): AuthorizeRet;
authorize(strategy: string | string[], options: any, callback?: (...args: any[]) => any): AuthorizeRet;
serializeUser<TUser, TID>(fn: (user: TUser, done: (err: any, id?: TID) => void) => void): void;

@@ -68,5 +71,5 @@ deserializeUser<TUser, TID>(fn: (id: TID, done: (err: any, user?: TUser) => void) => void): void;

interface PassportStatic extends Passport {
Passport: {new(): Passport};
Authenticator: {new(): Passport};
interface PassportStatic extends Authenticator {
Authenticator: { new(): Authenticator };
Passport: PassportStatic["Authenticator"];
}

@@ -76,5 +79,53 @@

name?: string;
authenticate(req: express.Request, options?: any): void;
authenticate(this: StrategyCreated<this>, req: express.Request, options?: any): any;
}
interface StrategyCreatedStatic {
/**
* Authenticate `user`, with optional `info`.
*
* Strategies should call this function to successfully authenticate a
* user. `user` should be an object supplied by the application after it
* has been given an opportunity to verify credentials. `info` is an
* optional argument containing additional user information. This is
* useful for third-party authentication strategies to pass profile
* details.
*/
success(user: object, info?: object): void;
/**
* Fail authentication, with optional `challenge` and `status`, defaulting
* to 401.
*
* Strategies should call this function to fail an authentication attempt.
*/
fail(challenge?: string | number, status?: number): void;
/**
* Redirect to `url` with optional `status`, defaulting to 302.
*
* Strategies should call this function to redirect the user (via their
* user agent) to a third-party website for authentication.
*/
redirect(url: string, status?: number): void;
/**
* Pass without making a success or fail decision.
*
* Under most circumstances, Strategies should not need to call this
* function. It exists primarily to allow previous authentication state
* to be restored, for example from an HTTP session.
*/
pass(): void;
/**
* Internal error while performing authentication.
*
* Strategies should call this function when an internal error occurs
* during the process of performing authentication; for example, if the
* user directory is not available.
*/
error(err: any): void;
}
type StrategyCreated<T, O = T & StrategyCreatedStatic> = {
[P in keyof O]: O[P];
};
interface Profile {

@@ -99,6 +150,6 @@ provider: string;

interface Framework {
initialize(passport: Passport, options?: any): (...args: any[]) => any;
authenticate(passport: Passport, name: string, options?: any, callback?: (...args: any[]) => any): (...args: any[]) => any;
authorize?(passport: Passport, name: string, options?: any, callback?: (...args: any[]) => any): (...args: any[]) => any;
interface Framework<InitializeRet = any, AuthenticateRet = any, AuthorizeRet = AuthenticateRet> {
initialize(passport: Authenticator<InitializeRet, AuthenticateRet, AuthorizeRet>, options?: any): (...args: any[]) => InitializeRet;
authenticate(passport: Authenticator<InitializeRet, AuthenticateRet, AuthorizeRet>, name: string, options?: any, callback?: (...args: any[]) => any): (...args: any[]) => AuthenticateRet;
authorize?(passport: Authenticator<InitializeRet, AuthenticateRet, AuthorizeRet>, name: string, options?: any, callback?: (...args: any[]) => any): (...args: any[]) => AuthorizeRet;
}

@@ -105,0 +156,0 @@ }

{
"name": "@types/passport",
"version": "0.4.1",
"version": "0.4.2",
"description": "TypeScript definitions for Passport",

@@ -21,2 +21,7 @@ "license": "MIT",

"githubUsername": "theigor"
},
{
"name": "Tomek Łaziuk",
"url": "https://github.com/tlaziuk",
"githubUsername": "tlaziuk"
}

@@ -33,4 +38,4 @@ ],

},
"typesPublisherContentHash": "f31cad980213e28363246861a62317718eba22a1e783655b0d8b98fcc00a459f",
"typesPublisherContentHash": "bd4ab828d1b554fad1bb047fe2b26b283d64ff9da8054f5fdabbcea8f3d087f1",
"typeScriptVersion": "2.3"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Thu, 09 Nov 2017 22:14:16 GMT
* Last updated: Fri, 15 Dec 2017 19:06:41 GMT
* Dependencies: express

@@ -17,2 +17,2 @@ * Global values: none

# Credits
These definitions were written by Horiuchi_H <https://github.com/horiuchi>, Eric Naeseth <https://github.com/enaeseth>, Igor Belagorudsky <https://github.com/theigor>.
These definitions were written by Horiuchi_H <https://github.com/horiuchi>, Eric Naeseth <https://github.com/enaeseth>, Igor Belagorudsky <https://github.com/theigor>, Tomek Łaziuk <https://github.com/tlaziuk>.

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