config.public_key_hex is now config.contact_public_key_hex

This will avoid a future name collision when the relay has it's own keypair.
This commit is contained in:
Mike Dilger 2025-02-11 13:28:57 +13:00
parent da897b950e
commit 8f227d775d
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4
5 changed files with 21 additions and 14 deletions

View File

@ -116,7 +116,7 @@ key_pem_path = "/opt/chorus/etc/tls/privkey.pem"
#
# Default is not set
#
# public_key_hex =
# contact_public_key_hex =
# If open_relay is true, the relay behaves as an open public relay.

View File

@ -100,13 +100,15 @@ This is an optional URL for an graphical icon representing your relay, displayed
### contact
This is an optional contact for your relay, displayed in the NIP-11 response.
This is an optional administrative contact for your relay, displayed in the NIP-11 response.
Default is None.
### public_key_hex
### contact_public_key_hex
This is an optional public key (hex format) for your relay, displayed in the NIP-11 response.
This is an optional public key (hex format) for your relay's administrative contact, displayed in the NIP-11 response.
Deprecated "public_key_hex" also works.
Default is None.

View File

@ -84,7 +84,7 @@ Go ahead and edit that file to your liking. In particular:
or to 127.0.0.1 with a local port like 8080 (if you are proxying behind nginx)
- Change the port if necessary
- Change the name, description, icon_url and contact (e.g. your email address) as desired
- Set your public_key_hex (it is an option, so use `Some()`)
- Set your contact_public_key_hex (it is an option, so use `Some()`)
- Set hex keys of users for which this relay will act as a personal relay
@ -166,6 +166,10 @@ Restart nginx
sudo systemctl restart nginx.service
```
## Adding users and moderators
See [MANAGEMENT](MANAGEMENT.md) for how to add users and moderators.
## Monitoring the service
You can watch the logs with a command like this

View File

@ -21,7 +21,8 @@ pub struct FriendlyConfig {
pub description: Option<String>,
pub icon_url: Option<String>,
pub contact: Option<String>,
pub public_key_hex: Option<String>,
#[serde(alias = "public_key_hex")]
pub contact_public_key_hex: Option<String>,
pub open_relay: bool,
pub admin_hex_keys: Vec<String>,
pub verify_events: bool,
@ -61,7 +62,7 @@ impl Default for FriendlyConfig {
description: Some("A default config of the Chorus relay".to_string()),
icon_url: None,
contact: None,
public_key_hex: None,
contact_public_key_hex: None,
open_relay: false,
admin_hex_keys: vec![],
verify_events: true,
@ -103,7 +104,7 @@ impl FriendlyConfig {
description,
icon_url,
contact,
public_key_hex,
contact_public_key_hex,
open_relay,
admin_hex_keys,
verify_events,
@ -127,9 +128,9 @@ impl FriendlyConfig {
enable_negentropy,
} = self;
let mut public_key: Option<Pubkey> = None;
if let Some(pkh) = public_key_hex {
public_key = Some(Pubkey::read_hex(pkh.as_bytes())?);
let mut contact_public_key: Option<Pubkey> = None;
if let Some(pkh) = contact_public_key_hex {
contact_public_key = Some(Pubkey::read_hex(pkh.as_bytes())?);
};
let mut admin_keys: Vec<Pubkey> = Vec::with_capacity(admin_hex_keys.len());
@ -160,7 +161,7 @@ impl FriendlyConfig {
description,
icon_url,
contact,
public_key,
contact_public_key,
open_relay,
admin_keys,
admin_hex_keys,
@ -202,7 +203,7 @@ pub struct Config {
pub description: Option<String>,
pub icon_url: Option<String>,
pub contact: Option<String>,
pub public_key: Option<Pubkey>,
pub contact_public_key: Option<Pubkey>,
pub open_relay: bool,
pub admin_keys: Vec<Pubkey>,
pub admin_hex_keys: Vec<String>,

View File

@ -92,7 +92,7 @@ fn build_rid(config: &Config) -> String {
rid.push_str(contact);
rid.push('\"');
}
if let Some(pubkey) = &config.public_key {
if let Some(pubkey) = &config.contact_public_key {
let mut pkh: [u8; 64] = [0; 64];
pubkey.write_hex(&mut pkh).unwrap();
rid.push(',');