@simplito/privmx-webendpoint 2.6.5 → 2.7.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.
Files changed (177) hide show
  1. package/CONTRIBUTING.md +86 -0
  2. package/README.md +97 -7
  3. package/assets/driver-web-context.js +1 -1
  4. package/assets/e2ee-worker.js +1 -1
  5. package/assets/endpoint-wasm-module.js +2 -2
  6. package/assets/endpoint-wasm-module.wasm +0 -0
  7. package/assets/rms-processor.js +1 -0
  8. package/build-manifest.sh +6 -0
  9. package/{FinalizationHelper.js → dist/FinalizationHelper.js} +1 -1
  10. package/dist/ServerTypes.d.ts +7 -0
  11. package/{Types.d.ts → dist/Types.d.ts} +97 -10
  12. package/{Types.js → dist/Types.js} +17 -32
  13. package/{api → dist/api}/Api.d.ts +2 -0
  14. package/{api → dist/api}/Api.js +18 -1
  15. package/{api → dist/api}/ConnectionNative.js +1 -1
  16. package/{api → dist/api}/CryptoApiNative.js +1 -2
  17. package/{api → dist/api}/InboxApiNative.d.ts +21 -2
  18. package/{api → dist/api}/KvdbApiNative.d.ts +19 -2
  19. package/dist/api/NativeError.d.ts +13 -0
  20. package/dist/api/NativeError.js +20 -0
  21. package/{api → dist/api}/StoreApiNative.d.ts +19 -2
  22. package/dist/api/StreamApiNative.d.ts +72 -0
  23. package/dist/api/StreamApiNative.js +142 -0
  24. package/{api → dist/api}/ThreadApiNative.d.ts +19 -2
  25. package/dist/assets/e2ee-worker.js +1 -0
  26. package/dist/bundle/privmx-endpoint-web.js +2 -0
  27. package/dist/bundle/privmx-endpoint-web.js.LICENSE.txt +30 -0
  28. package/dist/bundle/rms-processor.js +1 -0
  29. package/{extra → dist/extra}/PrivmxClient.d.ts +9 -9
  30. package/{extra → dist/extra}/PrivmxClient.js +12 -12
  31. package/{extra → dist/extra}/PublicConnection.d.ts +2 -2
  32. package/{extra → dist/extra}/PublicConnection.js +2 -2
  33. package/{extra → dist/extra}/__tests__/connectionEventManager.test.js +1 -3
  34. package/{extra → dist/extra}/__tests__/customEventManager.test.js +1 -3
  35. package/{extra → dist/extra}/__tests__/userEventManager.test.js +2 -6
  36. package/{extra → dist/extra}/__tests__/utils.test.js +18 -18
  37. package/{extra → dist/extra}/events.js +32 -12
  38. package/{extra → dist/extra}/files.d.ts +5 -5
  39. package/{extra → dist/extra}/files.js +11 -11
  40. package/{extra → dist/extra}/generics.d.ts +1 -1
  41. package/{extra → dist/extra}/inbox.d.ts +1 -1
  42. package/{extra → dist/extra}/inbox.js +2 -2
  43. package/{extra → dist/extra}/index.d.ts +7 -7
  44. package/{extra → dist/extra}/managers.js +1 -1
  45. package/{extra → dist/extra}/utils.js +9 -9
  46. package/{index.d.ts → dist/index.d.ts} +3 -2
  47. package/{index.js → dist/index.js} +4 -1
  48. package/{service → dist/service}/Connection.js +13 -6
  49. package/{service → dist/service}/CryptoApi.js +2 -8
  50. package/{service → dist/service}/EndpointFactory.d.ts +11 -0
  51. package/{service → dist/service}/EndpointFactory.js +45 -10
  52. package/{service → dist/service}/EventApi.js +9 -5
  53. package/dist/service/EventDispatcher.d.ts +15 -0
  54. package/dist/service/EventDispatcher.js +25 -0
  55. package/{service → dist/service}/EventQueue.d.ts +4 -4
  56. package/{service → dist/service}/EventQueue.js +5 -9
  57. package/{service → dist/service}/ExtKey.d.ts +10 -10
  58. package/{service → dist/service}/ExtKey.js +10 -10
  59. package/{service → dist/service}/InboxApi.js +7 -11
  60. package/{service → dist/service}/KvdbApi.js +12 -7
  61. package/{service → dist/service}/StoreApi.js +10 -15
  62. package/dist/service/StreamApi.d.ts +237 -0
  63. package/dist/service/StreamApi.js +442 -0
  64. package/{service → dist/service}/ThreadApi.js +6 -7
  65. package/{service → dist/service}/UserVerifierInterface.d.ts +2 -2
  66. package/dist/service/UserVerifierInterface.js +2 -0
  67. package/dist/service/WebRtcInterface.d.ts +58 -0
  68. package/dist/service/WebRtcInterface.js +8 -0
  69. package/{service → dist/service}/index.d.ts +3 -2
  70. package/{service → dist/service}/index.js +5 -3
  71. package/dist/webStreams/CryptoUtils.d.ts +24 -0
  72. package/dist/webStreams/CryptoUtils.js +58 -0
  73. package/dist/webStreams/KeyStore.d.ts +9 -0
  74. package/dist/webStreams/KeyStore.js +29 -0
  75. package/dist/webStreams/Logger.d.ts +7 -0
  76. package/dist/webStreams/Logger.js +25 -0
  77. package/dist/webStreams/PeerConnectionsManager.d.ts +20 -0
  78. package/dist/webStreams/PeerConnectionsManager.js +92 -0
  79. package/dist/webStreams/Queue.d.ts +19 -0
  80. package/dist/webStreams/Queue.js +70 -0
  81. package/dist/webStreams/Utils.d.ts +20 -0
  82. package/dist/webStreams/Utils.js +211 -0
  83. package/dist/webStreams/WebRtcClient.d.ts +85 -0
  84. package/dist/webStreams/WebRtcClient.js +437 -0
  85. package/dist/webStreams/WebRtcClientTypes.d.ts +64 -0
  86. package/dist/webStreams/WebRtcClientTypes.js +2 -0
  87. package/dist/webStreams/WebRtcConfig.d.ts +20 -0
  88. package/dist/webStreams/WebRtcConfig.js +53 -0
  89. package/dist/webStreams/WebRtcInterfaceImpl.d.ts +28 -0
  90. package/dist/webStreams/WebRtcInterfaceImpl.js +85 -0
  91. package/dist/webStreams/WebWorkerHelper copy.d.ts +0 -0
  92. package/dist/webStreams/WebWorkerHelper copy.js +17 -0
  93. package/dist/webStreams/WebWorkerHelper.d.ts +18 -0
  94. package/dist/webStreams/WebWorkerHelper.js +69 -0
  95. package/dist/webStreams/audio/ActiveSpeakerDetector.d.ts +38 -0
  96. package/dist/webStreams/audio/ActiveSpeakerDetector.js +64 -0
  97. package/dist/webStreams/audio/LocalAudioLevelMeter.d.ts +12 -0
  98. package/dist/webStreams/audio/LocalAudioLevelMeter.js +101 -0
  99. package/dist/webStreams/types/ApiTypes.d.ts +74 -0
  100. package/dist/webStreams/types/ApiTypes.js +2 -0
  101. package/dist/webStreams/types/BaseServerTypes.d.ts +10 -0
  102. package/dist/webStreams/types/BaseServerTypes.js +2 -0
  103. package/dist/webStreams/types/MediaServerWebSocketApiTypes.d.ts +255 -0
  104. package/dist/webStreams/types/MediaServerWebSocketApiTypes.js +2 -0
  105. package/dist/webStreams/types/SignalingReceiverTypes.d.ts +13 -0
  106. package/dist/webStreams/types/SignalingReceiverTypes.js +2 -0
  107. package/dist/webStreams/types/SignalingSenderTypes.d.ts +24 -0
  108. package/dist/webStreams/types/SignalingSenderTypes.js +2 -0
  109. package/dist/webStreams/types/StreamsApiTypes.d.ts +144 -0
  110. package/dist/webStreams/types/StreamsApiTypes.js +2 -0
  111. package/dist/webStreams/worker/WorkerEvents.d.ts +11 -0
  112. package/dist/webStreams/worker/WorkerEvents.js +2 -0
  113. package/dist/webStreams/worker/worker.d.ts +13 -0
  114. package/dist/webStreams/worker/worker.js +202 -0
  115. package/package.json +46 -15
  116. package/assets/endpoint-wasm-module.worker.js +0 -1
  117. package/assets/privmx-endpoint-web.js +0 -2
  118. package/bundle/privmx-endpoint-web.js +0 -2
  119. package/bundle/privmx-endpoint-web.js.LICENSE.txt +0 -10
  120. /package/{FinalizationHelper.d.ts → dist/FinalizationHelper.d.ts} +0 -0
  121. /package/{extra/generics.js → dist/ServerTypes.js} +0 -0
  122. /package/{api → dist/api}/ApiStatic.d.ts +0 -0
  123. /package/{api → dist/api}/ApiStatic.js +0 -0
  124. /package/{api → dist/api}/BaseNative.d.ts +0 -0
  125. /package/{api → dist/api}/BaseNative.js +0 -0
  126. /package/{api → dist/api}/ConnectionNative.d.ts +0 -0
  127. /package/{api → dist/api}/CryptoApiNative.d.ts +0 -0
  128. /package/{api → dist/api}/EventApiNative.d.ts +0 -0
  129. /package/{api → dist/api}/EventApiNative.js +0 -0
  130. /package/{api → dist/api}/EventQueueNative.d.ts +0 -0
  131. /package/{api → dist/api}/EventQueueNative.js +0 -0
  132. /package/{api → dist/api}/ExtKeyNative.d.ts +0 -0
  133. /package/{api → dist/api}/ExtKeyNative.js +0 -0
  134. /package/{api → dist/api}/IdGenerator.d.ts +0 -0
  135. /package/{api → dist/api}/IdGenerator.js +0 -0
  136. /package/{api → dist/api}/InboxApiNative.js +0 -0
  137. /package/{api → dist/api}/KvdbApiNative.js +0 -0
  138. /package/{api → dist/api}/StoreApiNative.js +0 -0
  139. /package/{api → dist/api}/ThreadApiNative.js +0 -0
  140. /package/{bundle.d.ts → dist/bundle.d.ts} +0 -0
  141. /package/{bundle.js → dist/bundle.js} +0 -0
  142. /package/{extra → dist/extra}/__mocks__/constants.d.ts +0 -0
  143. /package/{extra → dist/extra}/__mocks__/constants.js +0 -0
  144. /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.d.ts +0 -0
  145. /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.js +0 -0
  146. /package/{extra → dist/extra}/__mocks__/mockEventQueue.d.ts +0 -0
  147. /package/{extra → dist/extra}/__mocks__/mockEventQueue.js +0 -0
  148. /package/{extra → dist/extra}/__mocks__/utils.d.ts +0 -0
  149. /package/{extra → dist/extra}/__mocks__/utils.js +0 -0
  150. /package/{extra → dist/extra}/__tests__/connectionEventManager.test.d.ts +0 -0
  151. /package/{extra → dist/extra}/__tests__/customEventManager.test.d.ts +0 -0
  152. /package/{extra → dist/extra}/__tests__/eventsManager.test.d.ts +0 -0
  153. /package/{extra → dist/extra}/__tests__/eventsManager.test.js +0 -0
  154. /package/{extra → dist/extra}/__tests__/inboxEventManager.d.ts +0 -0
  155. /package/{extra → dist/extra}/__tests__/inboxEventManager.js +0 -0
  156. /package/{extra → dist/extra}/__tests__/storeEventManager.test.d.ts +0 -0
  157. /package/{extra → dist/extra}/__tests__/storeEventManager.test.js +0 -0
  158. /package/{extra → dist/extra}/__tests__/threadEventManager.test.d.ts +0 -0
  159. /package/{extra → dist/extra}/__tests__/threadEventManager.test.js +0 -0
  160. /package/{extra → dist/extra}/__tests__/userEventManager.test.d.ts +0 -0
  161. /package/{extra → dist/extra}/__tests__/utils.test.d.ts +0 -0
  162. /package/{extra → dist/extra}/events.d.ts +0 -0
  163. /package/{service/UserVerifierInterface.js → dist/extra/generics.js} +0 -0
  164. /package/{extra → dist/extra}/index.js +0 -0
  165. /package/{extra → dist/extra}/managers.d.ts +0 -0
  166. /package/{extra → dist/extra}/subscriptions.d.ts +0 -0
  167. /package/{extra → dist/extra}/subscriptions.js +0 -0
  168. /package/{extra → dist/extra}/utils.d.ts +0 -0
  169. /package/{service → dist/service}/BaseApi.d.ts +0 -0
  170. /package/{service → dist/service}/BaseApi.js +0 -0
  171. /package/{service → dist/service}/Connection.d.ts +0 -0
  172. /package/{service → dist/service}/CryptoApi.d.ts +0 -0
  173. /package/{service → dist/service}/EventApi.d.ts +0 -0
  174. /package/{service → dist/service}/InboxApi.d.ts +0 -0
  175. /package/{service → dist/service}/KvdbApi.d.ts +0 -0
  176. /package/{service → dist/service}/StoreApi.d.ts +0 -0
  177. /package/{service → dist/service}/ThreadApi.d.ts +0 -0
