1 // Package bridge implements a bidirectional Nostr-Email bridge using the
2 // Marmot protocol (MLS-based E2E encrypted messaging) for all Nostr-side
3 // communication. It receives inbound email via SMTP and delivers it as
4 // Marmot DMs, and receives outbound email as Marmot DMs to send via SMTP.
5 package bridge
6 7 // Config holds the bridge configuration. Constructed by callers from
8 // environment values (see app/config/config.go GetBridgeConfigValues).
9 type Config struct {
10 // Domain is the email domain (e.g., "relay.example.com").
11 // Users get addresses like npub1abc...@relay.example.com.
12 Domain string
13 14 // NSEC is the bridge identity secret key in nsec or hex format.
15 // If empty, the bridge attempts to read it from the database
16 // (monolithic mode) or from a file (standalone mode).
17 NSEC string
18 19 // RelayURL is the WebSocket URL of the relay to connect to.
20 // Used in standalone mode. In monolithic mode this can be empty
21 // (events are routed in-process).
22 RelayURL string
23 24 // SMTPPort is the port the SMTP server listens on.
25 SMTPPort int
26 27 // SMTPHost is the address the SMTP server binds to.
28 SMTPHost string
29 30 // DataDir is where the bridge persists its state (group state,
31 // subscriptions, identity file for standalone mode).
32 DataDir string
33 34 // DKIMKeyPath is the path to the DKIM private key PEM file.
35 DKIMKeyPath string
36 37 // DKIMSelector is the DKIM selector for DNS TXT lookup.
38 DKIMSelector string
39 40 // NWCURI is the NWC connection string for subscription payments.
41 NWCURI string
42 43 // MonthlyPriceSats is the price in sats for one month subscription.
44 MonthlyPriceSats int64
45 46 // ComposeURL is the public URL of the compose form page.
47 ComposeURL string
48 49 // SMTPRelayHost is the smarthost for outbound email delivery
50 // (e.g., "smtp.migadu.com"). If empty, direct MX delivery is used.
51 SMTPRelayHost string
52 53 // SMTPRelayPort is the smarthost port (typically 587 for STARTTLS).
54 SMTPRelayPort int
55 56 // SMTPRelayUsername is the SMTP AUTH username for the smarthost.
57 SMTPRelayUsername string
58 59 // SMTPRelayPassword is the SMTP AUTH password for the smarthost.
60 SMTPRelayPassword string
61 62 // ACLGRPCServer is the gRPC address of the ACL server.
63 // When set, the bridge uses ACL-backed subscriptions instead of file store.
64 ACLGRPCServer string
65 66 // AliasPriceSats is the monthly price in sats for an alias email address.
67 // Must be >= MonthlyPriceSats. If zero, defaults to 2x MonthlyPriceSats.
68 AliasPriceSats int64
69 70 // ProfilePath is the path to a profile template file (email-header format).
71 // If the file exists, the bridge publishes a kind 0 metadata event on startup.
72 // Default: $DataDir/profile.txt
73 ProfilePath string
74 }
75