Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #315

Merged
merged 5 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ Demo: https://chat-e2ee-2.azurewebsites.net
2. Data is **not** stored on any remote server, encrypted data is just relayed to other users, the data can't be decrypted by any man in the middle.
4. **No history** i.e. once chat is closed the data is not recoverable, however encrypted data can be found on memory trace. [Read More](https://github.com/muke1908/chat-e2ee/wiki/How-and-when-your-data-can-be-compromised%3F)

:boom: **Spin up your own frontend**:
- JS SDK and use chat-e2ee backend as service - `@chate2ee/service` [Read Documentation](https://github.com/muke1908/chat-e2ee/tree/master/service)
## :star: JS SDK
[<img align="center" width="200" src="https://i.imgur.com/O3Wr6fK.png">](https://github.com/muke1908/chat-e2ee/tree/master/service)

**Spin up your own frontend**:
JS SDK and use chat-e2ee backend as service - `@chate2ee/service`
[ :page_with_curl: Documentation](https://github.com/muke1908/chat-e2ee/tree/master/service)

---

Expand Down
38 changes: 22 additions & 16 deletions service/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# SDK
<p align="center">
<img align="center" width="300" src="https://i.imgur.com/O3Wr6fK.png">
</p>


This is a client-side SDK to interact with chat-e2ee service. It allows dev to build own chat client on top of chate2ee service. It uses [socket.io](https://socket.io/) for websocket connection.

[![npm version](https://img.shields.io/npm/v/@chat-e2ee/service.svg)](https://www.npmjs.com/package/@chat-e2ee/service)
Expand All @@ -7,28 +11,13 @@ This is a client-side SDK to interact with chat-e2ee service. It allows dev to b
npm i @chat-e2ee/service
```

### Usage:

`@chat-e2ee/service` exports the following modules:
- createChatInstance - core chat ops.
- utils
- generateUUID - util func to generate UUID.
- decryptMessage - to decrypt encrypted messages.
- setConfig - configuration - set URLs i.e. API endpoints, debugging etc.

`@chat-e2ee/service` will make request to `/` in local env and to [hosted server](https://chat-e2ee-2.azurewebsites.net) in production env by default. If you want to use a custom server, use `setConfig({ apiURL, socketURL });`

`config` follows:
```
{
apiURL: string | null,
socketURL: string | null,
settings: {
disableLog: boolean,
}
}
```

### Example and flow:
#### 1. Import and initialize the SDK:
```
Expand Down Expand Up @@ -137,6 +126,23 @@ chate2ee.on('delivered', (id) => {
```


---

### Config:
Call setConfig with config object to override default config parameters.

`config` follows:
```
{
apiURL: string | null,
socketURL: string | null,
settings: {
disableLog: boolean,
}
}
```
Note that `@chat-e2ee/service` will make request to `/` in local env and to [hosted server](https://chat-e2ee-2.azurewebsites.net) in production env by default. If you want to use a custom server, use `setConfig({ apiURL, socketURL });`

---
### Debugging:
Open the browser console and filter your logs by @chat-e2ee/service
Expand Down