@simplito/privmx-webendpoint 2.6.4 → 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.
- package/CONTRIBUTING.md +86 -0
- package/README.md +97 -7
- package/assets/driver-web-context.js +1 -1
- package/assets/e2ee-worker.js +1 -1
- package/assets/endpoint-wasm-module.js +3 -3
- package/assets/endpoint-wasm-module.wasm +0 -0
- package/assets/rms-processor.js +1 -0
- package/build-manifest.sh +6 -0
- package/{FinalizationHelper.js → dist/FinalizationHelper.js} +1 -1
- package/dist/ServerTypes.d.ts +7 -0
- package/{Types.d.ts → dist/Types.d.ts} +97 -10
- package/{Types.js → dist/Types.js} +17 -32
- package/{api → dist/api}/Api.d.ts +2 -0
- package/{api → dist/api}/Api.js +18 -1
- package/{api → dist/api}/ConnectionNative.js +1 -1
- package/{api → dist/api}/CryptoApiNative.js +1 -2
- package/{api → dist/api}/InboxApiNative.d.ts +21 -2
- package/{api → dist/api}/KvdbApiNative.d.ts +19 -2
- package/dist/api/NativeError.d.ts +13 -0
- package/dist/api/NativeError.js +20 -0
- package/{api → dist/api}/StoreApiNative.d.ts +19 -2
- package/dist/api/StreamApiNative.d.ts +72 -0
- package/dist/api/StreamApiNative.js +142 -0
- package/{api → dist/api}/ThreadApiNative.d.ts +19 -2
- package/dist/assets/e2ee-worker.js +1 -0
- package/dist/bundle/privmx-endpoint-web.js +2 -0
- package/dist/bundle/privmx-endpoint-web.js.LICENSE.txt +30 -0
- package/dist/bundle/rms-processor.js +1 -0
- package/{extra → dist/extra}/PrivmxClient.d.ts +9 -9
- package/{extra → dist/extra}/PrivmxClient.js +12 -12
- package/{extra → dist/extra}/PublicConnection.d.ts +2 -2
- package/{extra → dist/extra}/PublicConnection.js +2 -2
- package/{extra → dist/extra}/__tests__/connectionEventManager.test.js +1 -3
- package/{extra → dist/extra}/__tests__/customEventManager.test.js +1 -3
- package/{extra → dist/extra}/__tests__/userEventManager.test.js +2 -6
- package/{extra → dist/extra}/__tests__/utils.test.js +18 -18
- package/{extra → dist/extra}/events.js +32 -12
- package/{extra → dist/extra}/files.d.ts +5 -5
- package/{extra → dist/extra}/files.js +11 -11
- package/{extra → dist/extra}/generics.d.ts +1 -1
- package/{extra → dist/extra}/inbox.d.ts +1 -1
- package/{extra → dist/extra}/inbox.js +2 -2
- package/{extra → dist/extra}/index.d.ts +7 -7
- package/{extra → dist/extra}/managers.js +1 -1
- package/{extra → dist/extra}/utils.js +9 -9
- package/{index.d.ts → dist/index.d.ts} +3 -2
- package/{index.js → dist/index.js} +4 -1
- package/{service → dist/service}/Connection.js +13 -6
- package/{service → dist/service}/CryptoApi.js +2 -8
- package/{service → dist/service}/EndpointFactory.d.ts +11 -0
- package/{service → dist/service}/EndpointFactory.js +45 -10
- package/{service → dist/service}/EventApi.js +9 -5
- package/dist/service/EventDispatcher.d.ts +15 -0
- package/dist/service/EventDispatcher.js +25 -0
- package/{service → dist/service}/EventQueue.d.ts +4 -4
- package/{service → dist/service}/EventQueue.js +5 -9
- package/{service → dist/service}/ExtKey.d.ts +10 -10
- package/{service → dist/service}/ExtKey.js +10 -10
- package/{service → dist/service}/InboxApi.js +7 -11
- package/{service → dist/service}/KvdbApi.js +12 -7
- package/{service → dist/service}/StoreApi.js +10 -15
- package/dist/service/StreamApi.d.ts +237 -0
- package/dist/service/StreamApi.js +442 -0
- package/{service → dist/service}/ThreadApi.js +6 -7
- package/{service → dist/service}/UserVerifierInterface.d.ts +2 -2
- package/dist/service/UserVerifierInterface.js +2 -0
- package/dist/service/WebRtcInterface.d.ts +58 -0
- package/dist/service/WebRtcInterface.js +8 -0
- package/{service → dist/service}/index.d.ts +3 -2
- package/{service → dist/service}/index.js +5 -3
- package/dist/webStreams/CryptoUtils.d.ts +24 -0
- package/dist/webStreams/CryptoUtils.js +58 -0
- package/dist/webStreams/KeyStore.d.ts +9 -0
- package/dist/webStreams/KeyStore.js +29 -0
- package/dist/webStreams/Logger.d.ts +7 -0
- package/dist/webStreams/Logger.js +25 -0
- package/dist/webStreams/PeerConnectionsManager.d.ts +20 -0
- package/dist/webStreams/PeerConnectionsManager.js +92 -0
- package/dist/webStreams/Queue.d.ts +19 -0
- package/dist/webStreams/Queue.js +70 -0
- package/dist/webStreams/Utils.d.ts +20 -0
- package/dist/webStreams/Utils.js +211 -0
- package/dist/webStreams/WebRtcClient.d.ts +85 -0
- package/dist/webStreams/WebRtcClient.js +437 -0
- package/dist/webStreams/WebRtcClientTypes.d.ts +64 -0
- package/dist/webStreams/WebRtcClientTypes.js +2 -0
- package/dist/webStreams/WebRtcConfig.d.ts +20 -0
- package/dist/webStreams/WebRtcConfig.js +53 -0
- package/dist/webStreams/WebRtcInterfaceImpl.d.ts +28 -0
- package/dist/webStreams/WebRtcInterfaceImpl.js +85 -0
- package/dist/webStreams/WebWorkerHelper copy.d.ts +0 -0
- package/dist/webStreams/WebWorkerHelper copy.js +17 -0
- package/dist/webStreams/WebWorkerHelper.d.ts +18 -0
- package/dist/webStreams/WebWorkerHelper.js +69 -0
- package/dist/webStreams/audio/ActiveSpeakerDetector.d.ts +38 -0
- package/dist/webStreams/audio/ActiveSpeakerDetector.js +64 -0
- package/dist/webStreams/audio/LocalAudioLevelMeter.d.ts +12 -0
- package/dist/webStreams/audio/LocalAudioLevelMeter.js +101 -0
- package/dist/webStreams/types/ApiTypes.d.ts +74 -0
- package/dist/webStreams/types/ApiTypes.js +2 -0
- package/dist/webStreams/types/BaseServerTypes.d.ts +10 -0
- package/dist/webStreams/types/BaseServerTypes.js +2 -0
- package/dist/webStreams/types/MediaServerWebSocketApiTypes.d.ts +255 -0
- package/dist/webStreams/types/MediaServerWebSocketApiTypes.js +2 -0
- package/dist/webStreams/types/SignalingReceiverTypes.d.ts +13 -0
- package/dist/webStreams/types/SignalingReceiverTypes.js +2 -0
- package/dist/webStreams/types/SignalingSenderTypes.d.ts +24 -0
- package/dist/webStreams/types/SignalingSenderTypes.js +2 -0
- package/dist/webStreams/types/StreamsApiTypes.d.ts +144 -0
- package/dist/webStreams/types/StreamsApiTypes.js +2 -0
- package/dist/webStreams/worker/WorkerEvents.d.ts +11 -0
- package/dist/webStreams/worker/WorkerEvents.js +2 -0
- package/dist/webStreams/worker/worker.d.ts +13 -0
- package/dist/webStreams/worker/worker.js +202 -0
- package/package.json +46 -15
- package/assets/endpoint-wasm-module.worker.js +0 -1
- package/assets/privmx-endpoint-web.js +0 -2
- package/bundle/privmx-endpoint-web.js +0 -2
- package/bundle/privmx-endpoint-web.js.LICENSE.txt +0 -10
- /package/{FinalizationHelper.d.ts → dist/FinalizationHelper.d.ts} +0 -0
- /package/{extra/generics.js → dist/ServerTypes.js} +0 -0
- /package/{api → dist/api}/ApiStatic.d.ts +0 -0
- /package/{api → dist/api}/ApiStatic.js +0 -0
- /package/{api → dist/api}/BaseNative.d.ts +0 -0
- /package/{api → dist/api}/BaseNative.js +0 -0
- /package/{api → dist/api}/ConnectionNative.d.ts +0 -0
- /package/{api → dist/api}/CryptoApiNative.d.ts +0 -0
- /package/{api → dist/api}/EventApiNative.d.ts +0 -0
- /package/{api → dist/api}/EventApiNative.js +0 -0
- /package/{api → dist/api}/EventQueueNative.d.ts +0 -0
- /package/{api → dist/api}/EventQueueNative.js +0 -0
- /package/{api → dist/api}/ExtKeyNative.d.ts +0 -0
- /package/{api → dist/api}/ExtKeyNative.js +0 -0
- /package/{api → dist/api}/IdGenerator.d.ts +0 -0
- /package/{api → dist/api}/IdGenerator.js +0 -0
- /package/{api → dist/api}/InboxApiNative.js +0 -0
- /package/{api → dist/api}/KvdbApiNative.js +0 -0
- /package/{api → dist/api}/StoreApiNative.js +0 -0
- /package/{api → dist/api}/ThreadApiNative.js +0 -0
- /package/{bundle.d.ts → dist/bundle.d.ts} +0 -0
- /package/{bundle.js → dist/bundle.js} +0 -0
- /package/{extra → dist/extra}/__mocks__/constants.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/constants.js +0 -0
- /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/mockContainerSubscriber.js +0 -0
- /package/{extra → dist/extra}/__mocks__/mockEventQueue.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/mockEventQueue.js +0 -0
- /package/{extra → dist/extra}/__mocks__/utils.d.ts +0 -0
- /package/{extra → dist/extra}/__mocks__/utils.js +0 -0
- /package/{extra → dist/extra}/__tests__/connectionEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/customEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/eventsManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/eventsManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/inboxEventManager.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/inboxEventManager.js +0 -0
- /package/{extra → dist/extra}/__tests__/storeEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/storeEventManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/threadEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/threadEventManager.test.js +0 -0
- /package/{extra → dist/extra}/__tests__/userEventManager.test.d.ts +0 -0
- /package/{extra → dist/extra}/__tests__/utils.test.d.ts +0 -0
- /package/{extra → dist/extra}/events.d.ts +0 -0
- /package/{service/UserVerifierInterface.js → dist/extra/generics.js} +0 -0
- /package/{extra → dist/extra}/index.js +0 -0
- /package/{extra → dist/extra}/managers.d.ts +0 -0
- /package/{extra → dist/extra}/subscriptions.d.ts +0 -0
- /package/{extra → dist/extra}/subscriptions.js +0 -0
- /package/{extra → dist/extra}/utils.d.ts +0 -0
- /package/{service → dist/service}/BaseApi.d.ts +0 -0
- /package/{service → dist/service}/BaseApi.js +0 -0
- /package/{service → dist/service}/Connection.d.ts +0 -0
- /package/{service → dist/service}/CryptoApi.d.ts +0 -0
- /package/{service → dist/service}/EventApi.d.ts +0 -0
- /package/{service → dist/service}/InboxApi.d.ts +0 -0
- /package/{service → dist/service}/KvdbApi.d.ts +0 -0
- /package/{service → dist/service}/StoreApi.d.ts +0 -0
- /package/{service → dist/service}/ThreadApi.d.ts +0 -0
package/CONTRIBUTING.md
ADDED
|
@@ -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
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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.
|