myc

Self-custodial remote signer for Radroots apps
git clone https://radroots.dev/git/myc.git
Log | Files | Refs | README | LICENSE

commit 3d6d81fb122c4060ba008904bac19fa228a3e31a
parent a78f2edbca35dfb2749d4e79564774da0731ea27
Author: triesap <tyson@radroots.org>
Date:   Sun, 22 Mar 2026 12:10:06 +0000

config: add checked discovery example

- add a repo-root discovery-enabled config.example.toml with the full required command surface
- cover the example in config tests so the documented discovery configuration stays parseable
- keep the example rooted in relative paths and explicit relay and nostrconnect settings
- validate with cargo metadata --format-version 1 --no-deps cargo fmt --check and cargo test --locked

Diffstat:
Aconfig.example.toml | 40++++++++++++++++++++++++++++++++++++++++
Msrc/config.rs | 24++++++++++++++++++++++++
2 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/config.example.toml b/config.example.toml @@ -0,0 +1,40 @@ +[service] +instance_name = "myc" + +[logging] +filter = "info,myc=info" + +[paths] +state_dir = "var" +signer_identity_path = "identity.json" +user_identity_path = "user-identity.json" + +[audit] +default_read_limit = 200 +max_active_file_bytes = 262144 +max_archived_files = 8 + +[discovery] +enabled = true +domain = "signer.example.com" +handler_identifier = "myc" +app_identity_path = "app-identity.json" +public_relays = ["wss://relay.example.com"] +publish_relays = ["wss://relay.example.com"] +nostrconnect_url_template = "https://signer.example.com/connect?uri=<nostrconnect>" +nip05_output_path = "public/.well-known/nostr.json" + +[discovery.metadata] +name = "myc" +display_name = "Mycorrhiza" +about = "NIP-46 signer" +website = "https://signer.example.com" +picture = "https://signer.example.com/logo.png" + +[policy] +connection_approval = "explicit_user" + +[transport] +enabled = true +connect_timeout_secs = 10 +relays = ["wss://relay.example.com"] diff --git a/src/config.rs b/src/config.rs @@ -475,6 +475,8 @@ fn validate_nostrconnect_url_template(template: &str) -> Result<(), MycError> { #[cfg(test)] mod tests { + use std::fs; + use super::*; #[test] @@ -686,4 +688,26 @@ mod tests { .contains("discovery.nostrconnect_url_template") ); } + + #[test] + fn example_config_parses_and_validates() { + let example = fs::read_to_string( + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("config.example.toml"), + ) + .expect("read example config"); + + let config = MycConfig::from_toml_str(&example).expect("example config"); + + assert_eq!(config.service.instance_name, "myc"); + assert!(config.discovery.enabled); + assert_eq!( + config.discovery.domain.as_deref(), + Some("signer.example.com") + ); + assert_eq!(config.discovery.handler_identifier, "myc"); + assert_eq!( + config.discovery.nip05_output_path, + Some(PathBuf::from("public/.well-known/nostr.json")) + ); + } }