From 2633ee32ca3a778e8efa05d294308d5cf80041f2 Mon Sep 17 00:00:00 2001 From: Niall McCullagh Date: Thu, 23 Apr 2020 00:13:45 +0100 Subject: [PATCH] fix: jsonwebtoken interface change jsonwebtoken interface changed from string to an enum. BREAKING CHANGE: Algorithm property changes type from string to jsonwebtoken Algorithm --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7386632..9832587 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { verify, decode, VerifyOptions, JsonWebTokenError } from 'jsonwebtoken'; +import { verify, decode, VerifyOptions, Algorithm, VerifyErrors } from 'jsonwebtoken'; import { AuthenticationSuccess, ExegesisPluginContext, @@ -13,7 +13,7 @@ const log = debug('exegesis-cognito'); export interface Options { jwks: Jwks; - algorithms?: string[]; + algorithms?: Algorithm[]; audience?: string | string[]; clockTolerance?: number; issuer?: string | string[]; @@ -158,7 +158,7 @@ function createAuthenticator(options: Options) : Authenticator { verify(token, pem, verifyOptions, - (err: JsonWebTokenError, decoded: string | object) => { + (err: VerifyErrors | null, decoded: object | undefined) => { if (err) { log('Failed to verify', err); done(null, generateErrorResult(err.message));