passbolt-browser-extension 5.3.0 → 5.3.2

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/Gruntfile.js +1 -1
  3. package/RELEASE_NOTES.md +29 -48
  4. package/package.json +5 -5
  5. package/src/all/background_page/controller/clipboard/cancelClipboardContentFlushController.js +51 -0
  6. package/src/all/background_page/controller/clipboard/cancelClipboardContentFlushController.test.js +46 -0
  7. package/src/all/background_page/controller/clipboard/copyTemporarilyToClipboardController.js +53 -0
  8. package/src/all/background_page/controller/clipboard/copyTemporarilyToClipboardController.test.js +47 -0
  9. package/src/all/background_page/controller/clipboard/{clipboardController.js → copyToClipboardController.js} +8 -8
  10. package/src/all/background_page/controller/clipboard/copyToClipboardController.test.js +47 -0
  11. package/src/all/background_page/controller/extension/getExtensionVersionController.test.js +1 -1
  12. package/src/all/background_page/controller/metadata/getOrFindMetadataKeysSettingsController.js +53 -0
  13. package/src/all/background_page/controller/metadata/getOrFindMetadataKeysSettingsController.test.js +106 -0
  14. package/src/all/background_page/controller/user/deleteDryRunUserController.js +73 -0
  15. package/src/all/background_page/controller/user/deleteDryRunUserController.test.js +129 -0
  16. package/src/all/background_page/controller/user/deleteUserController.js +76 -0
  17. package/src/all/background_page/controller/user/deleteUserController.test.js +141 -0
  18. package/src/all/background_page/event/actionLogEvents.js +5 -12
  19. package/src/all/background_page/event/appEvents.js +33 -0
  20. package/src/all/background_page/event/findAllForActionLogController.js +58 -0
  21. package/src/all/background_page/event/findAllForActionLogController.test.js +43 -0
  22. package/src/all/background_page/event/quickAccessEvents.js +32 -0
  23. package/src/all/background_page/event/userEvents.js +7 -20
  24. package/src/all/background_page/event/webIntegrationEvents.js +11 -0
  25. package/src/all/background_page/model/actionLog/{actionLogModel.js → findActionLogService.js} +25 -5
  26. package/src/all/background_page/model/actionLog/findActionLogService.test.js +61 -0
  27. package/src/all/background_page/model/comment/commentModel.js +5 -5
  28. package/src/all/background_page/model/entity/actionLog/actionLogsCollection.test.data.js +18 -0
  29. package/src/all/background_page/model/entity/actionLog/defaultActionLogEntity.test.data.js +34 -0
  30. package/src/all/background_page/model/import/resources/resourcesKdbxImportParser.test.js +0 -1
  31. package/src/all/background_page/model/user/userModel.js +0 -60
  32. package/src/all/background_page/pagemod/appPagemod.js +0 -2
  33. package/src/all/background_page/pagemod/appPagemod.test.js +2 -6
  34. package/src/all/background_page/service/alarm/globalAlarmService.js +2 -0
  35. package/src/all/background_page/service/api/actionLog/{actionLogService.js → actionLogApiService.js} +5 -4
  36. package/src/all/background_page/service/api/actionLog/actionLogApiService.test.js +55 -0
  37. package/src/all/background_page/service/api/comment/{commentService.js → commentApiService.js} +6 -7
  38. package/src/all/background_page/service/api/comment/commentApiService.test.js +122 -0
  39. package/src/all/background_page/service/auth/postLogoutService.js +2 -0
  40. package/src/all/background_page/service/auth/postLogoutService.test.js +4 -1
  41. package/src/all/background_page/service/browser/browserService.js +22 -0
  42. package/src/all/background_page/service/clipboard/clipboardProviderService.js +40 -0
  43. package/src/all/background_page/service/clipboard/clipboardProviderService.test.js +61 -0
  44. package/src/all/background_page/service/clipboard/copyToClipboardService.js +123 -0
  45. package/src/all/background_page/service/clipboard/copyToClipboardService.test.js +174 -0
  46. package/src/all/background_page/service/user/deleteUserService.js +97 -0
  47. package/src/all/background_page/service/user/deleteUserService.test.js +178 -0
  48. package/src/chrome/manifest.json +1 -1
  49. package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.js +31 -0
  50. package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.test.js +51 -0
  51. package/src/chrome-mv3/index.js +3 -3
  52. package/src/chrome-mv3/manifest.json +1 -1
  53. package/src/chrome-mv3/offscreens/{fetch.html → offscreen.html} +1 -1
  54. package/src/chrome-mv3/offscreens/{fetch.js → offscreen.js} +2 -2
  55. package/src/chrome-mv3/offscreens/service/clipboard/writeClipobardOffscreenService.js +54 -0
  56. package/src/chrome-mv3/offscreens/service/clipboard/writeClipobardOffscreenService.test.js +56 -0
  57. package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.js +36 -44
  58. package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.test.data.js +0 -1
  59. package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.test.js +90 -120
  60. package/src/chrome-mv3/offscreens/service/offscreen/handleOffscreenRequestService.js +85 -0
  61. package/src/chrome-mv3/offscreens/service/offscreen/handleOffscreenRequestService.test.js +99 -0
  62. package/src/chrome-mv3/polyfill/clipboardOffscreenPolyfill.js +19 -0
  63. package/src/chrome-mv3/serviceWorker/service/clipboard/requestClipboardOffscreenService.js +51 -0
  64. package/src/chrome-mv3/serviceWorker/service/clipboard/requestClipboardOffscreenService.test.js +70 -0
  65. package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.js +25 -0
  66. package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.test.data.js +21 -0
  67. package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.test.js +33 -0
  68. package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.js +25 -50
  69. package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.test.js +16 -39
  70. package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.js +14 -45
  71. package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.test.js +5 -37
  72. package/src/chrome-mv3/serviceWorker/service/offscreen/createOffscreenDocumentService.js +43 -0
  73. package/src/chrome-mv3/serviceWorker/service/offscreen/createOffscreenDocumentService.test.js +48 -0
  74. package/src/chrome-mv3/serviceWorker/service/offscreen/handleOffscreenResponseService.js +119 -0
  75. package/src/chrome-mv3/serviceWorker/service/offscreen/handleOffscreenResponseService.test.js +159 -0
  76. package/src/firefox/manifest.json +1 -1
  77. package/src/safari/manifest.json +1 -1
  78. package/test/jest.setup.js +4 -0
  79. package/test/mocks/mockNavigatorClipboard.js +40 -0
  80. package/test/mocks/mockWebExtensionPolyfill.js +2 -1
  81. package/{webpack-offscreens.fetch.config.js → webpack-offscreens.config.js} +1 -1
  82. package/webpack.service-worker.config.js +1 -0
  83. package/src/all/background_page/controller/clipboard/clipboardController.test.js +0 -68
  84. package/src/all/background_page/event/clipboardEvents.js +0 -28
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [5.3.2] - 2025-07-17
8
+ ### Added
9
+ - PB-25265 Flush clipboard strategy
10
+ - PB-43095 Display the metadata issue in the HealthCheck served by the UI
11
+ - PB-43403 Search resources should take into account available custom fields information in the web application
12
+
13
+ ### Improved
14
+ - PB-43474 As LU I should be able to clear the search field with a button
15
+
16
+ ### Fixed
17
+ - PB-43916 Fix hitting the key enter on the search fields
18
+ - PB-43996 Users should access encrypted metadata section of the administration guide on the help site when clicking on the documentation CTA from the sidebar
19
+
20
+ ### Maintenance
21
+ - PB-43491 The resource activities should use a service worker service to request the service worker
22
+ - PB-43496 The user should be notified if an error occurs while displaying additional resource activities
23
+ - PB-43501 Cover ActionLogService API service and rename class as per naming convention
24
+ - PB-43502 Move logic of ActionLogModel into FindActionLogService
25
+ - PB-43506 Move logic of event passbolt.actionlogs.find-all-for into its dedicated Controller
26
+ - PB-43738 Create DeleteUserService to call the userService deleteDryRun
27
+ - PB-43739 Create DeleteDryRunUserController to call the DeleteUserService
28
+ - PB-43750 An unexpected error should be displayed on delete user
29
+ - PB-43904 Add a service to request or send data CommentsServiceWorkerService
30
+ - PB-43907 Add tests for commentService API service and rename the service class as per naming convention
31
+ - PB-43938 Create a GetOrFindMetadataKeysSettingsController to retrieve the metadata keys settings
32
+ - PB-43940 Create a MetadataKeysSettingsLocalStorageContextProvider to retrieve the metadata keys settings
33
+
7
34
  ## [5.3.0] - 2025-06-09
