Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "electron build error changes not merged yet in main",
"packageName": "@itwin/electron-authorization",
"email": "pankhur94@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Drop support for core v3 and v4",
"packageName": "@itwin/node-cli-authorization",
"email": "pankhur94@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Drop support for core v3 and v4 and bump oidc-client-ts to latest major",
"packageName": "@itwin/oidc-signin-tool",
"email": "pankhur94@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Drop support for v3 and v4 and bump jwks-rsa to latest major",
"packageName": "@itwin/service-authorization",
"email": "pankhur94@users.noreply.github.com",
"dependentChangeType": "patch"
}
9 changes: 3 additions & 6 deletions packages/electron/src/test/MainAuthorizationClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@

import type { AuthorizationServiceConfiguration, TokenRequest } from "@openid/appauth";
import { BaseTokenRequestHandler } from "@openid/appauth";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as sinon from "sinon";
import chai, { assert, expect } from "chai";
import chaiAsPromised from "chai-as-promised";
import sinon from "sinon";
import { ElectronMainAuthorization } from "../main/Client";
import { RefreshTokenStore } from "../main/TokenStore";
import { getConfig, getMockTokenResponse, setupMockAuthServer, stubTokenCrypto } from "./helpers/testHelper";
/* eslint-disable @typescript-eslint/naming-convention */
const assert = chai.assert;
const expect = chai.expect;

chai.use(chaiAsPromised);

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/electron/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "./node_modules/@itwin/build-tools/tsconfig-base.json",
"compilerOptions": {
"target": "es2021",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": [
"./src/**/*.ts"
Expand Down
10 changes: 5 additions & 5 deletions packages/node-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"directory": "packages/node-cli"
},
"dependencies": {
"@itwin/core-common": "^3.3.0 || ^4.0.0",
"@openid/appauth": "^1.3.1",
"node-persist": "^3.1.3",
"open": "^8.3.0",
"username": "^7.0.0"
},
"devDependencies": {
"@itwin/build-tools": "^4.6.0-dev.27",
"@itwin/core-bentley": "^3.7.0",
"@itwin/build-tools": "rc",
"@itwin/core-bentley": "rc",
"@itwin/core-common": "rc",
"@itwin/eslint-plugin": "^4.0.2",
"@types/chai-as-promised": "^7.1.1",
"@types/chai": "^4.2.22",
Expand All @@ -53,10 +53,10 @@
"rimraf": "^3.0.2",
"sinon": "^15.2.0",
"source-map-support": "^0.5.9",
"typescript": "~5.3.3"
"typescript": "~5.6.2"
},
"peerDependencies": {
"@itwin/core-bentley": "^3.3.0 || ^4.0.0"
"@itwin/core-bentley": "^5.0.0"
},
"eslintConfig": {
"plugins": [
Expand Down
10 changes: 6 additions & 4 deletions packages/node-cli/src/TokenStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import type { TokenResponseJson } from "@openid/appauth";
import { TokenResponse } from "@openid/appauth";
import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from "node:crypto";
import { createCipheriv, createDecipheriv, createSecretKey, randomBytes, scryptSync } from "node:crypto";
import * as path from "node:path";
import * as NodePersist from "node-persist";

Expand Down Expand Up @@ -60,8 +60,9 @@ export class TokenStore {
* @returns an object containing a hexadecimal encoded token, returned as a string, as well as the initialization vector.
*/
private encryptCache(cacheEntry: CacheEntry): { encryptedCache: string, iv: string } {
const iv = randomBytes(16);
const cipher = createCipheriv("aes-256-cbc", this.generateCipherKey(), iv);
const iv = randomBytes(16);;
const key = createSecretKey(new Uint8Array(this.generateCipherKey()));
const cipher = createCipheriv("aes-256-cbc", key, new Uint8Array(iv));

const encryptedCache = cipher.update(JSON.stringify(cacheEntry), "utf8", "hex") + cipher.final("hex");
return {
Expand All @@ -71,7 +72,8 @@ export class TokenStore {
}

private decryptCache(encryptedCache: string, iv: Buffer): string {
const decipher = createDecipheriv("aes-256-cbc", this.generateCipherKey(), iv);
const key = createSecretKey(new Uint8Array(this.generateCipherKey()));
const decipher = createDecipheriv("aes-256-cbc", key, new Uint8Array(iv));
const decryptedCache = decipher.update(encryptedCache, "hex", "utf8") + decipher.final("utf8");
return decryptedCache;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/oidc-signin-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
"url": "http://www.bentley.com"
},
"dependencies": {
"@itwin/certa": "^3.7.0 || ^4.0.0",
"@itwin/core-common": "^3.3.0 || ^4.0.0",
"@itwin/certa": "rc",
"@itwin/service-authorization": "workspace:^",
"@playwright/test": "~1.48.2",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"oidc-client-ts": "^2.4.0"
"oidc-client-ts": "^3.1.0"
},
"devDependencies": {
"@itwin/build-tools": "^4.6.0-dev.27",
"@itwin/core-bentley": "^3.7.0",
"@itwin/build-tools": "rc",
"@itwin/core-bentley": "rc",
"@itwin/core-common": "rc",
"@itwin/eslint-plugin": "^4.0.2",
"@types/chai": "^4.2.22",
"@types/chai-as-promised": "^7.1.1",
Expand All @@ -58,9 +58,9 @@
"nyc": "^17.0.0",
"rimraf": "^3.0.2",
"sinon": "15.0.4",
"typescript": "~5.3.3"
"typescript": "~5.6.2"
},
"peerDependencies": {
"@itwin/core-bentley": "^3.3.0 || ^4.0.0"
"@itwin/core-bentley": "^5.0.0"
}
}
13 changes: 6 additions & 7 deletions packages/service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
"directory": "packages/service"
},
"dependencies": {
"@itwin/core-common": "^3.3.0 || ^4.0.0",
"@itwin/core-geometry": "^3.3.0 || ^4.0.0",
"got": "^12.6.1",
"jsonwebtoken": "^9.0.0",
"jwks-rsa": "^2.0.4"
"jwks-rsa": "^3.1.0"
},
"devDependencies": {
"@itwin/build-tools": "^4.6.0-dev.27",
"@itwin/core-bentley": "^3.7.0",
"@itwin/build-tools": "rc",
"@itwin/core-bentley": "rc",
"@itwin/core-common": "rc",
"@itwin/eslint-plugin": "^4.0.2",
"@types/chai": "^4.2.22",
"@types/chai-as-promised": "^7.1.1",
Expand All @@ -50,9 +49,9 @@
"rimraf": "^3.0.2",
"sinon": "^15.0.1",
"source-map-support": "^0.5.9",
"typescript": "~5.3.3"
"typescript": "~5.6.2"
},
"peerDependencies": {
"@itwin/core-bentley": "^3.3.0 || ^4.0.0"
"@itwin/core-bentley": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/service/src/OIDCDiscoveryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function assertOIDCConfig(obj: any): asserts obj is OIDCConfig {
throw new Error(`Invalid OIDC discovery response: '${prop}' must be a boolean.`);
}
for (const prop of arrayProperties) {
if (prop in obj && (!Array.isArray(obj[prop]) || (obj[prop] as any[]).some((str) => typeof str !== "string")))
if (prop in obj && (!Array.isArray(obj[prop]) || obj[prop].some((str) => typeof str !== "string")))
throw new Error(`Invalid OIDC discovery response: '${prop}' must be a boolean.`);
}
}
Expand Down
Loading
Loading