+

+
NIP-42 Proxy
+
A NIP-42 authentication proxy for Nostr relays.
+
+
+
+
-This project is a NIP-42 proxy for Nostr relays. It provides an authentication layer in front of a public relay, allowing only authenticated users to connect and interact with it.
+---
-## Features
+This project provides a robust NIP-42 proxy for Nostr relays, creating an authentication layer to ensure only authorized users can connect and interact with a public relay.
-- **NIP-42 Authentication**: Enforces NIP-42 authentication, ensuring that only authorized users can access the relay.
-- **Proxy Layer**: Acts as a proxy, forwarding messages between authenticated clients and the main relay.
-- **Dynamic Whitelist**: Manage allowed public keys and event kinds dynamically through an admin RPC interface.
-- **Admin RPC Interface**: A NIP-98-protected RPC interface for administering the proxy.
-- **Docker Support**: Comes with a `Dockerfile` for easy deployment.
-- **Bun Support**: Can be run directly with `bun`.
+## ✨ Features
-## Prerequisites
+- **NIP-42 Authentication**: Enforces NIP-42 authentication, securing your relay from unauthorized access.
+- **Proxy Layer**: Seamlessly forwards messages between authenticated clients and the main relay.
+- **Dynamic Whitelist**: Manage allowed public keys and event kinds on-the-fly via an admin RPC interface.
+- **Admin RPC Interface**: A NIP-98-protected RPC interface for easy administration.
+- **Containerized**: Comes with a `Dockerfile` for easy and consistent deployment.
+- **Fast & Modern**: Built with Bun for optimal performance.
-- [Bun](https://bun.sh/) installed on your system.
-- [Docker](https://www.docker.com/) (optional) installed on your system.
+## 🚀 Getting Started
-## Installation
+### Prerequisites
-1. **Clone the repository**:
+- [Bun](https://bun.sh/)
+- [Docker](https://www.docker.com/) (Optional)
+
+### Installation & Running
+
+1. **Clone the repository:**
```bash
git clone https://git.arx-ccn.com/Arx/nip42-proxy.git
cd nip42-proxy
```
-2. **Install dependencies**:
+2. **Install dependencies:**
+
```bash
bun install
```
-## Configuration
+3. **Run the proxy:**
+ - **With Bun:**
-The proxy is configured through environment variables.
+ ```bash
+ RELAY_URL="wss://my-relay.com" ADMIN_PUBKEY="my-admin-pubkey" bun run index.ts
+ ```
-- `ALLOW_UNAUTHED_PUBLISH`: (Optional) Set to `true` to allow unauthenticated clients to publish events. Defaults to `false`.
-- `RELAY_URL`: The URL of the relay that the proxy will connect to.
-- `RELAY_OUTSIDE_URL`: (Optional) The URL that clients use to connect to the proxy. Defaults to the `RELAY_URL`.
-- `RELAY_NAME`: (Optional) The name of the relay.
-- `RELAY_DESCRIPTION`: (Optional) A description of the relay.
-- `RELAY_BANNER`: (Optional) A URL to a banner image for the relay.
-- `RELAY_ICON`: (Optional) A URL to an icon for the relay.
-- `RELAY_CONTACT`: (Optional) A contact email or address for the relay.
-- `RELAY_POLICY`: (Optional) A URL to the relay's policy document.
-- `ADMIN_PUBKEY`: (Optional) The public key of the administrator of the relay.
+ - **With Docker:**
+ 1. Build the image:
-## Usage
+ ```bash
+ docker build -t nip42-proxy .
+ ```
-### With Bun
+ 2. Run the container:
-To run the proxy directly with Bun:
-
-```bash
-bun run index.ts
-```
-
-You can also set environment variables in the same command:
-
-```bash
-RELAY_URL="wss://my-relay.com" ADMIN_PUBKEY="my-admin-pubkey" bun run index.ts
-```
-
-### With Docker
-
-To run the proxy using Docker, follow these steps:
-
-1. **Build the Docker image**:
-
- ```bash
- docker build -t nip42-proxy .
- ```
-
-2. **Run the Docker container**:
-
- ```bash
- docker run -p 3000:3000 --name nip42-proxy nip42-proxy
- ```
-
- - This command maps port `3000` on your local machine to port `3000` in the container.
-
- To run with a custom relay URL and other environment variables, use the `-e` flag:
-
- ```bash
- docker run -p 3000:3000 -e RELAY_URL="wss://your-relay-url.com" -e ADMIN_PUBKEY="my-admin-pubkey" --name nip42-proxy nip42-proxy
- ```
+ ```bash
+ docker run -p 3000:3000 -e RELAY_URL="wss://your-relay-url.com" -e ADMIN_PUBKEY="my-admin-pubkey" --name nip42-proxy nip42-proxy
+ ```
The server will start, and you can connect to it using a Nostr client that supports NIP-42 authentication.
-## Admin RPC Interface
+## ⚙️ Configuration
-The proxy exposes a NIP-98-protected RPC interface for administration. To use it, you need to send a `POST` request to the root URL (`/`) with the `Content-Type` header set to `application/nostr+json+rpc`. The `Authorization` header must contain a NIP-98 token.
+The proxy is configured through environment variables.
+
+