|
| 1 | +# GitHub Copilot Instructions |
| 2 | + |
| 3 | +This repository implements a NIP-42 authentication proxy for Nostr relays. It adds client authentication support to upstream relays (like strfry) that don't natively support it. |
| 4 | + |
| 5 | +## Guidelines |
| 6 | + |
| 7 | +- Use Conventional Commits for titles and commit messages (e.g., `feat(scope): message`). |
| 8 | +- Ensure pull requests include a clear description and test results. |
| 9 | +- Reference related issues using `Closes #123` when applicable. |
| 10 | +- Run `mvn -q verify` before committing code. |
| 11 | +- Document new features in the README or related docs. |
| 12 | +- Maintain Java 21 compatibility and update `pom.xml` for new dependencies. |
| 13 | +- Remove unused imports. |
| 14 | + |
| 15 | +## Relevant Nostr NIPs |
| 16 | + |
| 17 | +When implementing features, consult the relevant NIP specifications: |
| 18 | + |
| 19 | +- [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md) - Basic protocol flow (events, subscriptions, messages) |
| 20 | +- [NIP-42](https://github.com/nostr-protocol/nips/blob/master/42.md) - Client authentication (core to this proxy) |
| 21 | +- [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) - Encrypted direct messages (protected kind) |
| 22 | +- [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) - Private direct messages (protected kinds 14, 15) |
| 23 | +- [NIP-46](https://github.com/nostr-protocol/nips/blob/master/46.md) - Nostr Connect / remote signing (protected kind 24133) |
| 24 | +- [NIP-47](https://github.com/nostr-protocol/nips/blob/master/47.md) - Wallet Connect (protected kinds 23194-23197) |
| 25 | +- [NIP-59](https://github.com/nostr-protocol/nips/blob/master/59.md) - Gift wraps (protected kinds 13, 1059) |
| 26 | + |
| 27 | +## Architecture |
| 28 | + |
| 29 | +``` |
| 30 | +Client (port 7777) ←→ NIP-42 Auth Proxy ←→ Upstream Relay (strfry @ 7778) |
| 31 | +``` |
| 32 | + |
| 33 | +Key components: |
| 34 | +- `auth/` - NIP-42 authentication and BIP-340 signature verification |
| 35 | +- `session/` - WebSocket session management and state tracking |
| 36 | +- `access/` - Access control (open, allowlist, blocklist modes) |
| 37 | +- `handler/` - WebSocket message handling and upstream routing |
| 38 | +- `upstream/` - Upstream relay client connections |
| 39 | + |
| 40 | +These instructions help GitHub Copilot produce code that respects the repository's conventions and protocol requirements. |
0 commit comments