UNPKG

@azure/msal-node-extensions

Version:

![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-node-extensions) ![npm](https://img.shields.io/npm/dw/@azure/msal-node-extensions)

37 lines (34 loc) 1.69 kB
/*! @azure/msal-node-extensions v1.5.9 2025-03-25 */ 'use strict'; import { PersistenceError } from '../error/PersistenceError.mjs'; import { Constants } from '../utils/Constants.mjs'; /* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ class BasePersistence { async verifyPersistence() { // We are using a different location for the test to avoid overriding the functional cache const persistenceValidator = await this.createForPersistenceValidation(); try { await persistenceValidator.save(Constants.PERSISTENCE_TEST_DATA); const retrievedDummyData = await persistenceValidator.load(); if (!retrievedDummyData) { throw PersistenceError.createCachePersistenceError("Persistence check failed. Data was written but it could not be read. " + "Possible cause: on Linux, LibSecret is installed but D-Bus isn't running \ because it cannot be started over SSH."); } if (retrievedDummyData !== Constants.PERSISTENCE_TEST_DATA) { throw PersistenceError.createCachePersistenceError(`Persistence check failed. Data written ${Constants.PERSISTENCE_TEST_DATA} is different \ from data read ${retrievedDummyData}`); } await persistenceValidator.delete(); return true; } catch (e) { throw PersistenceError.createCachePersistenceError(`Verifing persistence failed with the error: ${e}`); } } } export { BasePersistence }; //# sourceMappingURL=BasePersistence.mjs.map