From cd4fe8a737b55c1c21b0f0937616bcdeca816937 Mon Sep 17 00:00:00 2001 From: Bhumil Sarvaiya Date: Sun, 12 Feb 2023 10:24:04 +0530 Subject: [PATCH] refactor: Package version update (#485) * refactor: package version update for twilio * twilio import update * jsonwebtoken import update * jsonwebtoken import update * version update * changelog update * package-lock.json update --- CHANGELOG.md | 5 +-- .../session/with-jwt/recipeImplementation.js | 6 +-- .../recipe/session/with-jwt/sessionClass.js | 4 +- .../recipe/thirdparty/providers/utils.d.ts | 4 +- .../recipe/thirdparty/providers/utils.js | 40 +------------------ lib/build/version.d.ts | 2 +- lib/build/version.js | 2 +- .../session/with-jwt/recipeImplementation.ts | 6 +-- .../recipe/session/with-jwt/sessionClass.ts | 4 +- lib/ts/recipe/thirdparty/providers/utils.ts | 6 +-- lib/ts/version.ts | 2 +- package-lock.json | 4 +- package.json | 2 +- 13 files changed, 24 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60970eb67..7828a0ced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] -## [13.0.2] - 2023-02-10 +## [13.0.1] - 2023-02-10 - Package version update for twilio to ^4.7.2 and verify-apple-id-token to ^3.0.1 - Package typescript version changed to 4.2 - -## [13.0.1] - 2023-02-06 - - Email template updates ## [13.0.0] - 2023-02-01 diff --git a/lib/build/recipe/session/with-jwt/recipeImplementation.js b/lib/build/recipe/session/with-jwt/recipeImplementation.js index a65a4cc9e..591cab341 100644 --- a/lib/build/recipe/session/with-jwt/recipeImplementation.js +++ b/lib/build/recipe/session/with-jwt/recipeImplementation.js @@ -87,7 +87,7 @@ exports.setJWTExpiryOffsetSecondsForTesting = void 0; * License for the specific language governing permissions and limitations * under the License. */ -const JsonWebToken = __importStar(require("jsonwebtoken")); +const jsonwebtoken_1 = require("jsonwebtoken"); const constants_1 = require("./constants"); const sessionClass_1 = __importDefault(require("./sessionClass")); const assert = __importStar(require("assert")); @@ -120,8 +120,8 @@ function default_1(originalImplementation, openIdRecipeImplementation, config) { let existingJwt = accessTokenPayload[existingJwtPropertyName]; assert.notStrictEqual(existingJwt, undefined); let currentTimeInSeconds = Date.now() / 1000; - let decodedPayload = JsonWebToken.decode(existingJwt, { json: true }); - // JsonWebToken.decode possibly returns null + let decodedPayload = jsonwebtoken_1.decode(existingJwt, { json: true }); + // decode possibly returns null if (decodedPayload === null || decodedPayload.exp === undefined) { throw new Error("Error reading JWT from session"); } diff --git a/lib/build/recipe/session/with-jwt/sessionClass.js b/lib/build/recipe/session/with-jwt/sessionClass.js index d64a1b96c..030197eb6 100644 --- a/lib/build/recipe/session/with-jwt/sessionClass.js +++ b/lib/build/recipe/session/with-jwt/sessionClass.js @@ -86,7 +86,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); * License for the specific language governing permissions and limitations * under the License. */ -const JsonWebToken = __importStar(require("jsonwebtoken")); +const jsonwebtoken_1 = require("jsonwebtoken"); const assert = __importStar(require("assert")); const constants_1 = require("./constants"); const utils_1 = require("./utils"); @@ -201,7 +201,7 @@ class SessionClassWithJWT { let existingJWT = accessTokenPayload[jwtPropertyName]; assert.notStrictEqual(existingJWT, undefined); let currentTimeInSeconds = Date.now() / 1000; - let decodedPayload = JsonWebToken.decode(existingJWT, { json: true }); + let decodedPayload = jsonwebtoken_1.decode(existingJWT, { json: true }); // JsonWebToken.decode possibly returns null if (decodedPayload === null || decodedPayload.exp === undefined) { throw new Error("Error reading JWT from session"); diff --git a/lib/build/recipe/thirdparty/providers/utils.d.ts b/lib/build/recipe/thirdparty/providers/utils.d.ts index 51573e0d8..c3d294df8 100644 --- a/lib/build/recipe/thirdparty/providers/utils.d.ts +++ b/lib/build/recipe/thirdparty/providers/utils.d.ts @@ -1,7 +1,7 @@ // @ts-nocheck -import * as jwt from "jsonwebtoken"; +import { VerifyOptions } from "jsonwebtoken"; export declare function verifyIdTokenFromJWKSEndpoint( idToken: string, jwksUri: string, - otherOptions: jwt.VerifyOptions + otherOptions: VerifyOptions ): Promise; diff --git a/lib/build/recipe/thirdparty/providers/utils.js b/lib/build/recipe/thirdparty/providers/utils.js index 4d159aff8..fbbe76311 100644 --- a/lib/build/recipe/thirdparty/providers/utils.js +++ b/lib/build/recipe/thirdparty/providers/utils.js @@ -1,40 +1,4 @@ "use strict"; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { - enumerable: true, - get: function () { - return m[k]; - }, - }); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } - : function (o, v) { - o["default"] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -73,7 +37,7 @@ var __importDefault = }; Object.defineProperty(exports, "__esModule", { value: true }); exports.verifyIdTokenFromJWKSEndpoint = void 0; -const jwt = __importStar(require("jsonwebtoken")); +const jsonwebtoken_1 = require("jsonwebtoken"); const jwks_rsa_1 = __importDefault(require("jwks-rsa")); function verifyIdTokenFromJWKSEndpoint(idToken, jwksUri, otherOptions) { return __awaiter(this, void 0, void 0, function* () { @@ -87,7 +51,7 @@ function verifyIdTokenFromJWKSEndpoint(idToken, jwksUri, otherOptions) { }); } let payload = yield new Promise((resolve, reject) => { - jwt.verify(idToken, getKey, otherOptions, function (err, decoded) { + jsonwebtoken_1.verify(idToken, getKey, otherOptions, function (err, decoded) { if (err) { reject(err); } else { diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 2e5ff3046..6593a7c99 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1,4 +1,4 @@ // @ts-nocheck -export declare const version = "13.0.2"; +export declare const version = "13.0.1"; export declare const cdiSupported: string[]; export declare const dashboardVersion = "0.3"; diff --git a/lib/build/version.js b/lib/build/version.js index ba464a876..23c0eddb8 100644 --- a/lib/build/version.js +++ b/lib/build/version.js @@ -15,7 +15,7 @@ exports.dashboardVersion = exports.cdiSupported = exports.version = void 0; * License for the specific language governing permissions and limitations * under the License. */ -exports.version = "13.0.2"; +exports.version = "13.0.1"; exports.cdiSupported = ["2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15"]; // Note: The actual script import for dashboard uses v{DASHBOARD_VERSION} exports.dashboardVersion = "0.3"; diff --git a/lib/ts/recipe/session/with-jwt/recipeImplementation.ts b/lib/ts/recipe/session/with-jwt/recipeImplementation.ts index f529fe5d3..9c93652fb 100644 --- a/lib/ts/recipe/session/with-jwt/recipeImplementation.ts +++ b/lib/ts/recipe/session/with-jwt/recipeImplementation.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -import * as JsonWebToken from "jsonwebtoken"; +import { decode } from "jsonwebtoken"; import { RecipeInterface } from "../"; import { RecipeInterface as OpenIdRecipeInterface } from "../../openid/types"; @@ -66,9 +66,9 @@ export default function ( assert.notStrictEqual(existingJwt, undefined); let currentTimeInSeconds = Date.now() / 1000; - let decodedPayload = JsonWebToken.decode(existingJwt, { json: true }); + let decodedPayload = decode(existingJwt, { json: true }); - // JsonWebToken.decode possibly returns null + // decode possibly returns null if (decodedPayload === null || decodedPayload.exp === undefined) { throw new Error("Error reading JWT from session"); } diff --git a/lib/ts/recipe/session/with-jwt/sessionClass.ts b/lib/ts/recipe/session/with-jwt/sessionClass.ts index b7ee08cb2..6d11bf8ca 100644 --- a/lib/ts/recipe/session/with-jwt/sessionClass.ts +++ b/lib/ts/recipe/session/with-jwt/sessionClass.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -import * as JsonWebToken from "jsonwebtoken"; +import { decode } from "jsonwebtoken"; import * as assert from "assert"; import { RecipeInterface as OpenIdRecipeInterface } from "../../openid/types"; @@ -139,7 +139,7 @@ export default class SessionClassWithJWT implements SessionContainerInterface { assert.notStrictEqual(existingJWT, undefined); let currentTimeInSeconds = Date.now() / 1000; - let decodedPayload = JsonWebToken.decode(existingJWT, { json: true }); + let decodedPayload = decode(existingJWT, { json: true }); // JsonWebToken.decode possibly returns null if (decodedPayload === null || decodedPayload.exp === undefined) { diff --git a/lib/ts/recipe/thirdparty/providers/utils.ts b/lib/ts/recipe/thirdparty/providers/utils.ts index e07aecb6a..b81588cee 100644 --- a/lib/ts/recipe/thirdparty/providers/utils.ts +++ b/lib/ts/recipe/thirdparty/providers/utils.ts @@ -1,10 +1,10 @@ -import * as jwt from "jsonwebtoken"; +import { verify, VerifyOptions } from "jsonwebtoken"; import jwksClient from "jwks-rsa"; export async function verifyIdTokenFromJWKSEndpoint( idToken: string, jwksUri: string, - otherOptions: jwt.VerifyOptions + otherOptions: VerifyOptions ): Promise { const client = jwksClient({ jwksUri, @@ -17,7 +17,7 @@ export async function verifyIdTokenFromJWKSEndpoint( } let payload: any = await new Promise((resolve, reject) => { - jwt.verify(idToken, getKey, otherOptions, function (err, decoded) { + verify(idToken, getKey, otherOptions, function (err, decoded) { if (err) { reject(err); } else { diff --git a/lib/ts/version.ts b/lib/ts/version.ts index 532658f6f..50c6e9c2c 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const version = "13.0.2"; +export const version = "13.0.1"; export const cdiSupported = ["2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15"]; diff --git a/package-lock.json b/package-lock.json index d3d7248ba..07cf1a283 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-node", - "version": "13.0.2", + "version": "13.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supertokens-node", - "version": "13.0.2", + "version": "13.0.1", "license": "Apache-2.0", "dependencies": { "axios": "0.21.4", diff --git a/package.json b/package.json index 99be694ac..fe0dbf1ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-node", - "version": "13.0.2", + "version": "13.0.1", "description": "NodeJS driver for SuperTokens core", "main": "index.js", "scripts": {