Expand description
Domains & mail addresses — the foundation of the domain + semantic-mail/address stack
(docs/plans/social-network-plan.md §0.5). A domain/subdomain acts as an agent (QDP — Timothy’s
draft-webcivics-QDP: a domain publishes an RDF agent profile at /.well-known/QDP). A person runs
several context-domains (personal/work/projects), each with its own front-door DID(s); subdomains
serve families/children. A domain may be single-owner or (deferred placeholder) group-owned via an
M:N agreement — modelled now so group domains slot in later without a refactor.
Addresses on a domain are rule-bearing mailboxes — purpose inboxes (frontdoor@/junkmail@/
mygov@/newsletters@) or per-relationship (bob@alice.example), plus optional deliberate
catchall@ for fail-closed wild-card intake (quarantine, not open relay). This module owns the data
model, presets, resolve_delivery, and onboard_purpose_inboxes. Rules evaluation is
crate::mail_rules; SMTP/IMAP is crate::mail_transport; QDP front-door forms are
crate::front_door / api::front_door_forms.
Structs§
- Domain
- A domain (or subdomain) acting as an agent.
- Mail
Address - A mail address = a rule-bearing mailbox on a domain.
- Mail
Rules - Rules governing an address (a mailbox) — procedural + semantic.
- Purpose
Preset - A common purpose-inbox preset (a sensible name + rules a user can accept or tweak).
Enums§
- Address
Kind - The kind of a mail address on a domain.
- Agent
Type - QDP agent type (
draft-webcivics-QDP§1) — what kind of agent a domain represents. - Delivery
Resolution - Outcome of semantic delivery resolution for an inbound
toaddress. - Domain
Owner - Who owns/controls a domain.
Personaltoday;Groupis the deferred placeholder (governed by an M:N agreement) — present so the model does not hard-assume single-owner domains. - Resolution
Via - How a delivery address was matched.
Functions§
- address_
counts_ by_ domain - Summary counts for the UI.
- is_
valid_ local_ part - A local-part is a lowercase RFC-ish token: alphanumeric +
.-_, 1..=64 chars, no leading/trailing separator. (Deliberately stricter than RFC 5321 for legibility + safety.) - list_
addresses - list_
domains - make_
domain - Build a
Domainvalue (does not persist). - make_
purpose_ address - Build a purpose-inbox address (does not persist).
- make_
relationship_ address - Build a per-relationship (pairwise) address bound to a relationship DID (does not persist).
- onboard_
purpose_ inboxes - Mint every built-in purpose preset for
domainthat is not already present. Returns the list of newly minted full addresses (empty if already onboarded). - purpose_
presets - The built-in purpose inboxes.
frontdoor@is public-but-governed;junkmail@is the burner;mygov@is verified-sender-only + high-priority + long retention. - resolve
- Resolve a full address (case-insensitive) against a set of addresses.
- resolve_
delivery - Resolve inbound delivery for
to_addressagainst minted mailboxes. - set_
address_ enabled - Enable/disable an address (the surgical per-relationship revoke).
- split_
address - Parse
local@domain(lowercase). ReturnsNoneif not a dotted domain form. - upsert_
address - Persist an address (upsert by full address). Errors if the domain is unknown.
- upsert_
domain - Persist a domain (upsert by name).