passbolt-browser-extension 5.16.1 → 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 +210 -1
- package/README.md +2 -2
- package/RELEASE_NOTES.md +3 -4
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager/AppDelegate.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager/ViewController.swift +15 -15
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/SafariWebExtensionHandler.swift +5 -5
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/AbstractController.swift +5 -5
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/ErrorController.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/FetchController.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/OpenSafariSettingsController.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/SaveFileController.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/WriteClipboardController.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/fetch/SecureProfileSessionManager.swift +36 -30
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/fetch/fetchService.swift +24 -24
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/file/SaveFileService.swift +15 -15
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/utils/ErrorSerializer.swift +13 -13
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/utils/LocatedError.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/SafariWebExtensionHandlerTests.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/AbstractControllerTests.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/ErrorControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/FetchControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/OpenSafariSettingsControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/SaveFileControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/WriteClipboardControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/services/fetch/FetchServiceTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/services/fetch/SecureProfileSessionManagerTests.swift +7 -7
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/utils/ErrorSerializerTests.swift +17 -17
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/utils/LocatedErrorTests.swift +12 -12
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager.xcodeproj/project.pbxproj +12 -14
- package/eslint.config.mjs +3 -35
- package/jest.config.json +1 -2
- package/package.json +45 -51
- 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/accountRecovery/recoverAccountController.js +4 -0
- package/src/all/background_page/controller/accountRecovery/recoverAccountController.test.js +5 -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.js +4 -2
- package/src/all/background_page/controller/informCallToActionController/informCallToActionController.test.js +50 -2
- package/src/all/background_page/controller/mfaPolicy/mfaGetMfaSettingsController.test.js +13 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupAbortWebauthnCeremonyController.js +52 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupAbortWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupBeginWebauthnCeremonyController.js +52 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupBeginWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupDeleteWebauthnCredentialController.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupDeleteWebauthnCredentialController.test.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupFinishWebauthnCeremonyController.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupFinishWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnCredentialsController.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnCredentialsController.test.js +61 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnSettingsController.js +53 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnSettingsController.test.js +57 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController.test.js +52 -0
- package/src/all/background_page/controller/move/moveFolderController.js +12 -12
- package/src/all/background_page/controller/move/moveFolderController.test.js +31 -1
- package/src/all/background_page/controller/move/moveResourcesController.js +18 -5
- package/src/all/background_page/controller/move/moveResourcesController.test.js +68 -7
- package/src/all/background_page/controller/recover/completeRecoverController.js +4 -0
- package/src/all/background_page/controller/recover/completeRecoverController.test.js +5 -1
- 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/setup/completeSetupController.js +4 -0
- package/src/all/background_page/controller/setup/completeSetupController.test.js +5 -1
- 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/{chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.js → all/background_page/error/webauthnAlreadyRunningCeremonyError.js} +7 -14
- package/src/all/background_page/error/webauthnAuthenticatorAlreadyRegisteredError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyAbortedError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyCancelledError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyNotFoundError.js +26 -0
- package/src/all/background_page/error/webauthnTLSCertificateError.js +24 -0
- package/src/all/background_page/event/appBootstrapEvents.js +32 -0
- package/src/all/background_page/event/appBootstrapEvents.test.js +31 -0
- 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/folderEvents.js +5 -4
- package/src/all/background_page/event/informCallToActionEvents.js +3 -2
- package/src/all/background_page/event/informMenuEvents.js +2 -2
- package/src/all/background_page/event/mfaEvents.js +38 -1
- package/src/all/background_page/event/quickAccessEvents.js +12 -0
- package/src/all/background_page/event/resourceEvents.js +9 -5
- package/src/all/background_page/event/themeEvents.js +9 -21
- package/src/all/background_page/index.js +16 -0
- 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/folder/foldersCollection.js +13 -9
- package/src/all/background_page/model/entity/folder/foldersCollection.test.data.js +35 -0
- package/src/all/background_page/model/entity/folder/foldersCollection.test.js +60 -0
- package/src/all/background_page/model/entity/import/importResourcesFileEntity.test.data.js +5 -0
- package/src/all/background_page/model/entity/mfa/mfaEnabledProviderEntity.js +11 -0
- package/src/all/background_page/model/entity/mfa/mfaEnabledProviderEntity.test.js +13 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.js +126 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.test.data.js +26 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.test.js +105 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.js +52 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.test.data.js +22 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.test.js +60 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.js +45 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.test.data.js +17 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.test.js +48 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.js +235 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.test.data.js +42 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.test.js +152 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.js +72 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.test.data.js +26 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.test.js +83 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.js +121 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.test.data.js +36 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.test.js +100 -0
- package/src/all/background_page/model/entity/permission/change/permissionChangesCollection.js +0 -59
- package/src/all/background_page/model/entity/permission/change/permissionChangesCollection.test.js +0 -333
- 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/entity/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.js +1 -1
- package/src/all/background_page/model/entity/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.test.js +19 -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/accountRecoveryBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/appBootstrapPagemod.js +8 -6
- package/src/all/background_page/pagemod/appBootstrapPagemod.test.js +15 -20
- package/src/all/background_page/pagemod/authBootstrapPagemod.js +2 -2
- package/src/all/background_page/pagemod/authBootstrapPagemod.test.js +7 -8
- package/src/all/background_page/pagemod/pagemod.js +3 -1
- package/src/all/background_page/pagemod/pagemod.test.js +1 -1
- package/src/all/background_page/pagemod/pagemodManager.test.js +14 -20
- package/src/all/background_page/pagemod/publicWebsiteSignInPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/recoverBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/setupBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/webIntegrationPagemod.js +2 -2
- package/src/all/background_page/pagemod/webIntegrationPagemod.test.js +10 -10
- package/src/all/background_page/sdk/port/portManager.js +13 -1
- package/src/all/background_page/sdk/port/portManager.test.js +98 -0
- 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/mfa/webauthnApiService.js +76 -0
- package/src/all/background_page/service/api/mfa/webauthnApiService.test.js +119 -0
- package/src/all/background_page/service/api/mfa/webauthnSettingsApiService.js +44 -0
- package/src/all/background_page/service/api/mfa/webauthnSettingsApiService.test.js +56 -0
- 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 +5 -4
- package/src/all/background_page/service/auth/postLoginService.test.js +4 -4
- package/src/all/background_page/service/auth/postLogoutService.js +2 -1
- package/src/all/background_page/service/auth/postLogoutService.test.js +24 -1
- 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/onExtensionUpdateAvailableService.test.js +2 -6
- 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/group/groupUpdateSecretsCryptoService.js +1 -1
- package/src/all/background_page/service/group/groupUpdateService.js +1 -1
- package/src/all/background_page/service/group/groupUpdateService.test.js +3 -3
- package/src/all/background_page/service/localStorage/localStorageService.js +6 -2
- package/src/all/background_page/service/localStorage/localStorageService.test.js +31 -14
- 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/mfa/validateWebauthnCreationOptionsService.js +41 -0
- package/src/all/background_page/service/mfa/validateWebauthnCreationOptionsService.test.js +52 -0
- package/src/all/background_page/service/mfa/webauthnSetupCeremonyService.js +266 -0
- package/src/all/background_page/service/mfa/webauthnSetupCeremonyService.test.js +437 -0
- package/src/all/background_page/service/migrateMetadata/migrateMetadataResourcesService.test.js +2 -2
- package/src/all/background_page/service/move/deserializeConfirmedMovePermissions.js +41 -0
- package/src/all/background_page/service/move/deserializeConfirmedMovePermissions.test.js +80 -0
- package/src/all/background_page/service/move/moveOneFolderService.js +88 -135
- package/src/all/background_page/service/move/moveOneFolderService.test.js +774 -5237
- package/src/all/background_page/service/move/moveResourcesService.js +68 -40
- package/src/all/background_page/service/move/moveResourcesService.test.data.js +53 -0
- package/src/all/background_page/service/move/moveResourcesService.test.js +559 -2090
- 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 +6 -2
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.test.js +33 -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/permission/calculatePermissionsChangesService.js +172 -0
- package/src/all/background_page/service/permission/calculatePermissionsChangesService.test.js +370 -0
- package/src/all/background_page/service/rbac/getOrFindRbacService.js +6 -2
- 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 +6 -2
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.test.js +29 -2
- package/src/all/background_page/service/secret/decryptAndParseResourceSecretService.js +1 -1
- package/src/all/background_page/service/sessionStorage/webauthnSetupCeremonySessionStorageService.js +62 -0
- package/src/all/background_page/service/sessionStorage/webauthnSetupCeremonySessionStorageService.test.js +60 -0
- package/src/all/background_page/service/sessionStorage/workersSessionStorage.js +30 -0
- package/src/all/background_page/service/sessionStorage/workersSessionStorage.test.js +55 -0
- 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.js +20 -36
- package/src/all/background_page/service/share/shareFoldersService.test.js +240 -4
- package/src/all/background_page/service/share/shareResourceService.test.js +4 -4
- package/src/all/background_page/service/tab/tabService.js +3 -2
- 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 +33 -15
- package/src/all/background_page/service/toolbar/toolbarService.test.js +82 -6
- package/src/all/background_page/service/ui/browserTab.service.js +6 -4
- package/src/all/background_page/service/ui/browserTab.service.test.js +19 -6
- package/src/all/background_page/service/user/getOrFindMeService.js +6 -2
- package/src/all/background_page/service/user/getOrFindMeService.test.js +27 -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/service/worker/workerService.js +42 -11
- package/src/all/background_page/service/worker/workerService.test.js +70 -2
- 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/contentScripts/js/app/App.js +2 -0
- package/src/all/contentScripts/js/controller/abortWebauthnSetupCeremonyContentScriptController.js +62 -0
- package/src/all/contentScripts/js/controller/abortWebauthnSetupCeremonyContentScriptController.test.js +44 -0
- package/src/all/contentScripts/js/controller/runWebauthnSetupCeremonyContentScriptController.js +65 -0
- package/src/all/contentScripts/js/controller/runWebauthnSetupCeremonyContentScriptController.test.js +70 -0
- package/src/all/contentScripts/js/event/webauthnSetupCeremonyEvents.js +33 -0
- package/src/all/contentScripts/js/service/webauthnSetupCeremonyContentScriptService.js +154 -0
- package/src/all/contentScripts/js/service/webauthnSetupCeremonyContentScriptService.test.js +252 -0
- package/src/all/locales/en-UK/common.json +0 -1
- package/src/all/webAccessibleResources/js/lib/port.js +106 -10
- package/src/all/webAccessibleResources/js/lib/port.test.js +174 -1
- package/src/all/webAccessibleResources/js/themes/stylesheet.js +1 -1
- package/src/chrome-mv3/index.js +6 -0
- package/src/chrome-mv3/manifest.json +3 -4
- 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 +2 -3
- package/src/safari/background_page/index.js +2 -1
- package/src/safari/background_page/service/cookies/cookiesService.js +9 -3
- package/src/safari/background_page/service/cookies/cookiesService.test.js +28 -1
- package/src/safari/manifest.json +2 -3
- package/test/matchers/toBeOpenpgpKeySignedBy.js +13 -14
- package/test/mocks/mockJsDomPolyfill.js +0 -2
- package/test/mocks/mockWebExtensionPolyfill.js +2 -4
- 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/all/background_page/service/move/calculatePermissionsChangesForMoveService.js +0 -113
- package/src/all/background_page/service/move/calculatePermissionsChangesForMoveService.test.js +0 -158
- package/src/all/background_page/service/move/confirmMoveStrategyService.js +0 -42
- package/src/all/background_page/service/move/confirmMoveStrategyService.test.js +0 -67
- package/src/chrome/manifest.json +0 -52
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.test.js +0 -53
- package/webpack.chromium-mv2.config.js +0 -40
- /package/src/all/background_page/service/{move/calculatePermissionsChangesForMoveService.test.data.js → permission/calculatePermissionsChangesService.test.data.js} +0 -0
|
@@ -34,12 +34,13 @@ import { METADATA_KEYS_SETTINGS_LOCAL_STORAGE_KEY } from "../local_storage/metad
|
|
|
34
34
|
import GroupLocalStorage, { GROUP_LOCAL_STORAGE_KEY } from "../local_storage/groupLocalStorage";
|
|
35
35
|
import UserMeLocalStorage, { USER_ME_STORAGE_KEY_PREFIX } from "../local_storage/userMeLocalStorage";
|
|
36
36
|
import ResourceTypeLocalStorage, { RESOURCE_TYPES_LOCAL_STORAGE_KEY } from "../local_storage/resourceTypeLocalStorage";
|
|
37
|
-
import
|
|
37
|
+
import ActiveSessionSessionStorage, {
|
|
38
38
|
ACTIVE_SESSION_LOCAL_STORAGE_KEY,
|
|
39
|
-
} from "../
|
|
39
|
+
} from "../session_storage/activeSessionSessionStorage";
|
|
40
40
|
import SiteSettingsLocalStorage, { SITE_SETTINGS } from "../local_storage/siteSettingsLocalStorage";
|
|
41
41
|
import CanUseOfflineStorageService from "../offline/canUseOfflineStorageService";
|
|
42
42
|
import OfflineRetentionDataFlushService from "../offline/offlineRetentionDataFlushService";
|
|
43
|
+
import { SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY } from "../local_storage/sessionTimestampsLocalStorage";
|
|
43
44
|
|
|
44
45
|
beforeEach(() => {
|
|
45
46
|
jest.clearAllMocks();
|
|
@@ -48,7 +49,7 @@ beforeEach(() => {
|
|
|
48
49
|
describe("LocalStorageService", () => {
|
|
49
50
|
describe("LocalStorageService::flush", () => {
|
|
50
51
|
it("Should flush all storage (with no account set)", async () => {
|
|
51
|
-
expect.assertions(
|
|
52
|
+
expect.assertions(24);
|
|
52
53
|
// spy on
|
|
53
54
|
jest.spyOn(browser.storage.local, "remove");
|
|
54
55
|
jest.spyOn(browser.storage.session, "remove");
|
|
@@ -62,13 +63,13 @@ describe("LocalStorageService", () => {
|
|
|
62
63
|
jest.spyOn(GroupLocalStorage.prototype, "flush");
|
|
63
64
|
jest.spyOn(ResourceTypeLocalStorage.prototype, "flush");
|
|
64
65
|
jest.spyOn(RbacLocalStorage.prototype, "flush");
|
|
65
|
-
jest.spyOn(
|
|
66
|
+
jest.spyOn(ActiveSessionSessionStorage.prototype, "flush");
|
|
66
67
|
jest.spyOn(SiteSettingsLocalStorage.prototype, "flush");
|
|
67
68
|
// process
|
|
68
69
|
await LocalStorageService.flush();
|
|
69
70
|
// expectations
|
|
70
71
|
expect(browser.storage.local.remove).toHaveBeenCalledTimes(5);
|
|
71
|
-
expect(browser.storage.session.remove).toHaveBeenCalledTimes(
|
|
72
|
+
expect(browser.storage.session.remove).toHaveBeenCalledTimes(3);
|
|
72
73
|
expect(browser.alarms.clear).toHaveBeenCalledTimes(2);
|
|
73
74
|
expect(browser.storage.local.remove).toHaveBeenCalledWith("resources");
|
|
74
75
|
expect(browser.storage.local.remove).toHaveBeenCalledWith("folders");
|
|
@@ -80,6 +81,7 @@ describe("LocalStorageService", () => {
|
|
|
80
81
|
expect(browser.alarms.clear).toHaveBeenCalledWith("PassphraseStorageFlush");
|
|
81
82
|
expect(browser.alarms.clear).toHaveBeenCalledWith("SessionKeepAlive");
|
|
82
83
|
expect(browser.storage.session.remove).toHaveBeenCalledWith("temp_server_part_sso_kit");
|
|
84
|
+
expect(browser.storage.session.remove).toHaveBeenCalledWith("webauthn-setup-ceremony");
|
|
83
85
|
expect(GetLegacyAccountService.get).not.toHaveBeenCalled();
|
|
84
86
|
expect(UserMeLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
85
87
|
expect(MetadataTypesSettingsLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
@@ -88,14 +90,14 @@ describe("LocalStorageService", () => {
|
|
|
88
90
|
expect(GroupLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
89
91
|
expect(ResourceTypeLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
90
92
|
expect(RbacLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
91
|
-
expect(
|
|
93
|
+
expect(ActiveSessionSessionStorage.prototype.flush).not.toHaveBeenCalled();
|
|
92
94
|
expect(SiteSettingsLocalStorage.prototype.flush).not.toHaveBeenCalled();
|
|
93
95
|
});
|
|
94
96
|
});
|
|
95
97
|
|
|
96
98
|
describe("LocalStorageService::flushAccountBasedStorages", () => {
|
|
97
99
|
it("Should retain the offline-related storages when the user can use offline storage while flushing others", async () => {
|
|
98
|
-
expect.assertions(
|
|
100
|
+
expect.assertions(18);
|
|
99
101
|
// mock data
|
|
100
102
|
await MockExtension.withConfiguredAccount();
|
|
101
103
|
const account = new AccountEntity(defaultAccountDto());
|
|
@@ -142,20 +144,24 @@ describe("LocalStorageService", () => {
|
|
|
142
144
|
expect(browser.storage.local.remove).not.toHaveBeenCalledWith(
|
|
143
145
|
`${RESOURCE_TYPES_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
144
146
|
);
|
|
145
|
-
expect(browser.storage.
|
|
147
|
+
expect(browser.storage.session.remove).not.toHaveBeenCalledWith(
|
|
146
148
|
`${ACTIVE_SESSION_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
147
149
|
);
|
|
150
|
+
expect(browser.storage.local.remove).not.toHaveBeenCalledWith(
|
|
151
|
+
`${SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
152
|
+
);
|
|
148
153
|
expect(browser.storage.local.remove).not.toHaveBeenCalledWith(`${SITE_SETTINGS}-${account.id}`);
|
|
149
154
|
expect(OfflineRetentionDataFlushService.prototype.flushIfExceeded).toHaveBeenCalledWith();
|
|
150
155
|
});
|
|
151
156
|
|
|
152
157
|
it("Should flush the offline-related storages when the user cannot use offline storage", async () => {
|
|
153
|
-
expect.assertions(
|
|
158
|
+
expect.assertions(10);
|
|
154
159
|
// mock data
|
|
155
160
|
await MockExtension.withConfiguredAccount();
|
|
156
161
|
const account = new AccountEntity(defaultAccountDto());
|
|
157
162
|
// spy on
|
|
158
163
|
jest.spyOn(browser.storage.local, "remove");
|
|
164
|
+
jest.spyOn(browser.storage.session, "remove");
|
|
159
165
|
jest.spyOn(GetLegacyAccountService, "get").mockImplementation(() => account);
|
|
160
166
|
// The user is not eligible for offline access: the org did not configure it, or its role is denied.
|
|
161
167
|
jest
|
|
@@ -165,26 +171,30 @@ describe("LocalStorageService", () => {
|
|
|
165
171
|
await LocalStorageService.flushAccountBasedStorages();
|
|
166
172
|
// expectations: the offline-related storages are fully flushed.
|
|
167
173
|
expect(CanUseOfflineStorageService.canUseOfflineStorageFromLocalStorage).toHaveBeenCalledWith(account);
|
|
168
|
-
expect(browser.storage.
|
|
174
|
+
expect(browser.storage.session.remove).toHaveBeenCalledWith(`${ACTIVE_SESSION_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
169
175
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${SITE_SETTINGS}-${account.id}`);
|
|
170
176
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${RBACS_LOCAL_STORAGE_KEY}-metadata-${account.id}`);
|
|
171
177
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${RBACS_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
172
178
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
173
179
|
`${RESOURCE_TYPES_LOCAL_STORAGE_KEY}-metadata-${account.id}`,
|
|
174
180
|
);
|
|
181
|
+
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
182
|
+
`${SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
183
|
+
);
|
|
175
184
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${RESOURCE_TYPES_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
176
185
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${USER_ME_STORAGE_KEY_PREFIX}-metadata-${account.id}`);
|
|
177
186
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${USER_ME_STORAGE_KEY_PREFIX}-${account.id}`);
|
|
178
187
|
});
|
|
179
188
|
|
|
180
189
|
it("Should flush the offline-related storages when the offline capability cannot be resolved", async () => {
|
|
181
|
-
expect.assertions(
|
|
190
|
+
expect.assertions(7);
|
|
182
191
|
// mock data
|
|
183
192
|
await MockExtension.withConfiguredAccount();
|
|
184
193
|
const account = new AccountEntity(defaultAccountDto());
|
|
185
194
|
const error = new Error("Could not resolve the offline capability.");
|
|
186
195
|
// spy on
|
|
187
196
|
jest.spyOn(browser.storage.local, "remove");
|
|
197
|
+
jest.spyOn(browser.storage.session, "remove");
|
|
188
198
|
jest.spyOn(console, "error").mockImplementation(() => {});
|
|
189
199
|
jest.spyOn(GetLegacyAccountService, "get").mockImplementation(() => account);
|
|
190
200
|
jest
|
|
@@ -197,7 +207,10 @@ describe("LocalStorageService", () => {
|
|
|
197
207
|
"LocalStorageService: could not resolve the offline capability, flushing all storages.",
|
|
198
208
|
error,
|
|
199
209
|
);
|
|
200
|
-
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
210
|
+
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
211
|
+
`${SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
212
|
+
);
|
|
213
|
+
expect(browser.storage.session.remove).toHaveBeenCalledWith(`${ACTIVE_SESSION_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
201
214
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${SITE_SETTINGS}-${account.id}`);
|
|
202
215
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${RBACS_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
203
216
|
expect(browser.storage.local.remove).toHaveBeenCalledWith(`${RESOURCE_TYPES_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
@@ -205,13 +218,14 @@ describe("LocalStorageService", () => {
|
|
|
205
218
|
});
|
|
206
219
|
|
|
207
220
|
it("Should log a failing storage flush and carry on with the other ones", async () => {
|
|
208
|
-
expect.assertions(
|
|
221
|
+
expect.assertions(5);
|
|
209
222
|
// mock data
|
|
210
223
|
await MockExtension.withConfiguredAccount();
|
|
211
224
|
const account = new AccountEntity(defaultAccountDto());
|
|
212
225
|
const error = new Error("Could not flush the groups.");
|
|
213
226
|
// spy on
|
|
214
227
|
jest.spyOn(browser.storage.local, "remove");
|
|
228
|
+
jest.spyOn(browser.storage.session, "remove");
|
|
215
229
|
jest.spyOn(console, "error").mockImplementation(() => {});
|
|
216
230
|
jest.spyOn(GetLegacyAccountService, "get").mockImplementation(() => account);
|
|
217
231
|
jest
|
|
@@ -223,7 +237,10 @@ describe("LocalStorageService", () => {
|
|
|
223
237
|
expect(console.error).toHaveBeenCalledTimes(1);
|
|
224
238
|
expect(console.error).toHaveBeenCalledWith("LocalStorageService: a storage flush failed and was ignored.", error);
|
|
225
239
|
// The storages flushed alongside the failing one are not impacted.
|
|
226
|
-
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
240
|
+
expect(browser.storage.local.remove).toHaveBeenCalledWith(
|
|
241
|
+
`${SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY}-${account.id}`,
|
|
242
|
+
);
|
|
243
|
+
expect(browser.storage.session.remove).toHaveBeenCalledWith(`${ACTIVE_SESSION_LOCAL_STORAGE_KEY}-${account.id}`);
|
|
227
244
|
});
|
|
228
245
|
});
|
|
229
246
|
|
|
@@ -0,0 +1,40 @@
|
|
|
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 SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
15
|
+
import AbstractLocalStorage from "./abstractLocalStorage";
|
|
16
|
+
|
|
17
|
+
export const SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY = "session_timestamps";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The session timestamps (last_logged_in, last_seen_online).
|
|
21
|
+
*/
|
|
22
|
+
class SessionTimestampsLocalStorage extends AbstractLocalStorage {
|
|
23
|
+
/**
|
|
24
|
+
* Get the key property
|
|
25
|
+
* @return {string}
|
|
26
|
+
*/
|
|
27
|
+
get key() {
|
|
28
|
+
return SESSION_TIMESTAMPS_LOCAL_STORAGE_KEY;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the entity class
|
|
33
|
+
* @return {SessionTimestampsEntity}
|
|
34
|
+
*/
|
|
35
|
+
get entityClass() {
|
|
36
|
+
return SessionTimestampsEntity;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default SessionTimestampsLocalStorage;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
|
|
15
|
+
import SessionTimestampsLocalStorage from "./sessionTimestampsLocalStorage";
|
|
16
|
+
import { defaultSessionTimestampsDto } from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity.test.data";
|
|
17
|
+
import SessionTimestampsEntity from "passbolt-styleguide/src/shared/models/entity/sessionTimestamps/sessionTimestampsEntity";
|
|
18
|
+
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
19
|
+
import { defaultAccountDto } from "../../model/entity/account/accountEntity.test.data";
|
|
20
|
+
|
|
21
|
+
describe("SessionTimestampsLocalStorage", () => {
|
|
22
|
+
// mock data
|
|
23
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
24
|
+
|
|
25
|
+
describe("SessionTimestampsLocalStorage::get", () => {
|
|
26
|
+
it("Should return undefined if nothing stored in the storage", async () => {
|
|
27
|
+
expect.assertions(1);
|
|
28
|
+
const sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
29
|
+
const result = await sessionTimestampsLocalStorage.getData();
|
|
30
|
+
expect(result).toEqual(undefined);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("Should return content stored in the local storage", async () => {
|
|
34
|
+
const sessionTimestamps = defaultSessionTimestampsDto();
|
|
35
|
+
expect.assertions(1);
|
|
36
|
+
const sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
37
|
+
browser.storage.local.set({ [sessionTimestampsLocalStorage.storageDataKey]: sessionTimestamps });
|
|
38
|
+
const result = await sessionTimestampsLocalStorage.getData();
|
|
39
|
+
expect(result).toEqual(sessionTimestamps);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe("SessionTimestampsLocalStorage::setData", () => {
|
|
44
|
+
it("Should setData the session timestamps in the local storage", async () => {
|
|
45
|
+
expect.assertions(1);
|
|
46
|
+
const sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
47
|
+
const sessionTimestamps = new SessionTimestampsEntity(defaultSessionTimestampsDto());
|
|
48
|
+
await sessionTimestampsLocalStorage.setData(sessionTimestamps);
|
|
49
|
+
const result = await sessionTimestampsLocalStorage.getData();
|
|
50
|
+
expect(result).toEqual(sessionTimestamps.toDto());
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("SessionTimestampsLocalStorage::flush", () => {
|
|
55
|
+
it("Should flush the session timestamps from the local storage", async () => {
|
|
56
|
+
expect.assertions(1);
|
|
57
|
+
const sessionTimestampsLocalStorage = new SessionTimestampsLocalStorage(account);
|
|
58
|
+
await sessionTimestampsLocalStorage.flush();
|
|
59
|
+
const result = await sessionTimestampsLocalStorage.getData();
|
|
60
|
+
expect(result).toEqual(undefined);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
package/src/all/background_page/service/metadata/rotateMetadata/rotateMetadataKeyService.test.js
CHANGED
|
@@ -28,10 +28,10 @@ import { defaultMetadataKeyDto } from "passbolt-styleguide/src/shared/models/ent
|
|
|
28
28
|
describe("RotateMetadataKeyService", () => {
|
|
29
29
|
let account;
|
|
30
30
|
|
|
31
|
-
beforeEach(() => {
|
|
31
|
+
beforeEach(async () => {
|
|
32
32
|
jest.clearAllMocks();
|
|
33
33
|
|
|
34
|
-
MockExtension.withConfiguredAccount();
|
|
34
|
+
await MockExtension.withConfiguredAccount();
|
|
35
35
|
account = new AccountEntity(defaultAccountDto());
|
|
36
36
|
});
|
|
37
37
|
|
|
@@ -38,10 +38,10 @@ import GetOrFindResourceTypesService from "../../resourceType/getOrFindResourceT
|
|
|
38
38
|
describe("RotateResourcesMetadataKeyService", () => {
|
|
39
39
|
let account, metadataKeysDtos;
|
|
40
40
|
|
|
41
|
-
beforeEach(() => {
|
|
41
|
+
beforeEach(async () => {
|
|
42
42
|
jest.clearAllMocks();
|
|
43
43
|
|
|
44
|
-
MockExtension.withConfiguredAccount();
|
|
44
|
+
await MockExtension.withConfiguredAccount();
|
|
45
45
|
account = new AccountEntity(defaultAccountDto());
|
|
46
46
|
metadataKeysDtos = [
|
|
47
47
|
...defaultDecryptedSharedMetadataKeysDtos(),
|
|
@@ -0,0 +1,41 @@
|
|
|
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.17.0
|
|
13
|
+
*/
|
|
14
|
+
import WebauthnCeremonyError from "../../error/webauthnCeremonyError";
|
|
15
|
+
import WebauthnCredentialCreationOptionsEntity from "../../model/entity/mfa/webauthnCredentialCreationOptionsEntity";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Checks the creation options received from the API against the local account before they reach the browser.
|
|
19
|
+
* The shape of the options is guaranteed by WebauthnCredentialCreationOptionsEntity.
|
|
20
|
+
*/
|
|
21
|
+
class ValidateWebauthnCreationOptionsService {
|
|
22
|
+
/**
|
|
23
|
+
* @param {WebauthnCredentialCreationOptionsEntity} options
|
|
24
|
+
* @param {AccountEntity} account
|
|
25
|
+
* @throws {WebauthnCeremonyError} on the first failing check
|
|
26
|
+
*/
|
|
27
|
+
static validate(options, account) {
|
|
28
|
+
const expectedRpId = new URL(account.domain).hostname;
|
|
29
|
+
if (options.rp.id !== expectedRpId) {
|
|
30
|
+
throw new WebauthnCeremonyError(`The relying party id "${options.rp.id}" does not match the account domain.`);
|
|
31
|
+
}
|
|
32
|
+
if (options.user.name !== account.username) {
|
|
33
|
+
throw new WebauthnCeremonyError("The user name does not match the account username.");
|
|
34
|
+
}
|
|
35
|
+
if (WebauthnCredentialCreationOptionsEntity.decodeBase64Url(options.user.id) !== account.userId) {
|
|
36
|
+
throw new WebauthnCeremonyError("The user id does not match the account user id.");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default ValidateWebauthnCreationOptionsService;
|
|
@@ -0,0 +1,52 @@
|
|
|
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.17.0
|
|
13
|
+
*/
|
|
14
|
+
import ValidateWebauthnCreationOptionsService from "./validateWebauthnCreationOptionsService";
|
|
15
|
+
import WebauthnCeremonyError from "../../error/webauthnCeremonyError";
|
|
16
|
+
import WebauthnCredentialCreationOptionsEntity from "../../model/entity/mfa/webauthnCredentialCreationOptionsEntity";
|
|
17
|
+
import { defaultWebauthnCredentialCreationOptionsDto } from "../../model/entity/mfa/webauthnCredentialCreationOptionsEntity.test.data";
|
|
18
|
+
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
19
|
+
import { defaultAccountDto } from "../../model/entity/account/accountEntity.test.data";
|
|
20
|
+
|
|
21
|
+
describe("ValidateWebauthnCreationOptionsService", () => {
|
|
22
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
23
|
+
const validate = (data) =>
|
|
24
|
+
ValidateWebauthnCreationOptionsService.validate(
|
|
25
|
+
new WebauthnCredentialCreationOptionsEntity(defaultWebauthnCredentialCreationOptionsDto(data)),
|
|
26
|
+
account,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
describe("ValidateWebauthnCreationOptionsService::validate", () => {
|
|
30
|
+
it("accepts options matching the account", () => {
|
|
31
|
+
expect.assertions(1);
|
|
32
|
+
expect(() => validate()).not.toThrow();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("rejects a relying party id different from the account domain hostname", () => {
|
|
36
|
+
expect.assertions(1);
|
|
37
|
+
expect(() => validate({ rp: { id: "evil.local", name: "Passbolt" } })).toThrow(WebauthnCeremonyError);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("rejects a user name different from the account username", () => {
|
|
41
|
+
expect.assertions(1);
|
|
42
|
+
const user = { ...defaultWebauthnCredentialCreationOptionsDto().user, name: "betty@passbolt.com" };
|
|
43
|
+
expect(() => validate({ user })).toThrow("The user name does not match the account username.");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("rejects a user id not decoding to the account user id", () => {
|
|
47
|
+
expect.assertions(1);
|
|
48
|
+
const user = { ...defaultWebauthnCredentialCreationOptionsDto().user, id: "bm90LXRoZS11c2VyLWlk" };
|
|
49
|
+
expect(() => validate({ user })).toThrow("The user id does not match the account user id.");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,266 @@
|
|
|
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.17.0
|
|
13
|
+
*/
|
|
14
|
+
import { v4 as uuidv4 } from "uuid";
|
|
15
|
+
import PassboltApiFetchError from "passbolt-styleguide/src/shared/lib/Error/PassboltApiFetchError";
|
|
16
|
+
import WebauthnApiService from "../api/mfa/webauthnApiService";
|
|
17
|
+
import WebauthnSetupCeremonySessionStorageService from "../sessionStorage/webauthnSetupCeremonySessionStorageService";
|
|
18
|
+
import WebauthnCredentialCreationOptionsEntity from "../../model/entity/mfa/webauthnCredentialCreationOptionsEntity";
|
|
19
|
+
import WebauthnRegistrationResponseEntity from "../../model/entity/mfa/webauthnRegistrationResponseEntity";
|
|
20
|
+
import WebauthnSetupCeremonyEntity from "../../model/entity/mfa/webauthnSetupCeremonyEntity";
|
|
21
|
+
import ValidateWebauthnCreationOptionsService from "./validateWebauthnCreationOptionsService";
|
|
22
|
+
import WorkerService from "../worker/workerService";
|
|
23
|
+
import WebauthnCeremonyNotFoundError from "../../error/webauthnCeremonyNotFoundError";
|
|
24
|
+
import WebauthnCeremonyAbortedError from "../../error/webauthnCeremonyAbortedError";
|
|
25
|
+
|
|
26
|
+
const APP_BOOTSTRAP_WORKER = "AppBootstrap";
|
|
27
|
+
const APP_WORKER = "App";
|
|
28
|
+
|
|
29
|
+
export const RUN_CEREMONY_EVENT = "passbolt.app-bootstrap.run-webauthn-ceremony";
|
|
30
|
+
export const ABORT_CEREMONY_EVENT = "passbolt.app-bootstrap.abort-webauthn-ceremony";
|
|
31
|
+
export const CEREMONY_DONE_EVENT = "passbolt.mfa-setup.webauthn-ceremony-done";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Runs the restartable WebAuthn setup ceremony: begin and finish against the API, create() delegated to the
|
|
35
|
+
* AppBootstrap content script, state kept in session storage so a service worker restart does not lose it.
|
|
36
|
+
* A single ceremony is pending at a time; beginning a new one aborts the previous one.
|
|
37
|
+
*/
|
|
38
|
+
class WebauthnSetupCeremonyService {
|
|
39
|
+
/**
|
|
40
|
+
* @param {ApiClientOptions} apiClientOptions
|
|
41
|
+
* @param {AccountEntity} account
|
|
42
|
+
*/
|
|
43
|
+
constructor(apiClientOptions, account) {
|
|
44
|
+
this.account = account;
|
|
45
|
+
this.webauthnApiService = new WebauthnApiService(apiClientOptions);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Begin a ceremony for a tab and hand the creation options to its content script.
|
|
50
|
+
* An unexpired ceremony pending on any tab is aborted and replaced.
|
|
51
|
+
* @param {number} tabId
|
|
52
|
+
* @throws {EntityValidationError} if the creation options are malformed
|
|
53
|
+
* @throws {WebauthnCeremonyError} if the creation options do not match the account
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
async begin(tabId) {
|
|
57
|
+
const response = await this.webauthnApiService.begin();
|
|
58
|
+
const { handle, credentialCreationOptions } = response.body;
|
|
59
|
+
const options = new WebauthnCredentialCreationOptionsEntity(credentialCreationOptions);
|
|
60
|
+
ValidateWebauthnCreationOptionsService.validate(options, this.account);
|
|
61
|
+
const worker = await WorkerService.get(APP_BOOTSTRAP_WORKER, tabId);
|
|
62
|
+
const ceremony = new WebauthnSetupCeremonyEntity({
|
|
63
|
+
id: uuidv4(),
|
|
64
|
+
tab_id: tabId,
|
|
65
|
+
handle: handle,
|
|
66
|
+
started_at: new Date().toISOString(),
|
|
67
|
+
});
|
|
68
|
+
const previous = await WebauthnSetupCeremonySessionStorageService.get();
|
|
69
|
+
if (previous && !previous.isExpired) {
|
|
70
|
+
await this.emitAbort(previous);
|
|
71
|
+
if (previous.tabId !== tabId) {
|
|
72
|
+
await this.emitSuperseded(previous);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
await WebauthnSetupCeremonySessionStorageService.set(ceremony);
|
|
76
|
+
try {
|
|
77
|
+
worker.port.emit(RUN_CEREMONY_EVENT, { id: ceremony.id, options: options.toDto() });
|
|
78
|
+
} catch (error) {
|
|
79
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Handle the ceremony result sent by the content script and forward the outcome to the App worker.
|
|
86
|
+
* A result for an expired ceremony is reported to the App worker as an error.
|
|
87
|
+
* @param {number} tabId the tab the result came from
|
|
88
|
+
* @param {object} resultDto
|
|
89
|
+
* @param {boolean} resultDto.success true if the webauthn ceremony succeeded, false otherwise
|
|
90
|
+
* @param {{id: string, credential: object, aaguid: string|null}|{name: string, message: string}} [resultDto.result] the ceremony result details
|
|
91
|
+
* @throws {WebauthnCeremonyNotFoundError} if no ceremony is pending or the result does not match it (id or tab)
|
|
92
|
+
* @returns {Promise<void>}
|
|
93
|
+
*/
|
|
94
|
+
async handleResult(tabId, resultDto) {
|
|
95
|
+
const ceremony = await WebauthnSetupCeremonySessionStorageService.get();
|
|
96
|
+
if (!ceremony) {
|
|
97
|
+
throw new WebauthnCeremonyNotFoundError();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const { success, result: webauthnCeremonyResult, result: webauthnCeremonyError } = resultDto;
|
|
101
|
+
if (ceremony.tabId !== tabId || (success && ceremony.id !== webauthnCeremonyResult.id)) {
|
|
102
|
+
throw new WebauthnCeremonyNotFoundError("The result does not match the pending passkey ceremony.");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (ceremony.isExpired) {
|
|
106
|
+
const error = new WebauthnCeremonyNotFoundError("The pending passkey ceremony has expired.");
|
|
107
|
+
await this._emitCeremonyDoneResponse(tabId, error);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!success) {
|
|
112
|
+
await this._emitCeremonyDoneResponse(tabId, webauthnCeremonyError);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const credential = new WebauthnRegistrationResponseEntity(webauthnCeremonyResult.credential);
|
|
117
|
+
const completed = new WebauthnSetupCeremonyEntity({
|
|
118
|
+
...ceremony.toDto(),
|
|
119
|
+
credential: credential.toDto(),
|
|
120
|
+
aaguid: webauthnCeremonyResult.aaguid ?? null,
|
|
121
|
+
});
|
|
122
|
+
await WebauthnSetupCeremonySessionStorageService.set(completed);
|
|
123
|
+
await this._emitCeremonyDoneResponse(tabId, { aaguid: completed.aaguid }, true);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Sends a `webauthn ceremony done` response back to the content script
|
|
128
|
+
* @param {number} tabId the tab id where to find the worker to answer to
|
|
129
|
+
* @param {object|error} result the data to send to the worker
|
|
130
|
+
* @param {boolean} success should the content script treat the response as a success or not
|
|
131
|
+
* @returns {Promise<void>}
|
|
132
|
+
*/
|
|
133
|
+
async _emitCeremonyDoneResponse(tabId, result, success = false) {
|
|
134
|
+
if (!success) {
|
|
135
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const appWorker = await WorkerService.get(APP_WORKER, tabId);
|
|
139
|
+
const responseDto = { success, result };
|
|
140
|
+
await appWorker.port.emit(CEREMONY_DONE_EVENT, responseDto);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Finish the ceremony with the stored credential. The record is kept on a name error so the finish can be
|
|
145
|
+
* retried with another name; any other error ends the ceremony.
|
|
146
|
+
* @param {number} tabId
|
|
147
|
+
* @param {string} name the credential name chosen by the user
|
|
148
|
+
* @throws {WebauthnCeremonyNotFoundError} if no ceremony with a credential is pending for the tab, or if the API
|
|
149
|
+
* rejected the handle as expired
|
|
150
|
+
* @returns {Promise<{verified: string}>} the finish response body
|
|
151
|
+
*/
|
|
152
|
+
async finish(tabId, name) {
|
|
153
|
+
const ceremony = await this.getPendingCeremony();
|
|
154
|
+
if (ceremony.tabId !== tabId || !ceremony.hasCredential) {
|
|
155
|
+
throw new WebauthnCeremonyNotFoundError();
|
|
156
|
+
}
|
|
157
|
+
let response;
|
|
158
|
+
try {
|
|
159
|
+
response = await this.webauthnApiService.finish({
|
|
160
|
+
handle: ceremony.handle,
|
|
161
|
+
credential: ceremony.credential,
|
|
162
|
+
name: name,
|
|
163
|
+
});
|
|
164
|
+
} catch (error) {
|
|
165
|
+
if (this.isNameError(error)) {
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
169
|
+
if (this.isExpiredHandleError(error)) {
|
|
170
|
+
throw new WebauthnCeremonyNotFoundError("The pending passkey ceremony has expired.");
|
|
171
|
+
}
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
175
|
+
return response.body;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Is the finish error a validation error on the credential name
|
|
180
|
+
* @private
|
|
181
|
+
* @param {Error} error
|
|
182
|
+
* @returns {boolean}
|
|
183
|
+
*/
|
|
184
|
+
isNameError(error) {
|
|
185
|
+
return error instanceof PassboltApiFetchError && error.data?.code === 400 && Boolean(error.data.body?.name);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Is the finish error the API rejecting the ceremony handle as expired
|
|
190
|
+
* @private
|
|
191
|
+
* @param {Error} error
|
|
192
|
+
* @returns {boolean}
|
|
193
|
+
*/
|
|
194
|
+
isExpiredHandleError(error) {
|
|
195
|
+
return (
|
|
196
|
+
error instanceof PassboltApiFetchError && error.data?.code === 400 && Boolean(error.data.body?.token?.expired)
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Abort the ceremony pending on a tab: drop the record and close the prompt in the content script.
|
|
202
|
+
* @param {number} tabId
|
|
203
|
+
* @returns {Promise<void>}
|
|
204
|
+
*/
|
|
205
|
+
async abort(tabId) {
|
|
206
|
+
const ceremony = await WebauthnSetupCeremonySessionStorageService.get();
|
|
207
|
+
if (ceremony?.tabId !== tabId) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
211
|
+
await this.emitAbort(ceremony);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Tell the app worker of a superseded ceremony's tab that its ceremony ended, since handleResult drops the
|
|
216
|
+
* abort result the content script reports for it; an unreachable worker is logged, not thrown.
|
|
217
|
+
* @private
|
|
218
|
+
* @param {WebauthnSetupCeremonyEntity} ceremony
|
|
219
|
+
* @returns {Promise<void>}
|
|
220
|
+
*/
|
|
221
|
+
async emitSuperseded(ceremony) {
|
|
222
|
+
const error = new WebauthnCeremonyAbortedError("The passkey ceremony was superseded by a new one.");
|
|
223
|
+
try {
|
|
224
|
+
const appWorker = await WorkerService.get(APP_WORKER, ceremony.tabId);
|
|
225
|
+
appWorker.port.emit(CEREMONY_DONE_EVENT, { success: false, result: error });
|
|
226
|
+
} catch (error) {
|
|
227
|
+
console.warn("WebauthnSetupCeremonyService: could not reach the app worker of the superseded ceremony.", error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Tell the content script of the ceremony's tab to abort the ceremony; an unreachable content script is logged,
|
|
233
|
+
* not thrown.
|
|
234
|
+
* @private
|
|
235
|
+
* @param {WebauthnSetupCeremonyEntity} ceremony
|
|
236
|
+
* @returns {Promise<void>}
|
|
237
|
+
*/
|
|
238
|
+
async emitAbort(ceremony) {
|
|
239
|
+
try {
|
|
240
|
+
const worker = await WorkerService.get(APP_BOOTSTRAP_WORKER, ceremony.tabId);
|
|
241
|
+
worker.port.emit(ABORT_CEREMONY_EVENT, { id: ceremony.id });
|
|
242
|
+
} catch (error) {
|
|
243
|
+
console.warn("WebauthnSetupCeremonyService: could not reach the content script to abort the ceremony.", error);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Load the pending ceremony, removing an expired one.
|
|
249
|
+
* @private
|
|
250
|
+
* @throws {WebauthnCeremonyNotFoundError} if there is no unexpired ceremony
|
|
251
|
+
* @returns {Promise<WebauthnSetupCeremonyEntity>}
|
|
252
|
+
*/
|
|
253
|
+
async getPendingCeremony() {
|
|
254
|
+
const ceremony = await WebauthnSetupCeremonySessionStorageService.get();
|
|
255
|
+
if (!ceremony) {
|
|
256
|
+
throw new WebauthnCeremonyNotFoundError();
|
|
257
|
+
}
|
|
258
|
+
if (ceremony.isExpired) {
|
|
259
|
+
await WebauthnSetupCeremonySessionStorageService.flush();
|
|
260
|
+
throw new WebauthnCeremonyNotFoundError("The pending passkey ceremony has expired.");
|
|
261
|
+
}
|
|
262
|
+
return ceremony;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export default WebauthnSetupCeremonyService;
|