Finish pass on docs

This commit is contained in:
Jon Staab
2025-06-10 15:48:00 -07:00
parent 1a81768e8e
commit ee6fa8b956
19 changed files with 545 additions and 435 deletions
+30
View File
@@ -0,0 +1,30 @@
# NIP-42
Utilities for NIP-42 relay authentication, allowing clients to authenticate with relays that require it.
## Functions
### makeRelayAuth(url, challenge)
Creates a CLIENT_AUTH event (kind 22242) for relay authentication as specified in NIP-42.
**Parameters:**
- `url` - The relay URL to authenticate with
- `challenge` - The challenge string provided by the relay
**Returns:** Unsigned event object with relay and challenge tags
## Example
```typescript
import {makeRelayAuth} from "@welshman/util"
// Create auth event when relay sends AUTH challenge
const authEvent = makeRelayAuth(
"wss://relay.example.com",
"challenge-string-from-relay"
)
// Sign the event with your signer
const signedAuth = await signer.sign(authEvent)
```