Expand description
Mailcycle for Rust.
Privacy-first email you can automate. Create addresses that receive mail, read and decrypt it on your own machine, send, and listen for events.
use mailcycle::{Mailcycle, NewAddress, WaitFor};
let mc = Mailcycle::sign_in(&std::env::var("MAILCYCLE_PHRASE").unwrap(), Default::default())?;
let address = mc.addresses().create(NewAddress {
label: Some("Sign-in codes".into()),
..Default::default()
})?;
let message = mc.messages().wait_for(WaitFor {
address_id: Some(&address.id),
..Default::default()
})?;
println!("{}: {}", message.subject, message.text);The recovery phrase never leaves this machine. Mail is sealed to a key derived from it, so the API serves ciphertext it cannot read, and this crate opens it locally. Lose the phrase and the mail is gone; nobody at Mailcycle can help.
Documentation: https://docs.mailcycle.email/
Re-exports§
pub use client::Mailcycle;pub use client::NewAddress;pub use client::Options;pub use client::Outgoing;pub use client::OutgoingAttachment;pub use client::WaitFor;pub use crypto::mnemonic::generate_phrase;pub use crypto::mnemonic::validate_phrase;pub use error::Error;pub use error::PhraseProblem;pub use error::Result;pub use error::UPGRADE_URL;pub use events::EventStream;pub use events::Hooks;pub use keys::Keys;pub use manage::ApiKeys;pub use manage::Sessions;pub use manage::Webhooks;pub use models::Account;pub use models::AccountEvent;pub use models::ActivityEntry;pub use models::ActivityPage;pub use models::Address;pub use models::AddressKeyExport;pub use models::ApiKey;pub use models::Attachment;pub use models::CreatedApiKey;pub use models::CreatedWebhook;pub use models::DeliveryPage;pub use models::Device;pub use models::Domain;pub use models::Message;pub use models::MessagePage;pub use models::NameStyle;pub use models::Plan;pub use models::QueuedDelivery;pub use models::SendResult;pub use models::Session;pub use models::Subscription;pub use models::Webhook;pub use models::WebhookDelivery;pub use models::WebhookList;pub use models::WebhookUpdate;pub use pairing::parse_scanned_value;pub use pairing::KeyBundle;pub use pairing::ScannedPairing;pub use trackers::strip_remote_content;pub use trackers::summarize_blocked;pub use trackers::BlockedTracker;pub use trackers::StripResult;pub use webhooks::verify_webhook_signature;pub use webhooks::verify_webhook_signature_now;pub use webhooks::webhook_signature_header;
Modules§
- client
- A client for one Mailcycle account.
- crypto
- Mailcycle’s encryption, in the order an implementation needs it.
- encoding
- base64url without padding, decoded strictly.
- error
- Every error this crate returns.
- events
- The account event stream,
GET /accounts/live. - http
- One HTTP wrapper. Every failure comes out as
Error::Apiwith the API’s own code, so a caller matches on the code rather than on a message. - keys
- The account’s keys, derived from its recovery phrase on this machine.
- Opening a stored message.
- manage
- API keys, webhooks and sessions.
- models
- The shapes a caller sees.
- pairing
- Pairing a device, and handing it the keys for its addresses.
- trackers
- Tracker stripping.
- webhooks
- Checking a webhook came from Mailcycle.