diff options
| author | Your Name <you@example.com> | 2026-05-26 22:07:55 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-26 22:07:55 +0530 |
| commit | d60fa03de6edae0667a93ac36be4206e76255a2c (patch) | |
| tree | 566adbe43f446a1f92a425c439c8c60f52c8ae51 /src/config.rs | |
| parent | 7b1b36b8c7e448d1d170c8c6e1f88bb766163fbb (diff) | |
Add NIP-46 remote signing for kind:30618 state events
- nip46.rs: full NIP-46 client with session management, NIP-04 encrypted
relay-based communication, oneshot response awaiting
- db.rs: nip46_sessions table, upsert/get methods
- config.rs: Nip46Config with relays + signing_timeout_secs
- git_mirror.rs: builds unsigned kind:30618 state event from bare repo refs,
signs via NIP-46 before push, publishes to target server relay
- http_health.rs: exposes NIP-46 session status in health endpoint
- main.rs: wires NIP-46 client into daemon startup, passes to mirror_cycle
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 037deb2..4117507 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -9,6 +9,7 @@ pub struct AppConfig { | |||
| 9 | pub servers: ServersConfig, | 9 | pub servers: ServersConfig, |
| 10 | pub storage: StorageConfig, | 10 | pub storage: StorageConfig, |
| 11 | pub signing: Option<SigningConfig>, | 11 | pub signing: Option<SigningConfig>, |
| 12 | pub nip46: Option<Nip46Config>, | ||
| 12 | } | 13 | } |
| 13 | 14 | ||
| 14 | #[derive(Debug, Deserialize)] | 15 | #[derive(Debug, Deserialize)] |
| @@ -60,11 +61,23 @@ pub struct SigningConfig { | |||
| 60 | pub key_file: PathBuf, | 61 | pub key_file: PathBuf, |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 64 | #[derive(Debug, Deserialize)] | ||
| 65 | pub struct Nip46Config { | ||
| 66 | pub relays: Vec<String>, | ||
| 67 | #[serde(default = "default_signing_timeout")] | ||
| 68 | pub signing_timeout_secs: u64, | ||
| 69 | } | ||
| 70 | |||
| 71 | fn default_signing_timeout() -> u64 { | ||
| 72 | 604800 | ||
| 73 | } | ||
| 74 | |||
| 63 | pub struct ResolvedConfig { | 75 | pub struct ResolvedConfig { |
| 64 | pub discovery: DiscoveryConfig, | 76 | pub discovery: DiscoveryConfig, |
| 65 | pub servers: ServersConfig, | 77 | pub servers: ServersConfig, |
| 66 | pub storage: StorageConfig, | 78 | pub storage: StorageConfig, |
| 67 | pub signing: Option<SigningConfig>, | 79 | pub signing: Option<SigningConfig>, |
| 80 | pub nip46: Option<Nip46Config>, | ||
| 68 | pub npubs: Vec<PublicKey>, | 81 | pub npubs: Vec<PublicKey>, |
| 69 | } | 82 | } |
| 70 | 83 | ||
| @@ -89,6 +102,7 @@ impl ResolvedConfig { | |||
| 89 | servers: app.servers, | 102 | servers: app.servers, |
| 90 | storage: app.storage, | 103 | storage: app.storage, |
| 91 | signing: app.signing, | 104 | signing: app.signing, |
| 105 | nip46: app.nip46, | ||
| 92 | npubs, | 106 | npubs, |
| 93 | }) | 107 | }) |
| 94 | } | 108 | } |