passbolt-browser-extension 5.17.0 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pre-commit-config.yaml +6 -2
- package/CHANGELOG.md +106 -1
- package/README.md +2 -2
- package/RELEASE_NOTES.md +3 -94
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager/ViewController.swift +5 -5
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager.xcodeproj/project.pbxproj +10 -10
- package/eslint.config.mjs +3 -35
- package/jest.config.json +1 -2
- package/package.json +45 -54
- package/src/all/_locales/locales.test.js +2 -0
- package/src/all/background_page/controller/InformMenuController/InformMenuController.test.js +45 -1
- package/src/all/background_page/controller/accountRecovery/accountRecoverySaveUserSettingController.js +1 -2
- package/src/all/background_page/controller/accountRecovery/accountRecoverySaveUserSettingController.test.js +10 -8
- package/src/all/background_page/controller/accountRecovery/accountRecoveryValidatePublicKeyController.test.js +1 -1
- package/src/all/background_page/controller/auth/authLocalLogoutController.js +3 -14
- package/src/all/background_page/controller/auth/authLocalLogoutController.test.js +3 -3
- package/src/all/background_page/controller/auth/authLoginController.js +2 -2
- package/src/all/background_page/controller/auth/authOfflineLogoutController.js +4 -12
- package/src/all/background_page/controller/auth/authOfflineLogoutController.test.js +3 -3
- package/src/all/background_page/controller/auth/{findAndUpdateActiveSessionLocalStorageController.js → findAndUpdateActiveSessionSessionStorageController.js} +6 -6
- package/src/all/background_page/controller/auth/{findAndUpdateActiveSessionLocalStorageController.test.js → findAndUpdateActiveSessionSessionStorageController.test.js} +30 -30
- package/src/all/background_page/controller/auth/getOrFindActiveSessionController.test.js +22 -20
- package/src/all/background_page/controller/auth/isMfaRequiredController.js +5 -4
- package/src/all/background_page/controller/auth/isMfaRequiredController.test.js +3 -3
- package/src/all/background_page/controller/crypto/getUserKeyInfoController.test.js +1 -1
- package/src/all/background_page/controller/crypto/getUserPrivateKeyController.test.js +1 -1
- package/src/all/background_page/controller/extension/onExtensionInstalledController.js +61 -30
- package/src/all/background_page/controller/extension/onExtensionInstalledController.test.js +131 -19
- package/src/all/background_page/controller/informCallToActionController/informCallToActionController.test.js +46 -0
- package/src/all/background_page/controller/resource/setResourcesExpiryDateController.test.js +1 -1
- package/src/all/background_page/controller/sessionTimestamps/getSessionTimestampsController.js +54 -0
- package/src/all/background_page/controller/sessionTimestamps/getSessionTimestampsController.test.js +91 -0
- package/src/all/background_page/controller/share/shareResourcesController.test.js +2 -2
- package/src/all/background_page/controller/sso/getQualifiedSsoLoginErrorController.test.js +1 -1
- package/src/all/background_page/controller/sso/hasSsoLoginErrorController.test.js +1 -1
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.js +3 -3
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.test.js +4 -4
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.js +3 -3
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.test.js +4 -4
- package/src/all/background_page/controller/theme/findThemesController.js +52 -0
- package/src/all/background_page/controller/theme/findThemesController.test.js +68 -0
- package/src/all/background_page/controller/theme/updateThemeController.js +55 -0
- package/src/all/background_page/controller/theme/updateThemeController.test.js +76 -0
- package/src/all/background_page/controller/user/getOrFindLoggedInUserController.test.js +2 -2
- package/src/all/background_page/event/appEvents.js +1 -26
- package/src/all/background_page/event/authEvents.js +2 -2
- package/src/all/background_page/event/configEvents.js +0 -12
- package/src/all/background_page/event/informMenuEvents.js +2 -2
- package/src/all/background_page/event/quickAccessEvents.js +12 -0
- package/src/all/background_page/event/themeEvents.js +9 -21
- package/src/all/background_page/model/auth/authModel.js +3 -3
- package/src/all/background_page/model/auth/authModel.test.js +2 -2
- package/src/all/background_page/model/entity/export/exportResourcesFileEntity.js +2 -0
- package/src/all/background_page/model/entity/export/exportResourcesFileEntity.test.js +1 -0
- package/src/all/background_page/model/entity/import/importResourcesFileEntity.test.data.js +5 -0
- package/src/all/background_page/model/entity/sso/ssoLoginUrlEntity.js +1 -1
- package/src/all/background_page/model/entity/theme/themeEntity.test.data.js +12 -0
- package/src/all/background_page/model/entity/theme/themesCollection.test.data.js +10 -1
- package/src/all/background_page/model/export/resources/csvRowComposer/abstractRowComposer.js +8 -0
- package/src/all/background_page/model/export/resources/csvRowComposer/csvNetwrixRowComposer.js +67 -0
- package/src/all/background_page/model/export/resources/csvRowComposer/csvNetwrixRowComposer.test.js +37 -0
- package/src/all/background_page/model/export/resources/resourcesCsvExporter.js +5 -2
- package/src/all/background_page/model/export/resources/resourcesCsvExporter.test.js +3 -1
- package/src/all/background_page/model/import/resources/csvRowParser/csvNetwrixRowParser.js +98 -0
- package/src/all/background_page/model/import/resources/csvRowParser/csvNetwrixRowParser.test.js +145 -0
- package/src/all/background_page/model/import/resources/resourcesCsvImportParser.js +2 -0
- package/src/all/background_page/model/import/resources/resourcesCsvImportParser.test.js +19 -1
- package/src/all/background_page/model/keyring.test.js +1 -1
- package/src/all/background_page/model/multiFactorAuthentication/multiFactorAuthenticationModel.test.js +1 -1
- package/src/all/background_page/model/user/userModel.test.js +1 -1
- package/src/all/background_page/model/user.js +2 -2
- package/src/all/background_page/model/userSettings/userSettings.js +1 -1
- package/src/all/background_page/pagemod/appBootstrapPagemod.js +6 -5
- package/src/all/background_page/pagemod/appBootstrapPagemod.test.js +7 -12
- package/src/all/background_page/pagemod/authBootstrapPagemod.js +2 -2
- package/src/all/background_page/pagemod/authBootstrapPagemod.test.js +6 -7
- package/src/all/background_page/pagemod/pagemodManager.test.js +14 -20
- package/src/all/background_page/pagemod/webIntegrationPagemod.js +2 -2
- package/src/all/background_page/pagemod/webIntegrationPagemod.test.js +9 -9
- package/src/all/background_page/service/accountRecovery/decryptPrivateKeyPasswordDataService.js +1 -1
- package/src/all/background_page/service/accountRecovery/decryptResponseDataService.js +1 -1
- package/src/all/background_page/service/accountRecovery/parseAccountRecoveryUrlService.js +1 -1
- package/src/all/background_page/service/accountRecovery/validateOrganizationPublicKeyService.test.js +1 -1
- package/src/all/background_page/service/activeSession/{findAndUpdateActiveSessionLocalStorageService.js → findAndUpdateActiveSessionSessionStorageService.js} +27 -60
- package/src/all/background_page/service/activeSession/findAndUpdateActiveSessionSessionStorageService.test.js +720 -0
- package/src/all/background_page/service/activeSession/getOrFindActiveSessionService.js +8 -8
- package/src/all/background_page/service/activeSession/getOrFindActiveSessionService.test.js +16 -16
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.js +0 -29
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.test.data.js +0 -6
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.test.js +1 -32
- package/src/all/background_page/service/api/actionLog/actionLogApiService.test.js +1 -1
- package/src/all/background_page/service/api/comment/commentApiService.test.js +1 -1
- package/src/all/background_page/service/api/metadata/metadataKeysApiService.test.js +1 -1
- package/src/all/background_page/service/api/sessionKey/sessionKeysBundlesApiService.test.js +1 -1
- package/src/all/background_page/service/api/theme/themesApiService.js +57 -0
- package/src/all/background_page/service/api/theme/themesApiService.test.js +83 -0
- package/src/all/background_page/service/app/parseAppUrlService.js +18 -10
- package/src/all/background_page/service/app/parseAppUrlService.test.js +21 -21
- package/src/all/background_page/service/auth/localLogoutService.js +42 -0
- package/src/all/background_page/service/auth/localLogoutService.test.js +43 -0
- package/src/all/background_page/service/auth/offlineLogoutService.js +47 -0
- package/src/all/background_page/service/auth/offlineLogoutService.test.js +46 -0
- package/src/all/background_page/service/auth/offlineSessionExpiryAlarmService.js +2 -2
- package/src/all/background_page/service/auth/offlineSessionExpiryAlarmService.test.js +3 -3
- package/src/all/background_page/service/auth/parseAuthUrlService.js +11 -6
- package/src/all/background_page/service/auth/parseAuthUrlService.test.js +11 -13
- package/src/all/background_page/service/auth/postLoginOfflineService.js +3 -3
- package/src/all/background_page/service/auth/postLoginOfflineService.test.js +3 -3
- package/src/all/background_page/service/auth/postLoginService.js +3 -3
- package/src/all/background_page/service/auth/postLoginService.test.js +3 -3
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.js +8 -4
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.test.js +36 -13
- package/src/all/background_page/service/authenticationStatusService.test.js +1 -1
- package/src/all/background_page/service/clipboard/clipboardProviderService.js +0 -7
- package/src/all/background_page/service/clipboard/clipboardProviderService.test.js +0 -10
- package/src/all/background_page/service/clipboard/copyToClipboardService.js +1 -5
- package/src/all/background_page/service/crypto/decryptSsoPassphraseService.js +1 -1
- package/src/all/background_page/service/extension/onStartUpService.js +2 -2
- package/src/all/background_page/service/extension/onStartUpService.test.js +3 -3
- package/src/all/background_page/service/localStorage/localStorageService.js +4 -2
- package/src/all/background_page/service/localStorage/localStorageService.test.js +28 -12
- package/src/all/background_page/service/local_storage/sessionTimestampsLocalStorage.js +40 -0
- package/src/all/background_page/service/local_storage/sessionTimestampsLocalStorage.test.js +63 -0
- package/src/all/background_page/service/metadata/rotateMetadata/rotateMetadataKeyService.test.js +2 -2
- package/src/all/background_page/service/metadata/rotateMetadata/rotateResourcesMetadataKeyService.test.js +2 -2
- package/src/all/background_page/service/migrateMetadata/migrateMetadataResourcesService.test.js +2 -2
- package/src/all/background_page/service/offline/canUseOfflineStorageService.js +16 -1
- package/src/all/background_page/service/offline/canUseOfflineStorageService.test.js +14 -6
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.js +4 -1
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.test.js +10 -1
- package/src/all/background_page/service/offline/offlineRetentionDataFlushService.js +12 -9
- package/src/all/background_page/service/offline/offlineRetentionDataFlushService.test.js +35 -24
- package/src/all/background_page/service/rbac/getOrFindRbacService.js +4 -1
- package/src/all/background_page/service/recover/parseRecoverUrlService.js +1 -1
- package/src/all/background_page/service/resource/export/exportResourcesService.test.js +3 -0
- package/src/all/background_page/service/resource/getOrFindOfflineResourcesService.js +30 -10
- package/src/all/background_page/service/resource/getOrFindOfflineResourcesService.test.js +108 -9
- package/src/all/background_page/service/resource/getOrFindResourcesService.js +30 -10
- package/src/all/background_page/service/resource/getOrFindResourcesService.test.js +99 -9
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.js +4 -1
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.test.js +10 -2
- package/src/all/background_page/service/secret/decryptAndParseResourceSecretService.js +1 -1
- package/src/all/background_page/service/sessionTimestamps/getSessionTimestampsService.js +48 -0
- package/src/all/background_page/service/sessionTimestamps/getSessionTimestampsService.test.js +66 -0
- package/src/all/background_page/service/sessionTimestamps/updateSessionTimestampsService.js +102 -0
- package/src/all/background_page/service/sessionTimestamps/updateSessionTimestampsService.test.js +221 -0
- package/src/all/background_page/service/{local_storage/activeSessionLocalStorage.js → session_storage/activeSessionSessionStorage.js} +17 -17
- package/src/all/background_page/service/{local_storage/activeSessionLocalStorage.test.js → session_storage/activeSessionSessionStorage.test.js} +31 -34
- package/src/all/background_page/service/setup/parseSetupUrlService.js +3 -2
- package/src/all/background_page/service/setup/parseSetupUrlService.test.js +195 -24
- package/src/all/background_page/service/share/shareFoldersService.test.js +4 -4
- package/src/all/background_page/service/share/shareResourceService.test.js +4 -4
- package/src/all/background_page/service/theme/findThemesService.js +38 -0
- package/src/all/background_page/service/theme/findThemesService.test.js +63 -0
- package/src/all/background_page/service/theme/updateThemeService.js +39 -0
- package/src/all/background_page/service/theme/updateThemeService.test.js +65 -0
- package/src/all/background_page/service/toolbar/toolbarService.js +20 -10
- package/src/all/background_page/service/toolbar/toolbarService.test.js +82 -6
- package/src/all/background_page/service/user/getOrFindMeService.js +4 -1
- package/src/all/background_page/service/user/getOrFindMeService.test.js +10 -2
- package/src/all/background_page/service/webIntegration/parseWebIntegrationUrlService.js +11 -6
- package/src/all/background_page/service/webIntegration/parseWebIntegrationUrlService.test.js +7 -9
- package/src/all/background_page/utils/format/formDataUtils.test.js +1 -1
- package/src/all/background_page/utils/openpgp/openpgpAssertions.js +1 -1
- package/src/all/webAccessibleResources/js/themes/stylesheet.js +1 -1
- package/src/chrome-mv3/manifest.json +1 -1
- package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.js +1 -1
- package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.js +7 -4
- package/src/firefox/manifest.json +1 -1
- package/src/safari/manifest.json +1 -1
- package/test/matchers/toBeOpenpgpKeySignedBy.js +13 -14
- package/test/mocks/mockJsDomPolyfill.js +0 -2
- package/webpack/common-blocks.js +13 -13
- package/webpack/expectedBuildArtifacts.js +1 -1
- package/webpack/passboltEnvPlugin.js +1 -1
- package/webpack.common.config.js +2 -0
- package/webpack.config.js +4 -5
- package/webpack.safari-background-page.config.js +38 -31
- package/src/all/background_page/model/theme/themeModel.js +0 -66
- package/src/all/background_page/model/theme/themeModel.test.js +0 -73
- package/src/all/background_page/service/activeSession/findAndUpdateActiveSessionLocalStorageService.test.js +0 -776
- package/src/chrome/manifest.json +0 -51
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.js +0 -31
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.test.js +0 -53
- package/webpack.chromium-mv2.config.js +0 -40
|
@@ -25,12 +25,20 @@ import UserActiveSessionEntity, {
|
|
|
25
25
|
import { defaultUserActiveSessionDto } from "passbolt-styleguide/src/shared/models/entity/session/userActiveSessionEntity.test.data";
|
|
26
26
|
import LocalStorageMetadataEntity from "../../model/entity/localStorage/localStorageMetadataEntity";
|
|
27
27
|
import GetOrFindActiveSessionService from "../activeSession/getOrFindActiveSessionService";
|
|
28
|
+
import GetSessionTimestampsService from "../sessionTimestamps/getSessionTimestampsService";
|
|
29
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
30
|
+
import { defaultSessionTimestampsDto } from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity.test.data";
|
|
28
31
|
|
|
29
|
-
const mockActiveSession = (data) =>
|
|
32
|
+
const mockActiveSession = ({ last_logged_in, ...data } = {}) => {
|
|
30
33
|
jest
|
|
31
34
|
.spyOn(GetOrFindActiveSessionService.prototype, "getOrFind")
|
|
32
35
|
.mockResolvedValue(new UserActiveSessionEntity(defaultUserActiveSessionDto(data)));
|
|
33
|
-
|
|
36
|
+
jest
|
|
37
|
+
.spyOn(GetSessionTimestampsService.prototype, "get")
|
|
38
|
+
.mockResolvedValue(
|
|
39
|
+
last_logged_in ? new SessionTimestampsEntity(defaultSessionTimestampsDto({ last_logged_in })) : null,
|
|
40
|
+
);
|
|
41
|
+
};
|
|
34
42
|
describe("GetOrFindResourceTypesService", () => {
|
|
35
43
|
let service, account, storage;
|
|
36
44
|
|
|
@@ -51,7 +51,7 @@ class DecryptAndParseResourceSecretService {
|
|
|
51
51
|
secretDto = JSON.parse(decryptedSecretMessage);
|
|
52
52
|
} catch (error) {
|
|
53
53
|
console.error(error);
|
|
54
|
-
throw new Error("Unable to parse the secret.");
|
|
54
|
+
throw new Error("Unable to parse the secret.", { cause: error });
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return new PlaintextEntity(secretDto, { schema });
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.18.0
|
|
13
|
+
*/
|
|
14
|
+
import SessionTimestampsLocalStorage from "../local_storage/sessionTimestampsLocalStorage";
|
|
15
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the session timestamps (last_logged_in, last_seen_online).
|
|
19
|
+
*/
|
|
20
|
+
class GetSessionTimestampsService {
|
|
21
|
+
/**
|
|
22
|
+
* @param {AccountEntity} account The user account
|
|
23
|
+
*/
|
|
24
|
+
constructor(account) {
|
|
25
|
+
this.sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve the session timestamps from the local storage.
|
|
30
|
+
* @returns {Promise<SessionTimestampsEntity|null>} null if none are stored.
|
|
31
|
+
*/
|
|
32
|
+
async get() {
|
|
33
|
+
const sessionTimestampsDto = await this.sessionTimestampsLocalStorage.getData();
|
|
34
|
+
if (!sessionTimestampsDto) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
return new SessionTimestampsEntity(sessionTimestampsDto);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// Catch invalid timestamps and treat as missing; next online sign in overrides them
|
|
42
|
+
console.error(error);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default GetSessionTimestampsService;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.18.0
|
|
13
|
+
*/
|
|
14
|
+
import GetSessionTimestampsService from "./getSessionTimestampsService";
|
|
15
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
16
|
+
import { defaultSessionTimestampsDto } from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity.test.data";
|
|
17
|
+
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
18
|
+
import { defaultAccountDto } from "../../model/entity/account/accountEntity.test.data";
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("GetSessionTimestampsService", () => {
|
|
25
|
+
let getSessionTimestampsService, account;
|
|
26
|
+
|
|
27
|
+
beforeEach(async () => {
|
|
28
|
+
account = new AccountEntity(defaultAccountDto());
|
|
29
|
+
getSessionTimestampsService = new GetSessionTimestampsService(account);
|
|
30
|
+
await getSessionTimestampsService.sessionTimestampsLocalStorage.flush();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("::get", () => {
|
|
34
|
+
it("should return the session timestamps stored in the local storage.", async () => {
|
|
35
|
+
expect.assertions(2);
|
|
36
|
+
const sessionTimestampsDto = defaultSessionTimestampsDto();
|
|
37
|
+
await getSessionTimestampsService.sessionTimestampsLocalStorage.setData(
|
|
38
|
+
new SessionTimestampsEntity(sessionTimestampsDto),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const result = await getSessionTimestampsService.get();
|
|
42
|
+
|
|
43
|
+
expect(result).toBeInstanceOf(SessionTimestampsEntity);
|
|
44
|
+
expect(result.toDto()).toEqual(sessionTimestampsDto);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should return null if no session timestamps are stored.", async () => {
|
|
48
|
+
expect.assertions(1);
|
|
49
|
+
const result = await getSessionTimestampsService.get();
|
|
50
|
+
expect(result).toBeNull();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should return null and log the error if the stored session timestamps are not valid.", async () => {
|
|
54
|
+
expect.assertions(2);
|
|
55
|
+
jest
|
|
56
|
+
.spyOn(getSessionTimestampsService.sessionTimestampsLocalStorage, "getData")
|
|
57
|
+
.mockResolvedValue({ last_logged_in: "not a date" });
|
|
58
|
+
jest.spyOn(console, "error").mockImplementation(() => {});
|
|
59
|
+
|
|
60
|
+
const result = await getSessionTimestampsService.get();
|
|
61
|
+
|
|
62
|
+
expect(result).toBeNull();
|
|
63
|
+
expect(console.error).toHaveBeenCalledWith(expect.any(Error));
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.18.0
|
|
13
|
+
*/
|
|
14
|
+
import SessionTimestampsLocalStorage from "../local_storage/sessionTimestampsLocalStorage";
|
|
15
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
16
|
+
import GetSessionTimestampsService from "./getSessionTimestampsService";
|
|
17
|
+
import { assertType } from "../../utils/assertions";
|
|
18
|
+
|
|
19
|
+
const UPDATE_SESSION_TIMESTAMPS_LS_LOCK_PREFIX = "UPDATE_SESSION_TIMESTAMPS_LS_LOCK-";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Update the session timestamps (last_logged_in, last_seen_online) in the local storage.
|
|
23
|
+
*/
|
|
24
|
+
class UpdateSessionTimestampsService {
|
|
25
|
+
/**
|
|
26
|
+
* @param {AccountEntity} account The user account
|
|
27
|
+
*/
|
|
28
|
+
constructor(account) {
|
|
29
|
+
this.account = account;
|
|
30
|
+
this.sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
31
|
+
this.getSessionTimestampsService = new GetSessionTimestampsService(account);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Online sign-in: the user logged in and the server was seen at the same time.
|
|
36
|
+
* @param {Date} [date] The sign-in date, now by default.
|
|
37
|
+
* @returns {Promise<void>}
|
|
38
|
+
*/
|
|
39
|
+
async updateOnOnlineLogin(date = new Date()) {
|
|
40
|
+
assertType(date, Date);
|
|
41
|
+
await navigator.locks.request(`${UPDATE_SESSION_TIMESTAMPS_LS_LOCK_PREFIX}${this.account.id}`, async () => {
|
|
42
|
+
const sessionTimestampsEntity = new SessionTimestampsEntity({
|
|
43
|
+
last_logged_in: date.toISOString(),
|
|
44
|
+
last_seen_online: date.toISOString(),
|
|
45
|
+
});
|
|
46
|
+
await this.sessionTimestampsLocalStorage.setData(sessionTimestampsEntity);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Offline sign-in: the user logged in, the server was not seen.
|
|
52
|
+
* Does nothing if no session timestamps are stored: without a last seen online date the offline sign-in is refused.
|
|
53
|
+
* @param {Date} [date] The sign-in date, now by default.
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
async updateOnOfflineLogin(date = new Date()) {
|
|
57
|
+
assertType(date, Date);
|
|
58
|
+
await this._update((sessionTimestampsEntity) => {
|
|
59
|
+
sessionTimestampsEntity.lastLoggedIn = date.toISOString();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The server was seen while the user is signed in online.
|
|
65
|
+
* Caller is AuthSessionCheck alarm (StartLoopAuthSessionCheckService) every minute until online sign in to logout
|
|
66
|
+
* Does nothing if no session timestamps are stored: they are created at the online sign-in.
|
|
67
|
+
* @param {Date} date The date the server was seen.
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
async updateLastSeenOnline(date) {
|
|
71
|
+
assertType(date, Date);
|
|
72
|
+
await this._update((sessionTimestampsEntity) => {
|
|
73
|
+
sessionTimestampsEntity.lastSeenOnline = date.toISOString();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Read, update and write the stored session timestamps under a lock. Does nothing if none are stored.
|
|
79
|
+
* @param {function(SessionTimestampsEntity): void} updater Updates the entity in place.
|
|
80
|
+
* @returns {Promise<void>}
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
async _update(updater) {
|
|
84
|
+
await navigator.locks.request(`${UPDATE_SESSION_TIMESTAMPS_LS_LOCK_PREFIX}${this.account.id}`, async () => {
|
|
85
|
+
const sessionTimestampsEntity = await this.getSessionTimestampsService.get();
|
|
86
|
+
/*
|
|
87
|
+
* Only the online sign-in (updateOnOnlineLogin) creates the session timestamps, so a missing record is not recreated here.
|
|
88
|
+
* TODO: migration of the dates from former active session records when active session will no longer have these timestamps.
|
|
89
|
+
* Behavior change compared to these timestamps in activesession: In the active session (local storage, active_session-<accountId>), a
|
|
90
|
+
* missing record is recreated: updateLastSeenOnline builds a default active session (with a server status call)
|
|
91
|
+
* and authenticateOffline writes one with last_logged_in only.
|
|
92
|
+
*/
|
|
93
|
+
if (!sessionTimestampsEntity) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
updater(sessionTimestampsEntity);
|
|
97
|
+
await this.sessionTimestampsLocalStorage.setData(sessionTimestampsEntity);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default UpdateSessionTimestampsService;
|
package/src/all/background_page/service/sessionTimestamps/updateSessionTimestampsService.test.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.18.0
|
|
13
|
+
*/
|
|
14
|
+
import UpdateSessionTimestampsService from "./updateSessionTimestampsService";
|
|
15
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
16
|
+
import { defaultSessionTimestampsDto } from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity.test.data";
|
|
17
|
+
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
18
|
+
import { defaultAccountDto } from "../../model/entity/account/accountEntity.test.data";
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
jest.useRealTimers();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("UpdateSessionTimestampsService", () => {
|
|
26
|
+
let updateSessionTimestampsService, account;
|
|
27
|
+
const date = new Date("2025-08-05T10:00:00.000Z");
|
|
28
|
+
|
|
29
|
+
beforeEach(async () => {
|
|
30
|
+
account = new AccountEntity(defaultAccountDto());
|
|
31
|
+
updateSessionTimestampsService = new UpdateSessionTimestampsService(account);
|
|
32
|
+
await updateSessionTimestampsService.sessionTimestampsLocalStorage.flush();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Store the given session timestamps in the local storage.
|
|
37
|
+
* @param {object} sessionTimestampsDto
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
const storeSessionTimestamps = async (sessionTimestampsDto) => {
|
|
41
|
+
await updateSessionTimestampsService.sessionTimestampsLocalStorage.setData(
|
|
42
|
+
new SessionTimestampsEntity(sessionTimestampsDto),
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Mock the stored session timestamps read by the service as not valid.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
const mockInvalidStoredSessionTimestamps = () => {
|
|
51
|
+
jest
|
|
52
|
+
.spyOn(updateSessionTimestampsService.getSessionTimestampsService.sessionTimestampsLocalStorage, "getData")
|
|
53
|
+
.mockResolvedValue({ last_logged_in: "not a date" });
|
|
54
|
+
jest.spyOn(console, "error").mockImplementation(() => {});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
describe("::updateOnOnlineLogin", () => {
|
|
58
|
+
it("should create the session timestamps with both dates set to the given date if none are stored.", async () => {
|
|
59
|
+
expect.assertions(1);
|
|
60
|
+
await updateSessionTimestampsService.updateOnOnlineLogin(date);
|
|
61
|
+
|
|
62
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
63
|
+
expect(result).toEqual({
|
|
64
|
+
last_logged_in: date.toISOString(),
|
|
65
|
+
last_seen_online: date.toISOString(),
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("should replace the stored session timestamps.", async () => {
|
|
70
|
+
expect.assertions(1);
|
|
71
|
+
await storeSessionTimestamps(defaultSessionTimestampsDto());
|
|
72
|
+
|
|
73
|
+
await updateSessionTimestampsService.updateOnOnlineLogin(date);
|
|
74
|
+
|
|
75
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
76
|
+
expect(result).toEqual({
|
|
77
|
+
last_logged_in: date.toISOString(),
|
|
78
|
+
last_seen_online: date.toISOString(),
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should use the current date by default.", async () => {
|
|
83
|
+
expect.assertions(1);
|
|
84
|
+
jest.useFakeTimers();
|
|
85
|
+
jest.setSystemTime(date.getTime());
|
|
86
|
+
|
|
87
|
+
await updateSessionTimestampsService.updateOnOnlineLogin();
|
|
88
|
+
|
|
89
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
90
|
+
expect(result).toEqual({
|
|
91
|
+
last_logged_in: date.toISOString(),
|
|
92
|
+
last_seen_online: date.toISOString(),
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("should throw if the date is not a Date.", async () => {
|
|
97
|
+
expect.assertions(2);
|
|
98
|
+
const spyOnSetData = jest.spyOn(updateSessionTimestampsService.sessionTimestampsLocalStorage, "setData");
|
|
99
|
+
|
|
100
|
+
await expect(() => updateSessionTimestampsService.updateOnOnlineLogin(date.toISOString())).rejects.toThrow(
|
|
101
|
+
TypeError,
|
|
102
|
+
);
|
|
103
|
+
expect(spyOnSetData).not.toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("::updateOnOfflineLogin", () => {
|
|
108
|
+
it("should update the last logged in date and keep the last seen online date.", async () => {
|
|
109
|
+
expect.assertions(1);
|
|
110
|
+
const sessionTimestampsDto = defaultSessionTimestampsDto();
|
|
111
|
+
await storeSessionTimestamps(sessionTimestampsDto);
|
|
112
|
+
|
|
113
|
+
await updateSessionTimestampsService.updateOnOfflineLogin(date);
|
|
114
|
+
|
|
115
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
116
|
+
expect(result).toEqual({
|
|
117
|
+
last_logged_in: date.toISOString(),
|
|
118
|
+
last_seen_online: sessionTimestampsDto.last_seen_online,
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("should use the current date by default.", async () => {
|
|
123
|
+
expect.assertions(1);
|
|
124
|
+
await storeSessionTimestamps(defaultSessionTimestampsDto());
|
|
125
|
+
jest.useFakeTimers();
|
|
126
|
+
jest.setSystemTime(date.getTime());
|
|
127
|
+
|
|
128
|
+
await updateSessionTimestampsService.updateOnOfflineLogin();
|
|
129
|
+
|
|
130
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
131
|
+
expect(result.last_logged_in).toEqual(date.toISOString());
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("should do nothing if no session timestamps are stored.", async () => {
|
|
135
|
+
expect.assertions(2);
|
|
136
|
+
const spyOnSetData = jest.spyOn(updateSessionTimestampsService.sessionTimestampsLocalStorage, "setData");
|
|
137
|
+
|
|
138
|
+
await updateSessionTimestampsService.updateOnOfflineLogin(date);
|
|
139
|
+
|
|
140
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
141
|
+
expect(result).toBeUndefined();
|
|
142
|
+
expect(spyOnSetData).not.toHaveBeenCalled();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("should do nothing if the stored session timestamps are not valid.", async () => {
|
|
146
|
+
expect.assertions(1);
|
|
147
|
+
mockInvalidStoredSessionTimestamps();
|
|
148
|
+
const spyOnSetData = jest.spyOn(updateSessionTimestampsService.sessionTimestampsLocalStorage, "setData");
|
|
149
|
+
|
|
150
|
+
await updateSessionTimestampsService.updateOnOfflineLogin(date);
|
|
151
|
+
|
|
152
|
+
expect(spyOnSetData).not.toHaveBeenCalled();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("should throw if the date is not a Date.", async () => {
|
|
156
|
+
expect.assertions(1);
|
|
157
|
+
await expect(() => updateSessionTimestampsService.updateOnOfflineLogin(date.toISOString())).rejects.toThrow(
|
|
158
|
+
TypeError,
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe("::updateLastSeenOnline", () => {
|
|
164
|
+
it("should update the last seen online date and keep the last logged in date.", async () => {
|
|
165
|
+
expect.assertions(1);
|
|
166
|
+
const sessionTimestampsDto = defaultSessionTimestampsDto();
|
|
167
|
+
await storeSessionTimestamps(sessionTimestampsDto);
|
|
168
|
+
|
|
169
|
+
await updateSessionTimestampsService.updateLastSeenOnline(date);
|
|
170
|
+
|
|
171
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
172
|
+
expect(result).toEqual({
|
|
173
|
+
last_logged_in: sessionTimestampsDto.last_logged_in,
|
|
174
|
+
last_seen_online: date.toISOString(),
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("should do nothing if no session timestamps are stored.", async () => {
|
|
179
|
+
expect.assertions(2);
|
|
180
|
+
const spyOnSetData = jest.spyOn(updateSessionTimestampsService.sessionTimestampsLocalStorage, "setData");
|
|
181
|
+
|
|
182
|
+
await updateSessionTimestampsService.updateLastSeenOnline(date);
|
|
183
|
+
|
|
184
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
185
|
+
expect(result).toBeUndefined();
|
|
186
|
+
expect(spyOnSetData).not.toHaveBeenCalled();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("should do nothing if the stored session timestamps are not valid.", async () => {
|
|
190
|
+
expect.assertions(1);
|
|
191
|
+
mockInvalidStoredSessionTimestamps();
|
|
192
|
+
const spyOnSetData = jest.spyOn(updateSessionTimestampsService.sessionTimestampsLocalStorage, "setData");
|
|
193
|
+
|
|
194
|
+
await updateSessionTimestampsService.updateLastSeenOnline(date);
|
|
195
|
+
|
|
196
|
+
expect(spyOnSetData).not.toHaveBeenCalled();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it("should throw if the date is not a Date.", async () => {
|
|
200
|
+
expect.assertions(1);
|
|
201
|
+
await expect(() => updateSessionTimestampsService.updateLastSeenOnline(undefined)).rejects.toThrow(TypeError);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("should not lose an update when called concurrently with the offline sign-in.", async () => {
|
|
205
|
+
expect.assertions(1);
|
|
206
|
+
await storeSessionTimestamps(defaultSessionTimestampsDto());
|
|
207
|
+
const lastSeenOnlineDate = new Date("2025-08-06T10:00:00.000Z");
|
|
208
|
+
|
|
209
|
+
await Promise.all([
|
|
210
|
+
updateSessionTimestampsService.updateOnOfflineLogin(date),
|
|
211
|
+
updateSessionTimestampsService.updateLastSeenOnline(lastSeenOnlineDate),
|
|
212
|
+
]);
|
|
213
|
+
|
|
214
|
+
const result = await updateSessionTimestampsService.sessionTimestampsLocalStorage.getData();
|
|
215
|
+
expect(result).toEqual({
|
|
216
|
+
last_logged_in: date.toISOString(),
|
|
217
|
+
last_seen_online: lastSeenOnlineDate.toISOString(),
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|
|
@@ -18,7 +18,7 @@ import AbstractAccountEntity from "../../model/entity/account/abstractAccountEnt
|
|
|
18
18
|
|
|
19
19
|
export const ACTIVE_SESSION_LOCAL_STORAGE_KEY = "active_session";
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class ActiveSessionSessionStorage {
|
|
22
22
|
/**
|
|
23
23
|
* Runtime cached data.
|
|
24
24
|
* @type {Object} Key: account_id, value: cached data as dto.
|
|
@@ -53,38 +53,38 @@ class ActiveSessionLocalStorage {
|
|
|
53
53
|
* @returns {boolean}
|
|
54
54
|
*/
|
|
55
55
|
hasCachedData() {
|
|
56
|
-
return Boolean(
|
|
56
|
+
return Boolean(ActiveSessionSessionStorage._runtimeCachedData[this.account.id]);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Flush the active session from
|
|
60
|
+
* Flush the active session from the session storage and runtime cached data.
|
|
61
61
|
* @return {Promise<void>}
|
|
62
62
|
*/
|
|
63
63
|
async flush() {
|
|
64
|
-
await browser.storage.
|
|
65
|
-
delete
|
|
66
|
-
Log.write({ level: "debug", message: `
|
|
64
|
+
await browser.storage.session.remove(this.storageKey);
|
|
65
|
+
delete ActiveSessionSessionStorage._runtimeCachedData[this.account.id];
|
|
66
|
+
Log.write({ level: "debug", message: `ActiveSessionSessionStorage flushed for (${this.account.id})` });
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* Get the active session from the
|
|
70
|
+
* Get the active session from the session storage.
|
|
71
71
|
* @return {Promise<object|undefined>}
|
|
72
72
|
*/
|
|
73
73
|
async get() {
|
|
74
|
-
if (!
|
|
75
|
-
const data = await browser.storage.
|
|
74
|
+
if (!ActiveSessionSessionStorage._runtimeCachedData[this.account.id]) {
|
|
75
|
+
const data = await browser.storage.session.get(this.storageKey);
|
|
76
76
|
if (!data[this.storageKey]) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
ActiveSessionSessionStorage._runtimeCachedData[this.account.id] = data[this.storageKey];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return
|
|
82
|
+
return ActiveSessionSessionStorage._runtimeCachedData[this.account.id];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Set the active session in the
|
|
87
|
-
* @param {UserActiveSessionEntity} activeSession The active session to insert in the
|
|
86
|
+
* Set the active session in the session storage.
|
|
87
|
+
* @param {UserActiveSessionEntity} activeSession The active session to insert in the session storage.
|
|
88
88
|
* @return {Promise<void>}
|
|
89
89
|
* @throws {TypeError} If parameter settings is not of type UserActiveSessionEntity.
|
|
90
90
|
*/
|
|
@@ -97,7 +97,7 @@ class ActiveSessionLocalStorage {
|
|
|
97
97
|
await navigator.locks.request(this.storageKey, async () => {
|
|
98
98
|
const activeSessionDto = activeSession.toDto();
|
|
99
99
|
await this._setBrowserStorage({ [this.storageKey]: activeSessionDto });
|
|
100
|
-
|
|
100
|
+
ActiveSessionSessionStorage._runtimeCachedData[this.account.id] = activeSessionDto;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -105,13 +105,13 @@ class ActiveSessionLocalStorage {
|
|
|
105
105
|
* Set the browser storage.
|
|
106
106
|
* @todo Tool to test the semaphore. A dedicated local storage service could be implemented later on top
|
|
107
107
|
* of the browser provided one to ease the testing.
|
|
108
|
-
* @param {object} data The data to store in the
|
|
108
|
+
* @param {object} data The data to store in the session storage.
|
|
109
109
|
* @returns {Promise<void>}
|
|
110
110
|
* @private
|
|
111
111
|
*/
|
|
112
112
|
async _setBrowserStorage(data) {
|
|
113
|
-
await browser.storage.
|
|
113
|
+
await browser.storage.session.set(data);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
export default
|
|
117
|
+
export default ActiveSessionSessionStorage;
|