@@ -0,0 +1,86 @@
1
+ # Contributing to PrivMX
2
+
3
+ ## Welcome Contributors! 🎉
4
+
5
+ Thank you for your interest in contributing to our project. This document provides guidelines and instructions for contributing.
6
+
7
+ ## Legal Notice
8
+
9
+ If you want to contribute to the project, you can clone the repository, make changes, and then submit a Pull Request (follow the guidelines below).
10
+ Submitting Pull Requests to SIMPLITO's repositories is the only way of publishing modifications made to our code allowed by our License.
11
+ **All the code contributed to the project is under full commercial ownership of SIMPLITO.**
12
+
13
+ - [Licensing information](https://privmx.dev/licensing)
14
+ - [Contact us](https://privmx.com/en/contact-us) in case of further questions.
15
+
16
+ ## How Can You Contribute?
17
+
18
+ ### Reporting Bugs 🐛
19
+
20
+ 1. **Check Existing Issues**, before submitting a bug report.
21
+ 2. **Provide Detailed Information**, according to the bug report template in each project.
22
+
23
+ ### Feature Requests 💡
24
+
25
+ 1. **Check Existing Suggestions**: Verify that your feature hasn't been suggested before.
26
+ 2. **Open a Clear Issue**, describing it according to the feature request template in each project.
27
+ 3. (Optional) **Open a discussion**, if you want to discuss or make sure that the feature is actually necessary.
28
+
29
+ ### Coding Guidelines 💻
30
+
31
+ - Follow the project's coding style and conventions
32
+ - Write clear, concise, and well-documented code
33
+ - Include comments for complex logic
34
+
35
+ ### Commit Message Conventions
36
+
37
+ - Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
38
+ - Reference issue numbers when applicable
39
+
40
+ ### Pull Request Process
41
+
42
+ 1. **Prepare Your Changes**
43
+
44
+ - Ensure code follows project guidelines
45
+ - Add/update tests as needed
46
+ - Update documentation in code
47
+
48
+ 2. **Submit Pull Request**
49
+
50
+ - Title should be clear and descriptive
51
+ - Include a detailed description of changes
52
+ - Link any related issues
53
+
54
+ 3. **Code Review**
55
+ - Maintainers will review your PR
56
+ - Be open to feedback and suggested changes
57
+ - Discussions and iterations are part of the process
58
+
59
+ ## Semantic Versioning Rules (A.B.C-rcX)
60
+
61
+ - **New Features**: Increment `A` (major) for major changes or incompatible features, `B` (minor) for minor changes (mostly compatible with previous versions).
62
+ - **Consistency**: Main library and wrappers use the same `A` and `B` versioning.
63
+ - **Updates**: `C` changes are fixes and updates without new features; `C` doesn't need to be synchronized between library and wrappers.
64
+ - **Release Candidate (rc)**: `X` represents consecutive release candidates for a given version.
65
+ - **Before Official Release**: Release as `A.B.C-rcX` before final release; changes to new API are possible and update `X`.
66
+ - **Finalizing a Version**: Release stable version when library and wrappers are fully compatible.
67
+ - **Minor Changes (B)**: Increment `B` for small features, replace older functionality, and mark deprecated functions.
68
+ - **Major Changes (A)**: Increment `A` for introducing major changes or features.
69
+
70
+ Read more about versioning in PrivMX in [our docs](https://docs.privmx.dev/docs/latest/start/versioning).
71
+
72
+ ## Additional Resources
73
+
74
+ - [PrivMX Documentation](https://docs.privmx.dev/)
75
+ - [API Reference](https://docs.privmx.dev/docs/latest/start/api-reference)
76
+
77
+ ## Questions?
78
+
79
+ If you have any questions, please:
80
+
81
+ - Check the documentation
82
+ - Open an issue or a discussion in the appropriate repository
83
+
84
+ ---
85
+
86
+ **Thank you for contributing!** 🚀
package/README.md CHANGED
@@ -1,13 +1,103 @@
1
1
  # PrivMX Web Endpoint
2
- PrivMX Web Endpoint is a JavaScript library designed to work in browser environment. It is used by applications and devices which are the ends of PrivMX secure communication channels. It encrypts and decrypts data, manages network connections and provides a functional API on the top of the WebAssembly build made of the native PrivMX Endpoint library written in C++. This allows applications to build their E2EE communication channels based on a few universal, client-side encrypted tools: Threads, Stores, and Inboxes.
3
2
 
4
- For more details, visit the [PrivMX Platform](https://privmx.dev) website and the [PrivMX Web Endpoint](https://github.com/simplito/privmx-webendpoint) repository on GitHub.
3
+ **PrivMX Web Endpoint** is a robust JavaScript library designed for the browser environment. It serves as the client-side gateway to PrivMX Bridge secure communication channels, enabling applications to encrypt, decrypt, and manage data securely.
5
4
 
5
+ Under the hood, it wraps the native **PrivMX Endpoint** library (written in C++) using **WebAssembly (Wasm)**. This architecture ensures high-performance cryptography while providing a developer-friendly JavaScript API.
6
6
 
7
- ---
8
- Copyright © 2024 Simplito sp. z o.o.
7
+ ## Key Features
9
8
 
10
- This software is the part of the [PrivMX Platform](https://privmx.dev).
11
- This software is Licensed under the PrivMX Free License.
9
+ * **End-to-End Encryption (E2EE):** Client-side encryption for all data transfers.
10
+ * **Universal Tools:** Build complex communication logic using simple primitives:
11
+ * **Threads:** For contextual messaging and collaboration.
12
+ * **Stores:** For secure file and data storage.
13
+ * **Inboxes:** For secure, one-way communication with external or anonymous users (e.g., public forms)
14
+ * **Kvdbs:** For encrypted key-value database storage
15
+ * **Events queue:** For real-time updates and system event handling.
12
16
 
13
- See the License for the specific language governing permissions and limitations under the License.
17
+ * **Performance:** Powered by a C++ core compiled to WebAssembly.
18
+ * **Type-Safe:** Fully typed with TypeScript definitions included.
19
+
20
+ ## Installation
21
+
22
+ Install the package via npm:
23
+
24
+ ```bash
25
+ npm install @simplito/privmx-webendpoint
26
+
27
+ ```
28
+
29
+ ### Documentation & Examples
30
+
31
+ * **Getting Started Guide:** [Introduction to PrivMX JS](https://docs.privmx.dev/docs/latest/js/introduction)
32
+ * **API Reference:** [Full API Documentation](https://docs.privmx.dev/docs/latest/reference/webendpoint/api-reference/connection)
33
+
34
+ ## Building
35
+
36
+ If you want to build the library from source, follow these steps.
37
+
38
+ ### Prerequisites
39
+
40
+ * Node.js
41
+ * CMake: Required to build the Wasm core (npm run build:wasm).
42
+ * Clang-format (v18): Required for formatting and linting of C++ code
43
+
44
+ ### Build Scripts
45
+
46
+ The project uses a combined pipeline to compile the C++ core to Wasm and bundle the TypeScript code.
47
+
48
+ | Command | Description |
49
+ | --- | --- |
50
+ | `npm run build` | Runs the full pipeline: Clean -> Build Wasm -> Compile TS -> Bundle Webpack. |
51
+ | `npm run build:wasm` | Compiles the C++ source code to WebAssembly using `scripts/pipeline.sh`. |
52
+ | `npm run build:js` | Compiles TypeScript (`tsc`) and bundles assets (`webpack`). |
53
+ | `npm run watch:types` | Watches for TypeScript changes. |
54
+
55
+ ## Testing
56
+
57
+ The project employs a dual testing strategy: **Jest** for unit logic and **Playwright** for End-to-End (E2E) integration testing.
58
+
59
+ ### Unit Tests
60
+
61
+ Run standard unit tests using Jest:
62
+
63
+ ```bash
64
+ npm test
65
+
66
+ ```
67
+
68
+ ### End-to-End (E2E) Tests
69
+
70
+ E2E tests require a running Docker backend (PrivMX Bridge). The tests use **Playwright** to spin up browser instances and execute scenarios against the local backend.
71
+
72
+ ```bash
73
+ # Run all E2E tests
74
+ npm run test:e2e
75
+
76
+ ```
77
+
78
+ *Note: Ensure Docker is running before executing E2E tests.*
79
+
80
+ ## Linting & Formatting
81
+
82
+ Maintain code quality using ESLint and Prettier:
83
+
84
+ ```bash
85
+ # Check for linting errors
86
+
87
+ # Typescript
88
+ npm run lint
89
+ # C++
90
+ npm run lint:clang-format
91
+
92
+ # Auto-format code
93
+
94
+ # Typescript
95
+ npm run format
96
+ # C++
97
+ npm run format:clang
98
+ ```
99
+
100
+ ## License
101
+
102
+ This software is licensed under the **PrivMX Free License**.
103
+ Copyright © Simplito. All rights reserved.