Skip to content

Commit d3c64e1

Browse files
vveerrggclaude
andcommitted
docs: fix broken typedoc links in README
NostrWSMessage was refactored from interface to type alias; update README link from docs/interfaces/ to docs/type-aliases/. Also fix nonexistent NostrWSMessageType enumeration link. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 525fc67 commit d3c64e1

174 files changed

Lines changed: 2232 additions & 2888 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Comprehensive API documentation is available in our [documentation site](https:/
191191
- [NostrServer](docs/classes/NostrServer.md) - High-level Nostr server
192192

193193
### Types and Interfaces
194-
- [NostrWSMessage](docs/interfaces/NostrWSMessage.md) - Message structure
194+
- [NostrWSMessage](docs/type-aliases/NostrWSMessage.md) - Message structure
195195
- [NostrWSOptions](docs/interfaces/NostrWSOptions.md) - Configuration options
196196
- [NostrWSSubscription](docs/interfaces/NostrWSSubscription.md) - Subscription interface
197197
- [ExtendedWebSocket](docs/interfaces/ExtendedWebSocket.md) - Enhanced WebSocket interface
@@ -201,7 +201,7 @@ Comprehensive API documentation is available in our [documentation site](https:/
201201
- [getLogger](docs/functions/getLogger.md) - Logging utility
202202

203203
### Type Definitions
204-
- [MessageType](docs/enumerations/NostrWSMessageType.md) - Message type enumeration
204+
- [ConnectionState](docs/enumerations/ConnectionState.md) - Connection state enumeration
205205
- [Global Types](docs/globals.md) - Global type definitions
206206

207207
## Examples

docs/README.md

Lines changed: 77 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
**nostr-websocket-utils v0.3.0**
1+
**nostr-websocket-utils v0.3.16**
22

33
***
44

55
# nostr-websocket-utils
66

7-
[![npm version](https://img.shields.io/npm/v/@humanjavaenterprises/nostr-websocket-utils.svg)](https://www.npmjs.com/package/@humanjavaenterprises/nostr-websocket-utils)
8-
[![License](https://img.shields.io/npm/l/@humanjavaenterprises/nostr-websocket-utils.svg)](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/LICENSE)
7+
[![npm version](https://img.shields.io/npm/v/nostr-websocket-utils.svg)](https://www.npmjs.com/package/nostr-websocket-utils)
8+
[![License](https://img.shields.io/npm/l/nostr-websocket-utils.svg)](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/LICENSE)
99
[![Build Status](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/workflows/CI/badge.svg)](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/actions)
1010
[![Documentation](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/workflows/Documentation/badge.svg)](https://humanjavaenterprises.github.io/nostr-websocket-utils/)
1111
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org)
@@ -15,13 +15,14 @@ A TypeScript library for building Nostr protocol WebSocket clients and servers.
1515

1616
## Features
1717

18-
- 🚀 Full Nostr protocol support
18+
- 🚀 Full Nostr protocol support with nostr-crypto-utils integration
1919
- 🔒 Secure WebSocket connections
2020
- ♥️ Heartbeat mechanism for connection health
2121
- 🔄 Automatic reconnection handling
22-
- 📝 Comprehensive logging
22+
- 📝 Comprehensive logging with Pino v8
2323
- 🎯 Type-safe message handling
2424
- 📦 Easy to use API
25+
- 🧪 Vitest-powered test suite
2526

2627
## NIPs Support Status
2728

@@ -106,7 +107,7 @@ await client.connect();
106107
### Creating a Nostr WebSocket Server
107108

108109
```typescript
109-
import { createNostrServer } from '@humanjavaenterprises/nostr-websocket-utils';
110+
import { createNostrServer } from 'nostr-websocket-utils';
110111

111112
const server = await createNostrServer(8080, {
112113
logger: console,
@@ -120,13 +121,69 @@ const server = await createNostrServer(8080, {
120121
});
121122
```
122123

124+
## Browser Usage
125+
126+
This library now supports direct browser usage! You can use it in your client-side applications in two ways:
127+
128+
### Via NPM (Recommended)
129+
130+
```javascript
131+
import { NostrWSClient } from 'nostr-websocket-utils';
132+
133+
const client = new NostrWSClient({
134+
url: 'wss://relay.damus.io',
135+
options: {
136+
autoReconnect: true,
137+
maxRetries: 3
138+
}
139+
});
140+
141+
client.onMessage((message) => {
142+
console.log('Received:', message);
143+
});
144+
145+
client.connect();
146+
```
147+
148+
### Via CDN
149+
150+
```html
151+
<script src="https://unpkg.com/nostr-websocket-utils/dist/browser/nostr-websocket-utils.min.js"></script>
152+
<script>
153+
const client = new NostrWebSocketUtils.NostrWSClient({
154+
url: 'wss://relay.damus.io',
155+
options: {
156+
autoReconnect: true,
157+
maxRetries: 3
158+
}
159+
});
160+
161+
client.onMessage((message) => {
162+
console.log('Received:', message);
163+
});
164+
165+
client.connect();
166+
</script>
167+
```
168+
169+
### Features in Browser Environment
170+
171+
- Direct WebSocket connections to Nostr relays
172+
- Automatic reconnection handling
173+
- Message queueing
174+
- Type-safe handlers
175+
- Full compatibility with browser environments
176+
- Source maps for better debugging
177+
178+
See the `examples/browser.html` file for a complete example of browser usage.
179+
123180
## Dependencies
124181

125-
This package relies on:
126-
- [nostr-crypto-utils](https://github.com/HumanjavaEnterprises/nostr-crypto-utils) - For all cryptographic operations
127-
- [ws](https://github.com/websockets/ws) - For WebSocket functionality
128-
- [pino](https://github.com/pinojs/pino) - For logging
129-
- [uuid](https://github.com/uuidjs/uuid) - For unique identifiers
182+
This package uses:
183+
- nostr-crypto-utils (^0.4.2) for cryptographic operations
184+
- pino (^8.17.2) for logging
185+
- ws (^8.16.0) for WebSocket functionality
186+
- uuid (^9.0.0) for unique identifiers
130187

131188
## Documentation
132189

@@ -148,7 +205,7 @@ Comprehensive API documentation is available in our [documentation site](https:/
148205
- [getLogger](_media/getLogger.md) - Logging utility
149206

150207
### Type Definitions
151-
- [MessageType](docs/enumerations/NostrWSMessageType.md) - Message type enumeration
208+
- [ConnectionState](_media/ConnectionState.md) - Connection state enumeration
152209
- [Global Types](_media/globals.md) - Global type definitions
153210

154211
## Examples
@@ -176,6 +233,14 @@ server.broadcast({
176233
});
177234
```
178235

236+
## Security
237+
238+
### Dependency Vulnerability Status
239+
240+
We actively monitor and address security vulnerabilities in this codebase. **`npm audit --omit=dev` reports zero vulnerabilities** for this package — there are no known security issues in production dependencies.
241+
242+
Any remaining `npm audit` findings are in development-only tooling (eslint, typescript-eslint, vitest, typedoc, etc.) and stem from transitive dependencies with no upstream fix available. These are devDependencies that are never included in the published package and pose no risk to consumers of this library. We monitor upstream fixes and update promptly when they become available.
243+
179244
## Contributing
180245

181246
Contributions are welcome! Please read our [Contributing Guide](_media/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

docs/_media/ConnectionState.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[**nostr-websocket-utils v0.3.16**](../README.md)
2+
3+
***
4+
5+
[nostr-websocket-utils](../globals.md) / ConnectionState
6+
7+
# Enumeration: ConnectionState
8+
9+
Defined in: [types/index.ts:36](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L36)
10+
11+
WebSocket connection states
12+
13+
## Enumeration Members
14+
15+
### CONNECTING
16+
17+
> **CONNECTING**: `"CONNECTING"`
18+
19+
Defined in: [types/index.ts:37](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L37)
20+
21+
***
22+
23+
### CONNECTED
24+
25+
> **CONNECTED**: `"CONNECTED"`
26+
27+
Defined in: [types/index.ts:38](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L38)
28+
29+
***
30+
31+
### DISCONNECTED
32+
33+
> **DISCONNECTED**: `"DISCONNECTED"`
34+
35+
Defined in: [types/index.ts:39](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L39)
36+
37+
***
38+
39+
### RECONNECTING
40+
41+
> **RECONNECTING**: `"RECONNECTING"`
42+
43+
Defined in: [types/index.ts:40](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L40)
44+
45+
***
46+
47+
### FAILED
48+
49+
> **FAILED**: `"FAILED"`
50+
51+
Defined in: [types/index.ts:41](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L41)

docs/_media/ExtendedWebSocket.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
[**nostr-websocket-utils v0.3.0**](../README.md)
1+
[**nostr-websocket-utils v0.3.16**](../README.md)
22

33
***
44

55
[nostr-websocket-utils](../globals.md) / ExtendedWebSocket
66

77
# Interface: ExtendedWebSocket
88

9+
Defined in: [types/index.ts:24](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L24)
10+
911
Extended WebSocket interface with client ID
1012

1113
## Extends
@@ -18,56 +20,44 @@ Extended WebSocket interface with client ID
1820

1921
> `optional` **clientId**: `string`
2022
21-
#### Defined in
22-
23-
[types/index.ts:21](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L21)
23+
Defined in: [types/index.ts:25](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L25)
2424

2525
***
2626

2727
### isAlive?
2828

2929
> `optional` **isAlive**: `boolean`
3030
31-
#### Defined in
32-
33-
[types/index.ts:22](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L22)
31+
Defined in: [types/index.ts:26](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L26)
3432

3533
***
3634

3735
### subscriptions?
3836

3937
> `optional` **subscriptions**: `Set`\<`string`\>
4038
41-
#### Defined in
42-
43-
[types/index.ts:23](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L23)
39+
Defined in: [types/index.ts:27](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L27)
4440

4541
***
4642

4743
### lastPing?
4844

4945
> `optional` **lastPing**: `number`
5046
51-
#### Defined in
52-
53-
[types/index.ts:24](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L24)
47+
Defined in: [types/index.ts:28](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L28)
5448

5549
***
5650

5751
### reconnectAttempts?
5852

5953
> `optional` **reconnectAttempts**: `number`
6054
61-
#### Defined in
62-
63-
[types/index.ts:25](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L25)
55+
Defined in: [types/index.ts:29](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L29)
6456

6557
***
6658

6759
### messageQueue?
6860

69-
> `optional` **messageQueue**: [`NostrWSMessage`](NostrWSMessage.md)[]
70-
71-
#### Defined in
61+
> `optional` **messageQueue**: [`NostrWSMessage`](../type-aliases/NostrWSMessage.md)[]
7262
73-
[types/index.ts:26](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L26)
63+
Defined in: [types/index.ts:30](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L30)

docs/_media/NostrServer.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
[**nostr-websocket-utils v0.3.0**](../README.md)
1+
[**nostr-websocket-utils v0.3.16**](../README.md)
22

33
***
44

55
[nostr-websocket-utils](../globals.md) / NostrServer
66

77
# Class: NostrServer
88

9+
Defined in: [core/nostr-server.ts:11](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L11)
10+
911
Represents a Nostr WebSocket server
1012

1113
## Constructors
1214

13-
### new NostrServer()
15+
### Constructor
16+
17+
> **new NostrServer**(`options`): `NostrWSServer`
1418
15-
> **new NostrServer**(`options`): [`NostrServer`](NostrServer.md)
19+
Defined in: [core/nostr-server.ts:22](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L22)
1620

1721
Creates a new Nostr WebSocket server instance
1822

@@ -26,36 +30,28 @@ Server configuration options
2630

2731
#### Returns
2832

29-
[`NostrServer`](NostrServer.md)
30-
31-
#### Defined in
32-
33-
[core/nostr-server.ts:22](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L22)
33+
`NostrWSServer`
3434

3535
## Properties
3636

3737
### server
3838

3939
> `private` **server**: `WebSocketServer`
4040
41-
The underlying WebSocket server instance
42-
43-
#### Defined in
41+
Defined in: [core/nostr-server.ts:15](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L15)
4442

45-
[core/nostr-server.ts:15](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L15)
43+
The underlying WebSocket server instance
4644

4745
## Methods
4846

4947
### stop()
5048

5149
> **stop**(): `void`
5250
51+
Defined in: [core/nostr-server.ts:98](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L98)
52+
5353
Closes the WebSocket server
5454

5555
#### Returns
5656

5757
`void`
58-
59-
#### Defined in
60-
61-
[core/nostr-server.ts:97](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L97)

0 commit comments

Comments
 (0)