Add public join policy setting

This commit is contained in:
Jon Staab
2026-01-08 17:18:52 -08:00
parent 87dd485efc
commit 0fc7208a7a
3 changed files with 7 additions and 0 deletions
+2
View File
@@ -36,6 +36,7 @@ Contains information for populating the relay's `nip11` document.
Contains policy and access related configuration.
- `public_join` - whether to allow non-members to join the relay without an invite code. Defaults to `false`.
- `strip_signatures` - whether to remove signatures when serving events to non-admins. This requires clients/users to trust the relay to properly authenticate signatures. Be cautious about using this; a malicious relay will be able to execute all kinds of attacks, including potentially serving events unrelated to a community use case.
### `[groups]`
@@ -84,6 +85,7 @@ pubkey = "<hex public key>"
description = "A community relay for my friends"
[policy]
public_join = true
strip_signatures = false
[groups]
+1
View File
@@ -27,6 +27,7 @@ type Config struct {
} `toml:"info"`
Policy struct {
PublicJoin bool `toml:"public_join"`
StripSignatures bool `toml:"strip_signatures"`
} `toml:"policy"`
+4
View File
@@ -289,6 +289,10 @@ func (m *ManagementStore) ValidateJoinRequest(event nostr.Event) (reject bool, e
return true, "invalid: you have been banned from this relay"
}
if m.Config.Policy.PublicJoin {
return false, ""
}
claimTag := event.Tags.Find("claim")
if claimTag == nil {