Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simplito/privmx-webendpoint
JavaScript library designed to work in browser environment, used by PrivMX communication channels
https://github.com/simplito/privmx-webendpoint
communication cryptography end-to-end-encryption privacy web zero-knowledge
Last synced: about 12 hours ago
JSON representation
JavaScript library designed to work in browser environment, used by PrivMX communication channels
- Host: GitHub
- URL: https://github.com/simplito/privmx-webendpoint
- Owner: simplito
- License: other
- Created: 2024-10-24T14:53:27.000Z (21 days ago)
- Default Branch: main
- Last Pushed: 2024-11-06T09:51:15.000Z (9 days ago)
- Last Synced: 2024-11-06T10:52:14.828Z (9 days ago)
- Topics: communication, cryptography, end-to-end-encryption, privacy, web, zero-knowledge
- Language: TypeScript
- Homepage:
- Size: 1.12 MB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## PrivMX Web Endpoint
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.Initialization of the application’s Endpoint requires providing an address of the application’s Bridge and the user's private key.
### Sample usage
The sample code below is an example of how you can start using low-level PrivMX Web Endpoint library and its API.### Initial requirements for connecting with Web Endpoint to PrivMX Bridge
To use the library's elements in a JS app, you have to provide:
1. PrivMX Web Endpoint address (platformUrl):
```
https://
```2. SolutionId:
```
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```3. Make PrivMX Web Endpoint library's assets available for your application:
```
driver-web-context.js
endpoint-wasm-module.wasm
endpoint-wasm-module.worker.js
endpoint-wasm-module.js
privmx-endpoint-web.js
```#### You must also ensure that:
1. There is an appropriate context with assigned users on the Bridge Server side.
2. The users have pairs of public and private keys (`Pubkey` and `PrivKey`) and the user's private key is known in the app.
3. Public keys of all the users are added to the `Context`.
### `sample.js`:
``` js
let listenForEventsPromise;const runSample = (async () => {
const userPrivKey = "";
const userPubKey = " {return {publicMeta: uInt8ToStr(x.publicMeta), privateMeta: uInt8ToStr(x.privateMeta), data: uInt8ToStr(x.data)}}));
});window.addEventListener('libInitialized', () => runSample());
// helpers
function listenForEvents(eventQueue) {
if (!listenForEventsPromise) {
listenForEventsPromise = eventQueue.waitEvent();
listenForEventsPromise.then(result => {
console.log("onEvent", result);
listenForEventsPromise = null;
listenForEvents(eventQueue);
})
}
}function strToUInt8(text) {
return (new TextEncoder()).encode(text);
}function uInt8ToStr(arr) {
return (new TextDecoder()).decode(arr);
}
```
A complete project that uses the above code example can be found [here](https://github.com/simplito/privmx-webendpoint/tree/main/examples/minimal).For more detailed information about API functions, visit https://docs.privmx.dev.