# @robertsvendsen/wspack

> Node Websocket Package

Latest version **0.11.1** (published 2024-02-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install @robertsvendsen/wspack
pnpm add @robertsvendsen/wspack
yarn add @robertsvendsen/wspack
bun add @robertsvendsen/wspack
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.1 |
| Published | 2024-02-18 |
| First published | 2022-10-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 47 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Robert Svendsen |
| Maintainers | platoniusen |

## Links

- npm: https://www.npmjs.com/package/@robertsvendsen/wspack
- npm.io page: https://npm.io/package/@robertsvendsen/wspack

## Dependencies (6)

- [ws](https://npm.io/package/ws.md) ^7.2.3
- [requirejs](https://npm.io/package/requirejs.md) ^2.3.5
- [bufferutil](https://npm.io/package/bufferutil.md) ^4.0.1
- [crypto-random-string](https://npm.io/package/crypto-random-string.md) ^3.2.0
- [@robertsvendsen/eventbus](https://npm.io/package/@robertsvendsen/eventbus.md) ^0.2
- [@robertsvendsen/fail2ban](https://npm.io/package/@robertsvendsen/fail2ban.md) ^1.2

## Recent versions

- 0.11.1 (latest) — 2024-02-18
- 0.10.2 — 2022-12-29
- 0.10.1 — 2022-10-06
- 0.10.0 — 2022-10-06
- 0.9.31 — 2022-10-06

## README

# wspack

Events (payload.e)
 
 Handshake
 - hello
 - auth
 - renegotiate
 - auth-failed
 
## TODO:
- On handshake initiate, client needs to verify that the server is indeed the server, if the server should be known to the client.
 

## Security

- Encryption is only available when auth is enabled (using keys).
- Encryption does only encrypt payload.data content.
- Encryption handshake:
  * Server -> Client (not encrypted): This is your pub key, use it as salt to authorize.
  * Client -> Server (not encrypted): My authKey is "authKey + pubKey + timestamp" and my timestamp is "timestamp".
  * Server -> Client (IF VALID) (encrypted): OK. Use this pubKey from now on.
  
  If having problems with handshake, it might be a latency problem if your latency is fluctuating. 
  Server validates authKey by checking the timestamp first.
  
  Server side the pubKey is stored on the websocket client (session).

---
_Source: https://npm.io/package/@robertsvendsen/wspack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
