Skip to content

Commit 60c4f78

Browse files
committed
fix: improve TypeDoc documentation and fix linting issues
- Add proper JSDoc comments for interfaces - Fix unused parameter linting error in tests - Update TypeDoc generation - Clean up documentation warnings
1 parent a129958 commit 60c4f78

File tree

170 files changed

+9673
-5530
lines changed

Some content is hidden

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

170 files changed

+9673
-5530
lines changed

docs/README.md

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**nostr-websocket-utils v0.2.5**
1+
**nostr-websocket-utils v0.3.0**
22

33
***
44

@@ -23,18 +23,72 @@ A TypeScript library for building Nostr protocol WebSocket clients and servers.
2323
- 🎯 Type-safe message handling
2424
- 📦 Easy to use API
2525

26+
## NIPs Support Status
27+
28+
🟢 Fully implemented 🟡 Partially implemented 🔴 Not implemented
29+
30+
| NIP | Status | Description |
31+
|-----|--------|-------------|
32+
| 01 | 🟢 | Basic protocol flow & WebSocket connections |
33+
| 02 | 🟢 | Contact List and Petnames |
34+
| 11 | 🟢 | Relay Information Document |
35+
| 15 | 🟢 | End of Stored Events Notice |
36+
| 16 | 🟢 | Event Treatment |
37+
| 20 | 🟢 | Command Results |
38+
| 42 | 🟢 | Authentication of clients to relays |
39+
40+
### WebSocket Protocol Implementation Details
41+
42+
This package implements the Nostr WebSocket protocol with full support for the core NIPs that define WebSocket behavior. Here's how it works:
43+
44+
#### Key Features & Compliance
45+
46+
1. **Protocol Implementation**:
47+
- Full implementation of Nostr WebSocket protocol
48+
- Support for all standard message types (EVENT, REQ, CLOSE, etc.)
49+
- Robust error handling and status reporting
50+
51+
2. **Connection Management**:
52+
- Automatic reconnection with configurable backoff
53+
- Heartbeat mechanism for connection health
54+
- Connection pooling and load balancing
55+
56+
3. **Message Handling**:
57+
- Type-safe message processing
58+
- Support for subscription management
59+
- Efficient event filtering
60+
61+
4. **Security & Best Practices**:
62+
- Secure WebSocket connections (WSS)
63+
- Implementation of authentication protocols
64+
- Rate limiting and protection mechanisms
65+
66+
#### Interoperability
67+
68+
This implementation ensures compatibility with:
69+
- All major Nostr relays
70+
- Other Nostr clients and libraries
71+
- Standard WebSocket tooling and infrastructure
72+
73+
#### Validation & Testing
74+
75+
The package includes:
76+
- Comprehensive test suites for protocol compliance
77+
- Connection reliability testing
78+
- Performance benchmarks for message handling
79+
2680
## Installation
2781

2882
```bash
29-
npm install @humanjavaenterprises/nostr-websocket-utils
83+
npm install nostr-websocket-utils
3084
```
3185

3286
## Quick Start
3387

3488
### Creating a Nostr WebSocket Client
3589

3690
```typescript
37-
import { NostrWSClient } from '@humanjavaenterprises/nostr-websocket-utils';
91+
import { NostrWSClient } from 'nostr-websocket-utils';
3892

3993
const client = new NostrWSClient('wss://relay.example.com', {
4094
logger: console,
@@ -66,6 +120,14 @@ const server = await createNostrServer(8080, {
66120
});
67121
```
68122

123+
## Dependencies
124+
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
130+
69131
## Documentation
70132

