diff --git a/change/@azure-msal-node-extensions-25a8325b-07d2-4bf8-91b6-ed1140578fdf.json b/change/@azure-msal-node-extensions-25a8325b-07d2-4bf8-91b6-ed1140578fdf.json new file mode 100644 index 0000000000..444b032dd9 --- /dev/null +++ b/change/@azure-msal-node-extensions-25a8325b-07d2-4bf8-91b6-ed1140578fdf.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Fix downstream ESM imports, fixes #6573", + "packageName": "@azure/msal-node-extensions", + "email": "janusz@corechain.tech", + "dependentChangeType": "patch" +} diff --git a/extensions/msal-node-extensions/src/persistence/KeychainPersistence.ts b/extensions/msal-node-extensions/src/persistence/KeychainPersistence.ts index 1fbfaf65ff..6b27b9ed02 100644 --- a/extensions/msal-node-extensions/src/persistence/KeychainPersistence.ts +++ b/extensions/msal-node-extensions/src/persistence/KeychainPersistence.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { setPassword, getPassword, deletePassword } from "keytar"; +import keytar from "keytar"; import { FilePersistence } from "./FilePersistence"; import { IPersistence } from "./IPersistence"; import { PersistenceError } from "../error/PersistenceError"; @@ -57,7 +57,11 @@ export class KeychainPersistence public async save(contents: string): Promise { try { - await setPassword(this.serviceName, this.accountName, contents); + await keytar.setPassword( + this.serviceName, + this.accountName, + contents + ); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createKeychainPersistenceError( @@ -73,7 +77,7 @@ export class KeychainPersistence public async load(): Promise { try { - return await getPassword(this.serviceName, this.accountName); + return await keytar.getPassword(this.serviceName, this.accountName); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createKeychainPersistenceError( @@ -88,7 +92,10 @@ export class KeychainPersistence public async delete(): Promise { try { await this.filePersistence.delete(); - return await deletePassword(this.serviceName, this.accountName); + return await keytar.deletePassword( + this.serviceName, + this.accountName + ); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createKeychainPersistenceError( diff --git a/extensions/msal-node-extensions/src/persistence/LibSecretPersistence.ts b/extensions/msal-node-extensions/src/persistence/LibSecretPersistence.ts index 6dd1c3d94a..78d1b9f430 100644 --- a/extensions/msal-node-extensions/src/persistence/LibSecretPersistence.ts +++ b/extensions/msal-node-extensions/src/persistence/LibSecretPersistence.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { setPassword, getPassword, deletePassword } from "keytar"; +import keytar from "keytar"; import { FilePersistence } from "./FilePersistence"; import { IPersistence } from "./IPersistence"; import { PersistenceError } from "../error/PersistenceError"; @@ -58,7 +58,11 @@ export class LibSecretPersistence public async save(contents: string): Promise { try { - await setPassword(this.serviceName, this.accountName, contents); + await keytar.setPassword( + this.serviceName, + this.accountName, + contents + ); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createLibSecretError(err.message); @@ -72,7 +76,7 @@ export class LibSecretPersistence public async load(): Promise { try { - return await getPassword(this.serviceName, this.accountName); + return await keytar.getPassword(this.serviceName, this.accountName); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createLibSecretError(err.message); @@ -85,7 +89,10 @@ export class LibSecretPersistence public async delete(): Promise { try { await this.filePersistence.delete(); - return await deletePassword(this.serviceName, this.accountName); + return await keytar.deletePassword( + this.serviceName, + this.accountName + ); } catch (err) { if (isNodeError(err)) { throw PersistenceError.createLibSecretError(err.message);