mail.rs.
When to use this
- Send a notification, invoice, or signed document to another DID.
- Build an inbox or DM-style interface.
- Issue webhooks where the recipient controls a public key, not a URL.
Prerequisites
- Sender funded DID.
- Recipient must have published a delivery key.
- An off-chain content store (default: Weave) to host the encrypted payload.
Recipe
Publish your delivery key (recipients)
Anyone receiving mail first publishes the public half of their delivery key. The chain accepts X25519 keys for AEAD-based payload encryption.Look it up with:
Set a delivery policy (optional)
Restrict who may send to your mailbox. Common policies: open, allowlist, stake-gated, or controller-only.The Rust SDK’s
allow_all_policy() helper returns the canonical permissive policy.Send mail
The sender:
- Encrypts the payload off-chain with the recipient’s delivery key.
- Pins the ciphertext (Weave, IPFS, S3, …) and gets a content address.
- Computes the delivery commitment.
- Submits a
SigilMailSendtransaction.
preflight_delivery_commitment and delivery_commitment so you can validate the commitment locally before submitting. Cross-language pattern:Common errors
| Symptom | Cause | Fix |
|---|---|---|
recipient has no delivery key | Recipient never called SigilMailPublishKey | Have the recipient publish their key first |
policy denies sender | Allowlist mismatch | Ask the recipient to update their policy |
commitment mismatch | Local commitment ≠ recomputed value | Re-run preflight; check field order and nonce bytes |
ciphertext too large | Per-mail size cap exceeded | Split into multiple deliveries or use a chunked transport |
See also
- Primitive: Sigil Mail — protocol details.
mail.rs— Rust helpers for commitments and mailbox ids.- Cookbook: Issue a mandate — to delegate mail-send authority.