diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-21 16:05:02 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-21 16:05:02 +0000 |
| commit | 22c9ccd8f17815c960e797a545ab3cb1385ffcf8 (patch) | |
| tree | 7a166bc829223763906848a6108c783f216d0a88 /src/config.rs | |
| parent | 68cca2e28a5edc9b8da72f483980818e4a13fb52 (diff) | |
fix: use hex format for pubkey in NIP-11 document
The NIP-11 specification requires the pubkey field to be a 64-character
hex string, but we were incorrectly using npub (bech32) format.
Changes:
- Add Config::relay_owner_pubkey_hex() method to get hex format
- Update NIP-11 document to use hex format instead of npub
- Update test to verify 64-char hex string instead of npub format
Fixes nak relay command error:
'must be a hex string of 64 characters'
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index 4b1e8d9..271a340 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -574,7 +574,13 @@ impl Config { | |||
| 574 | Keys::parse(nsec).context("Invalid relay_owner_nsec") | 574 | Keys::parse(nsec).context("Invalid relay_owner_nsec") |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | /// Get the relay owner's public key (npub format) for NIP-11 | 577 | /// Get the relay owner's public key (hex format) for NIP-11 |
| 578 | pub fn relay_owner_pubkey_hex(&self) -> Result<String> { | ||
| 579 | let keys = self.relay_owner_keys()?; | ||
| 580 | Ok(keys.public_key().to_hex()) | ||
| 581 | } | ||
| 582 | |||
| 583 | /// Get the relay owner's public key (npub format) | ||
| 578 | pub fn relay_owner_npub(&self) -> Result<String> { | 584 | pub fn relay_owner_npub(&self) -> Result<String> { |
| 579 | let keys = self.relay_owner_keys()?; | 585 | let keys = self.relay_owner_keys()?; |
| 580 | Ok(keys.public_key().to_bech32()?) | 586 | Ok(keys.public_key().to_bech32()?) |