Skip to content

Commit

Permalink
refactor: Package version update (#485)
Browse files Browse the repository at this point in the history
* refactor: package version update for twilio

* twilio import update

* jsonwebtoken import update

* jsonwebtoken import update

* version update

* changelog update

* package-lock.json update
  • Loading branch information
bhumilsarvaiya authored Feb 12, 2023
1 parent 6603c3c commit cd4fe8a
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 63 deletions.
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/build/recipe/session/with-jwt/recipeImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions lib/build/recipe/session/with-jwt/sessionClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions lib/build/recipe/thirdparty/providers/utils.d.ts
Original file line number Diff line number Diff line change
@@ -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<any>;
40 changes: 2 additions & 38 deletions lib/build/recipe/thirdparty/providers/utils.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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* () {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/build/version.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/ts/recipe/session/with-jwt/recipeImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ts/recipe/session/with-jwt/sessionClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/ts/recipe/thirdparty/providers/utils.ts
Original file line number Diff line number Diff line change
@@ -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<any> {
const client = jwksClient({
jwksUri,
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit cd4fe8a

Please sign in to comment.