open-index/open-npm huggingface dataset:
npm package: @hashchat/js-hashchat
Description: JS SDK for Hashchat
Latest version: 0.1.0

## Models

- `ChatMessage` is the main model that uses a `JWMPayload` as the dto
- `HashchatStreamMessage` is an internal dto that represents the fully signed and encrypted message stored in Stream
- `SignedChatMessage` is the payload of the encrypted message and contains information needed to verify the message
- `JWMPayload` is the final payload that contains message data

## Services

- `AuthService` handles wallet connection, Lit authentication, and DID session management
- `EncrypterService` handles encryption and decryption. It is internally access by `ChatService`
- `SignerService` handles signing messages. It is internally access by `ChatService`
- `ChatService` handles sending and receiving messages from Stream

## Example App

The example app under `examples/` uses the `AuthService` and `ChatService` to authenticate, send a single message to a hardcoded channel, and receive a message from a hardcoded channel. Messages are signed and encrypted before sending, and they are decrypted and validated when receiving.

To test locally, in the root directory:

```
yarn
npm link
yarn build
```

And in the example app directory:

```
yarn
npm link js-hashchat
yarn start
```