8
35
 
9
36
  ### Added
@@ -2278,7 +2305,9 @@ self registration settings option in the left-side bar
2278
2305
  - AP: User with plugin installed
2279
2306
  - LU: Logged in user
2280
2307
 
2281
- [Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.2.0...HEAD
2308
+ [Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.3.2...HEAD
2309
+ [5.3.2]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.3.0...v5.3.2
2310
+ [5.3.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.2.0...v5.3.0
2282
2311
  [5.2.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.1.1...v5.2.0
2283
2312
  [5.1.1]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.1.0...v5.1.1
2284
2313
  [5.1.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.0.1...v5.1.0
package/Gruntfile.js CHANGED
@@ -119,7 +119,7 @@ module.exports = function (grunt) {
119
119
  service_worker: {
120
120
  files: [
121
121
  { expand: true, cwd: path.src_chrome_mv3, src: 'serviceWorker.js', dest: path.build + 'serviceWorker' },
122
- { expand: true, cwd: `${path.src_chrome_mv3}/offscreens`, src: 'fetch.html', dest: `${path.build}/offscreens` }
122
+ { expand: true, cwd: `${path.src_chrome_mv3}/offscreens`, src: 'offscreen.html', dest: `${path.build}/offscreens` },
123
123
  ]
124
124
  },
125
125
  web_accessible_resources: {
package/RELEASE_NOTES.md CHANGED
@@ -1,56 +1,37 @@
1
- Release song: https://www.youtube.com/watch?v=ubWL8VAPoYw
1
+ Release song: https://www.youtube.com/watch?v=-GxmblM_jss
2
2
 
3
- Passbolt 5.3 adds custom fields, one of the five most‑requested features from the community. Built on top of encrypted‑metadata introduced earlier this year, custom fields let users attach additional key‑value pairs to a resource or as a standalone one. Typical use‑cases include centralising CI/CD job variables and storing environment‑specific configuration values that need more structure than a general note.
3
+ Passbolt v5.3.2 is a security release designed to strengthen the security posture of your organization. It introduces a clipboard flushing feature, adds safeguards around SSO settings, and addresses issues related to encrypted metadata.
4
4
 
5
- Custom fields rely on encrypted metadata, therefore the feature is still in beta and is not yet available on Passbolt Cloud. A step‑by‑step guide on how to enable the encrypted metadata on a self‑hosted instance will be available in a blog post that will be published soon. The encrypted‑metadata feature is scheduled to be marked as stable in Passbolt 5.4, planned for August 2025.
5
+ The new clipboard flush timer lets you copy secrets just long enough to use them; clipboard data is automatically cleared when the countdown (30s) expires, significantly reducing the risk of accidental exposure or leaks from forgotten clipboard content.
6
6
 
7
- As part of our continuous performance work, this release concentrates on folder browsing. Loading folders and their resources is now faster and reduces the load on API and client, improving day-to-day usability for organizations having thousands of credentials under management.
7
+ Additionally, SSO admin-settings edit endpoints of self-hosted instances can now be locked, reducing potential exposure to scans if an administrator account is compromised. You can verify if this protection is active, and get instructions on how to set it up, by running the health check via the server command line.
8
8
 
9
- Several bugs reported by the community have also been fixed. As always, thank you to everyone who took the time to file issues, test patches and suggest improvements. For a complete list of changes, consult the changelog.
9
+ This update also resolves several encrypted metadata issues, moving the feature closer to general availability. Organizations can now enable encrypted metadata even if users have imported their own more complex keys (e.g. keys that were set to expire at some point), streamlining adoption for advanced users. Admin changes are smoother too: if the original metadata-enabling administrator leaves, newly invited users will still receive the metadata key automatically, removing the need for manual distribution. Lastly, users who owned shared resources using the new encrypted metadata format can now be deleted without issue, as ownership transfer is now handled correctly during the deletion process.
10
+
11
+ A big thank you to all testers who helped refine these features. If you’re new to any of them, we welcome your feedback on the community forum or through your usual support channels!
10
12
 
11
13
  ### Added
12
- - PB-43269 Create the entity CustomFieldEntity
13
- - PB-43271 Create the entity collection CustomFieldsCollection
14
- - PB-43273 Create the entity SecretDataV5StandaloneCustomFieldsCollection
15
- - PB-43275 Update the resource types schema definitions
16
- - PB-43277 Update the ResourceMetadataEntity
17
- - PB-43278 Update the ResourceFormEntity
18
- - PB-43279 Update the Secret Entities
19
- - PB-43283 Display a new entry the create/edit dialog to set custom fields on the left sidebar and the menu
20
- - PB-43284 Create the CustomFieldForm for the create/edit dialog
21
- - PB-43285 Handle the CustomFieldForm warnings and limitation
22
- - PB-43286 Update create/edit resource to select secret custom fields for a standalone custom fields
23
- - PB-43287 Display the Custom Fields section on the right sidebar
24
- - PB-43289 Display standalone custom fields in the component DisplayResourceCreationMenu
25
- - PB-43290 Display standalone custom fields in the component DisplayResourcesWorkspaceMainMenu
26
- - PB-43291 Display the URIs section in the right sidebar
27
- - PB-43374 Add validation on keys and values of each elements of custom fields for the resource form entity
28
- - PB-43377 Add set collection into entity v2
29
- - PB-43145 Find a list of resources based on IDs and that are suitable for local storage from the API
30
- - PB-43146 Find a list of resources based on a parent folder id and that are suitable for the local storage from the API
31
- - PB-43133 Display padding below tags in resource workspace left sidebar
32
- - PB-42185 The folder caret that expands or collapses folders in the tree should have a larger clickable area to make it easier to use
33
- - PB-43222 Improve the group dialog to match the new share dimensions
34
- - PB-43147 Find and update resources based on parent folder id for the local storage
35
- - PB-43148 Create a connector for finding resources based on a parent id for the styleguide to call it later
36
- - PB-43149 Create a ResourcesServiceWorkerService to call the service worker for resource related operations
37
- - PB-43150 Implement the optimised call in the Styleguide when filtering by a folder
38
- - PB-43151 Optimise the data retrieved from the API such that updates are not done if unnecessary
39
- - PB-43156 Clarify implications for backups and other devices before changing the passphrase in the user settings workspace
40
- - PB-43489 Display unexpected error if there is any issue during the secret decryption
14
+ - PB-25265 Flush clipboard strategy
15
+ - PB-43095 Display the metadata issue in the HealthCheck served by the UI
16
+ - PB-43403 Search resources should take into account available custom fields information in the web application
17
+
18
+ ### Improved
19
+ - PB-43474 As LU I should be able to clear the search field with a button
41
20
 
42
21
  ### Fixed
43
- - PB-43109 Fix: from the sidebar when upgrade from v4 to v5 goes wrong the error message in the notification
44
- - PB-43118 Hide the "Share metadata keys" button in the users workspace action bar for the current signed-in user
45
- - PB-43215 Fix account recovery creator name
46
- - PB-43063 Fix group edit dialog double warning message has broken UI
47
- - PB-43117 Hide the "Share metadata keys" button in the users workspace action bar after sharing missing metadata keys with a user
48
- - PB-43064 Fix group edit dialog can show a mix of error and warning messages
49
- - PB-43150: fix folder not being reloaded
50
- - PB-43424 Clicking on the "open in a new tab” call to action in the quick application should open the resource url in a new tab
51
- - PB-43108 Display attention required icon on "metadata keys" label in the user details sidebar if the user is not having access to some metadata keys
52
- - PB-43217 The default icon stroke width is too thick in the grid and doesn't match the custom icons
53
- - PB-43220 Copy URL field action button lacks padding and is broken in the SSO settings
54
- - PB-43168 Align vertically resources workspace select check-boxes
55
- - PB-43211 The feedback message notifying the administrator when a metadata key has been shared with a user contains a typo
56
- - PB-43471 Center vertically the icon on the create and edit dialog
22
+ - PB-43916 Fix hitting the key enter on the search fields
23
+ - PB-43996 Users should access encrypted metadata section of the administration guide on the help site when clicking on the documentation CTA from the sidebar
24
+
25
+ ### Maintenance
26
+ - PB-43491 The resource activities should use a service worker service to request the service worker
27
+ - PB-43496 The user should be notified if an error occurs while displaying additional resource activities
28
+ - PB-43501 Cover ActionLogService API service and rename class as per naming convention
29
+ - PB-43502 Move logic of ActionLogModel into FindActionLogService
30
+ - PB-43506 Move logic of event passbolt.actionlogs.find-all-for into its dedicated Controller
31
+ - PB-43738 Create DeleteUserService to call the userService deleteDryRun
32
+ - PB-43739 Create DeleteDryRunUserController to call the DeleteUserService
33
+ - PB-43750 An unexpected error should be displayed on delete user
34
+ - PB-43904 Add a service to request or send data CommentsServiceWorkerService
35
+ - PB-43907 Add tests for commentService API service and rename the service class as per naming convention
36
+ - PB-43938 Create a GetOrFindMetadataKeysSettingsController to retrieve the metadata keys settings
37
+ - PB-43940 Create a MetadataKeysSettingsLocalStorageContextProvider to retrieve the metadata keys settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passbolt-browser-extension",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "license": "AGPL-3.0",
5
5
  "copyright": "Copyright 2025 Passbolt SA",
6
6
  "description": "Passbolt web extension for the open source password manager for teams",
@@ -22,7 +22,7 @@
22
22
  "locutus": "~2.0.9",
23
23
  "openpgp": "^6.1.1",
24
24
  "papaparse": "^5.5.2",
25
- "passbolt-styleguide": "^5.3.1",
25
+ "passbolt-styleguide": "^5.3.2",
26
26
  "react": "17.0.2",
27
27
  "react-dom": "17.0.2",
28
28
  "secrets-passbolt": "github:passbolt/secrets.js#v2.0.1",
@@ -80,7 +80,7 @@
80
80
  "scripts": {
81
81
  "build": "npx grunt build",
82
82
  "build:background-page": "webpack --config webpack.background-page.config.js",
83
- "build:service-worker": "webpack --config webpack.service-worker.config.js; webpack --config webpack-offscreens.fetch.config.js",
83
+ "build:service-worker": "webpack --config webpack.service-worker.config.js; webpack --config webpack-offscreens.config.js",
84
84
  "build:content-scripts": "npm run build:content-scripts:app; npm run build:content-scripts:browser-integration; npm run build:content-scripts:public-website",
85
85
  "build:content-scripts:app": "webpack --config webpack-content-scripts.config.js",
86
86
  "build:content-scripts:browser-integration": "webpack --config webpack-content-scripts.browser-integration.config.js",
@@ -89,7 +89,7 @@
89
89
  "build:web-accessible-resources:app": "webpack --config webpack-data.config.js; webpack --config webpack-data.download.config.js",
90
90
  "build:web-accessible-resources:browser-integration": "webpack --config webpack-data.in-form-call-to-action.config.js; webpack --config webpack-data.in-form-menu.config.js",
91
91
  "dev:build:background-page": "webpack --env debug=true --config webpack.background-page.config.js",
92
- "dev:build:service-worker": "webpack --env debug=true --config webpack.service-worker.config.js; webpack --env debug=true --config webpack-offscreens.fetch.config.js",
92
+ "dev:build:service-worker": "webpack --env debug=true --config webpack.service-worker.config.js; webpack --env debug=true --config webpack-offscreens.config.js",
93
93
  "dev:build:content-scripts": "npm run dev:build:content-scripts:app; npm run dev:build:content-scripts:browser-integration; npm run dev:build:content-scripts:public-website",
94
94
  "dev:build:content-scripts:app": "webpack --env debug=true --config webpack-content-scripts.config.js",
95
95
  "dev:build:content-scripts:browser-integration": "webpack --env debug=true --config webpack-content-scripts.browser-integration.config.js",
@@ -112,7 +112,7 @@
112
112
  "lint:eslint-fix": "eslint -c .eslintrc.json --ext js --ext jsx --fix src",
113
113
  "i18n:externalize": "i18next -c ./i18next-parser.config.js",
114
114
  "test": "npm run test:unit",
115
- "test:unit": "jest --no-cache ./src/all/ ./src/chrome-mv3/",
115
+ "test:unit": "jest --no-cache ./src/all/ ./src/chrome-mv3/ ./src/chrome/",
116
116
  "test:coverage": "jest --no-cache ./src/all/ ./src/chrome-mv3/ --coverage",
117
117
  "test:ci:coverage": "npm run test:coverage -- --runInBand"
118
118
  }
@@ -0,0 +1,51 @@
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.3.2
13
+ */
14
+
15
+ import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
16
+
17
+ export default class CancelClipboardContentFlushController {
18
+ /**
19
+ * CancelClipboardContentFlushController constructor
20
+ * @param {Worker} worker
21
+ * @param {string} requestId uuid
22
+ */
23
+ constructor(worker, requestId) {
24
+ this.worker = worker;
25
+ this.requestId = requestId;
26
+ this.copyToClipboardService = new CopyToClipboardService();
27
+ }
28
+
29
+ /**
30
+ * Wrapper of exec function to run it with worker.
31
+ * @return {Promise<void>}
32
+ */
33
+ async _exec() {
34
+ try {
35
+ await this.exec();
36
+ this.worker.port.emit(this.requestId, "SUCCESS");
37
+ } catch (error) {
38
+ console.error(error);
39
+ this.worker.port.emit(this.requestId, "ERROR", error);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Cancel flushing of the clipboard content
45
+ *
46
+ * @return {Promise<void>}
47
+ */
48
+ async exec() {
49
+ await this.copyToClipboardService.clearAlarm();
50
+ }
51
+ }
@@ -0,0 +1,46 @@
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.3.2
13
+ */
14
+
15
+ import {v4 as uuidv4} from 'uuid';
16
+ import CancelClipboardContentFlushController from './cancelClipboardContentFlushController';
17
+
18
+ describe('CancelClipboardContentFlushController', () => {
19
+ describe('constructor', () => {
20
+ it('should set the worker and requestId properties', () => {
21
+ expect.assertions(2);
22
+
23
+ const worker = {port: {}};
24
+ const requestId = uuidv4();
25
+ const controller = new CancelClipboardContentFlushController(worker, requestId);
26
+
27
+ expect(controller.worker).toBe(worker);
28
+ expect(controller.requestId).toBe(requestId);
29
+ });
30
+ });
31
+
32
+ describe('exec', () => {
33
+ it('should call copyTemporarily of the right service', async() => {
34
+ expect.assertions(1);
35
+
36
+ const toCopy = "text";
37
+ const controller = new CancelClipboardContentFlushController();
38
+
39
+ jest.spyOn(controller.copyToClipboardService, "clearAlarm").mockImplementation(() => {});
40
+
41
+ await controller.exec(toCopy);
42
+
43
+ expect(controller.copyToClipboardService.clearAlarm).toHaveBeenCalledTimes(1);
44
+ });
45
+ });
46
+ });
@@ -0,0 +1,53 @@
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.3.2
13
+ */
14
+
15
+ import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
16
+
17
+ export default class CopyTemporarilyToClipboardController {
18
+ /**
19
+ * CopyTemporarilyToClipboardController constructor
20
+ * @param {Worker} worker
21
+ * @param {string} requestId uuid
22
+ */
23
+ constructor(worker, requestId) {
24
+ this.worker = worker;
25
+ this.requestId = requestId;
26
+ this.copyToClipboardService = new CopyToClipboardService();
27
+ }
28
+
29
+ /**
30
+ * Wrapper of exec function to run it with worker.
31
+ * @param text {string} The text to copy
32
+ * @return {Promise<void>}
33
+ */
34
+ async _exec(text) {
35
+ try {
36
+ await this.exec(text);
37
+ this.worker.port.emit(this.requestId, "SUCCESS");
38
+ } catch (error) {
39
+ console.error(error);
40
+ this.worker.port.emit(this.requestId, "ERROR", error);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Temporarily copy text to clipboard
46
+ *
47
+ * @param text {string} The text to copy
48
+ * @return {Promise<void>}
49
+ */
50
+ async exec(text) {
51
+ await this.copyToClipboardService.copyTemporarily(text);
52
+ }
53
+ }
@@ -0,0 +1,47 @@
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.3.2
13
+ */
14
+
15
+ import {v4 as uuidv4} from 'uuid';
16
+ import CopyTemporarilyToClipboardController from './copyTemporarilyToClipboardController';
17
+
18
+ describe('CopyTemporarilyToClipboardController', () => {
19
+ describe('constructor', () => {
20
+ it('should set the worker and requestId properties', () => {
21
+ expect.assertions(2);
22
+
23
+ const worker = {port: {}};
24
+ const requestId = uuidv4();
25
+ const controller = new CopyTemporarilyToClipboardController(worker, requestId);
26
+
27
+ expect(controller.worker).toBe(worker);
28
+ expect(controller.requestId).toBe(requestId);
29
+ });
30
+ });
31
+
32
+ describe('exec', () => {
33
+ it('should call copyTemporarily of the right service', async() => {
34
+ expect.assertions(2);
35
+
36
+ const toCopy = "text";
37
+ const controller = new CopyTemporarilyToClipboardController();
38
+
39
+ jest.spyOn(controller.copyToClipboardService, "copyTemporarily").mockImplementation(() => {});
40
+
41
+ await controller.exec(toCopy);
42
+
43
+ expect(controller.copyToClipboardService.copyTemporarily).toHaveBeenCalledTimes(1);
44
+ expect(controller.copyToClipboardService.copyTemporarily).toHaveBeenCalledWith(toCopy);
45
+ });
46
+ });
47
+ });
@@ -12,21 +12,23 @@
12
12
  * @since 3.9.0
13
13
  */
14
14
 
15
+ import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
15
16
 
16
- class ClipboardController {
17
+ export default class CopyToClipboardController {
17
18
  /**
18
- * ClipboardController constructor
19
+ * CopyToClipboardController constructor
19
20
  * @param {Worker} worker
20
21
  * @param {string} requestId uuid
21
22
  */
22
23
  constructor(worker, requestId) {
23
24
  this.worker = worker;
24
25
  this.requestId = requestId;
26
+ this.copyToClipboardService = new CopyToClipboardService();
25
27
  }
26
28
 
27
29
  /**
28
30
  * Wrapper of exec function to run it with worker.
29
- * @param text {object} The text to copy
31
+ * @param text {string} The text to copy
30
32
  * @return {Promise<void>}
31
33
  */
32
34
  async _exec(text) {
@@ -42,12 +44,10 @@ class ClipboardController {
42
44
  /**
43
45
  * Copy text to clipboard
44
46
  *
45
- * @param text {object} The text to copy
46
- * @return {Void}
47
+ * @param text {string} The text to copy
48
+ * @return {Promise<void>}
47
49
  */
48
50
  async exec(text) {
49
- await navigator.clipboard.writeText(text);
51
+ await this.copyToClipboardService.copy(text);
50
52
  }
51
53
  }
52
-
53
- export default ClipboardController;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Passbolt ~ Open source password manager for teams
3
+ * Copyright (c) 2023 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) 2023 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 3.9.0
13
+ */
14
+
15
+ import {v4 as uuidv4} from 'uuid';
16
+ import CopyToClipboardController from './copyToClipboardController';
17
+
18
+ describe('CopyToClipboardController', () => {
19
+ describe('constructor', () => {
20
+ it('should set the worker and requestId properties', () => {
21
+ expect.assertions(2);
22
+
23
+ const worker = {port: {}};
24
+ const requestId = uuidv4();
25
+ const controller = new CopyToClipboardController(worker, requestId);
26
+
27
+ expect(controller.worker).toBe(worker);
28
+ expect(controller.requestId).toBe(requestId);
29
+ });
30
+ });
31
+
32
+ describe('exec', () => {
33
+ it('should call copy on the right service', async() => {
34
+ expect.assertions(2);
35
+
36
+ const toCopy = "text";
37
+ const controller = new CopyToClipboardController();
38
+
39
+ jest.spyOn(controller.copyToClipboardService, "copy").mockImplementation(() => {});
40
+
41
+ await controller.exec(toCopy);
42
+
43
+ expect(controller.copyToClipboardService.copy).toHaveBeenCalledTimes(1);
44
+ expect(controller.copyToClipboardService.copy).toHaveBeenCalledWith(toCopy);
45
+ });
46
+ });
47
+ });
@@ -22,7 +22,7 @@ describe("GetExtensionVersionController", () => {
22
22
  const version = await controller.exec();
23
23
 
24
24
  expect.assertions(1);
25
- await expect(version).toEqual("v3.6.0");
25
+ expect(version).toEqual("5.3.0");
26
26
  });
27
27
  });
28
28
  });
@@ -0,0 +1,53 @@
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.4.0
13
+ */
14
+ import GetOrFindMetadataSettingsService from "../../service/metadata/getOrFindMetadataSettingsService";
15
+
16
+ class GetOrFindMetadataKeysController {
17
+ /**
18
+ * @constructor
19
+ * @param {Worker} worker
20
+ * @param {string} requestId
21
+ * @param {ApiClientOptions} apiClientOptions the api client options
22
+ * @param {AccountEntity} account the user account
23
+ */
24
+ constructor(worker, requestId, apiClientOptions, account) {
25
+ this.worker = worker;
26
+ this.requestId = requestId;
27
+ this.getOrFindMetadaSettingsService = new GetOrFindMetadataSettingsService(account, apiClientOptions);
28
+ }
29
+
30
+ /**
31
+ * Controller executor.
32
+ * @returns {Promise<void>}
33
+ */
34
+ async _exec() {
35
+ try {
36
+ const result = await this.exec();
37
+ this.worker.port.emit(this.requestId, 'SUCCESS', result);
38
+ } catch (error) {
39
+ console.error(error);
40
+ this.worker.port.emit(this.requestId, 'ERROR', error);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Get or find the metadata keys settings entity.
46
+ * @returns {Promise<MetadataKeysSettingsEntity>}
47
+ */
48
+ async exec() {
49
+ return this.getOrFindMetadaSettingsService.getOrFindKeysSettings();
50
+ }
51
+ }
52
+
53
+ export default GetOrFindMetadataKeysController;