71133
Comprehensive API documentation is available in our [documentation site](https://humanjavaenterprises.github.io/nostr-websocket-utils/). Here's what you'll find:
@@ -86,7 +148,7 @@ Comprehensive API documentation is available in our [documentation site](https:/
86148
- [getLogger](_media/getLogger.md) - Logging utility
87149

88150
### Type Definitions
89-
- [MessageType](_media/NostrWSMessageType.md) - Message type enumeration
151+
- [MessageType](docs/enumerations/NostrWSMessageType.md) - Message type enumeration
90152
- [Global Types](_media/globals.md) - Global type definitions
91153

92154
## Examples
@@ -114,16 +176,9 @@ server.broadcast({
114176
});
115177
```
116178

117-
## Getting Help
118-
119-
1. Check the [documentation](https://humanjavaenterprises.github.io/nostr-websocket-utils/)
120-
2. Open an [issue](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/issues)
121-
122179
## Contributing
123180

124-
1. Fork it
125-
2. Create your feature branch (`git checkout -b my-new-feature`)
126-
3. Submit a Pull Request
181+
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.
127182

128183
## License
129184

@@ -132,4 +187,10 @@ This project is licensed under the MIT License - see the [LICENSE](_media/LICENS
132187
## Related Projects
133188

134189
- [nostr-protocol](https://github.com/nostr-protocol/nostr)
135-
- [nostr-tools](https://github.com/nbd-wtf/nostr-tools)
190+
191+
## Support
192+
193+
If you have any questions or need help, please:
194+
195+
1. Check the [documentation](https://humanjavaenterprises.github.io/nostr-websocket-utils/)
196+
2. Open an [issue](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/issues)

docs/_media/ExtendedWebSocket.md

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

33
***
44

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

77
# Interface: ExtendedWebSocket
88

9-
Extended WebSocket interface with additional properties
10-
ExtendedWebSocket
9+
Extended WebSocket interface with client ID
1110

1211
## Extends
1312

1413
- `WebSocket`
1514

16-
## Extended by
17-
18-
- [`NostrSocket`](NostrSocket.md)
19-
2015
## Properties
2116

22-
### isAlive?
23-
24-
> `optional` **isAlive**: `boolean`
17+
### clientId?
2518

26-
Whether the WebSocket connection is alive
19+
> `optional` **clientId**: `string`
2720
2821
#### Defined in
2922

30-
[types/index.ts:180](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L180)
23+
[types/index.ts:21](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L21)
3124

3225
***
3326

34-
### subscriptions?
35-
36-
> `optional` **subscriptions**: `Set`\<`string`\>
27+
### isAlive?
3728

38-
Set of subscription channels
29+
> `optional` **isAlive**: `boolean`
3930
4031
#### Defined in
4132

42-
[types/index.ts:185](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L185)
33+
[types/index.ts:22](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L22)
4334

4435
***
4536

46-
### clientId?
47-
48-
> `optional` **clientId**: `string`
37+
### subscriptions?
4938

50-
Unique client identifier
39+
> `optional` **subscriptions**: `Set`\<`string`\>
5140
5241
#### Defined in
5342

54-
[types/index.ts:190](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L190)
43+
[types/index.ts:23](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L23)
5544

5645
***
5746

58-
### messageQueue?
59-
60-
> `optional` **messageQueue**: [`NostrWSMessage`](NostrWSMessage.md)[]
47+
### lastPing?
6148

62-
Queue of messages to be sent
49+
> `optional` **lastPing**: `number`
6350
6451
#### Defined in
6552

66-
[types/index.ts:195](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L195)
53+
[types/index.ts:24](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L24)
6754

6855
***
6956

70-
### lastPing?
71-
72-
> `optional` **lastPing**: `number`
57+
### reconnectAttempts?
7358

74-
Timestamp of the last ping message
59+
> `optional` **reconnectAttempts**: `number`
7560
7661
#### Defined in
7762

78-
[types/index.ts:200](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L200)
63+
[types/index.ts:25](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L25)
7964

8065
***
8166

82-
### reconnectAttempts?
83-
84-
> `optional` **reconnectAttempts**: `number`
67+
### messageQueue?
8568

86-
Number of reconnect attempts
69+
> `optional` **messageQueue**: [`NostrWSMessage`](NostrWSMessage.md)[]
8770
8871
#### Defined in
8972

90-
[types/index.ts:205](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L205)
73+
[types/index.ts:26](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/types/index.ts#L26)

docs/_media/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 MaiQR Platform
3+
Copyright (c) 2024 Humanjava Enterprises
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/_media/NostrServer.md

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

33
***
44

@@ -20,7 +20,7 @@ Creates a new Nostr WebSocket server instance
2020

2121
##### options
2222

23-
[`NostrWSServerOptions`](../interfaces/NostrWSServerOptions.md)
23+
`NostrWSServerOptions`
2424

2525
Server configuration options
2626

@@ -30,37 +30,25 @@ Server configuration options
3030

3131
#### Defined in
3232

33-
[nostr-server.ts:24](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/nostr-server.ts#L24)
33+
[core/nostr-server.ts:22](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L22)
3434

3535
## Properties
3636

3737
### server
3838

39-
> `private` **server**: `Server`\<*typeof* `WebSocket`, *typeof* `IncomingMessage`\>
39+
> `private` **server**: `WebSocketServer`
4040
4141
The underlying WebSocket server instance
4242

4343
#### Defined in
4444

45-
[nostr-server.ts:12](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/nostr-server.ts#L12)
46-
47-
***
48-
49-
### logger
50-
51-
> `private` **logger**: `Logger`
52-
53-
Logger instance for this server
54-
55-
#### Defined in
56-
57-
[nostr-server.ts:17](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/nostr-server.ts#L17)
45+
[core/nostr-server.ts:15](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/core/nostr-server.ts#L15)
5846

5947
## Methods
6048

61-
### close()
49+
### stop()
6250

63-
> **close**(): `void`
51+
> **stop**(): `void`
6452
6553
Closes the WebSocket server
6654

@@ -70,4 +58,4 @@ Closes the WebSocket server
7058

7159
#### Defined in
7260

73-
[nostr-server.ts:112](https://github.com/HumanjavaEnterprises/nostr-websocket-utils/blob/main/src/nostr-server.ts#L112)
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)