From c4686d3e826e90af71dccafafa1ea7cfe0781346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dias?= Date: Thu, 27 Jun 2019 23:16:27 +0200 Subject: [PATCH] Fix openid verifyAssertion callback signature (#36487) --- types/openid/index.d.ts | 35 +++++++++++++++++++++-------------- types/openid/openid-tests.ts | 2 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/types/openid/index.d.ts b/types/openid/index.d.ts index 9deea56a6f..03160fea17 100644 --- a/types/openid/index.d.ts +++ b/types/openid/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for openid 2.0 // Project: https://github.com/havard/node-openid // Definitions by: Jacob Stein +// Joao Dias // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.4 @@ -9,19 +10,25 @@ export interface OpenIdError { } export class RelyingParty { - constructor( - returnUrl: string, - realm: string | null, - stateless: boolean, - strict: boolean, - extensions: readonly any[]); + constructor( + returnUrl: string, + realm: string | null, + stateless: boolean, + strict: boolean, + extensions: readonly any[] + ); - authenticate( - identifier: string, - immediate: boolean, - callback: (err: OpenIdError | null, authUrl: string | null) => void): void; + authenticate( + identifier: string, + immediate: boolean, + callback: (err: OpenIdError | null, authUrl: string | null) => void + ): void; - verifyAssertion( - requestOrUrl: object | string, - callback: (err: OpenIdError | null) => void): void; -} + verifyAssertion( + requestOrUrl: object | string, + callback: ( + err: OpenIdError | null, + result?: { authenticated: boolean; claimedIdentifier?: string } + ) => void + ): void; + } diff --git a/types/openid/openid-tests.ts b/types/openid/openid-tests.ts index f65f07e3c5..855617b695 100644 --- a/types/openid/openid-tests.ts +++ b/types/openid/openid-tests.ts @@ -9,4 +9,4 @@ const relyingParty = new openid.RelyingParty( relyingParty.authenticate('...', false, (err, authUrl) => {}); -relyingParty.verifyAssertion('...', (err) => {}); +relyingParty.verifyAssertion('...', (err, result) => {});