Weave documentation
Rust referenceweave-sdk

weave-sdk · mailbox

Source declarations, signatures and documentation for mailbox.

Source: sigil/weave/libs/weave-sdk/src/mailbox.rs. SHA-256: 2e2bd2351061ef2c3cfe6f9b47851600fe4f0a8fb3329cc1d7d18fe1941e5b05.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

Module condition:

#[cfg(feature = "mailbox")]

mailbox::MAILBOX_ROOTS

#[cfg(feature = "mailbox")]
pub const MAILBOX_ROOTS: [&str; 8];

Source line: 12.

mailbox::MailboxError

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, Error, PartialEq, Eq)]
pub enum MailboxError {
    #[error("invalid mailbox path: {0}")]
    InvalidPath(String),
    #[error("private mailbox paths cannot be publicly pinned: {0}")]
    PrivatePath(String),
    #[error("invalid ciphertext field: {0}")]
    InvalidCiphertext(String),
    #[error("invalid message object: {0}")]
    InvalidMessage(String),
    #[error("mailbox encryption failed: {0}")]
    Encryption(String),
    #[error("mailbox decryption failed: {0}")]
    Decryption(String),
    #[error("mail content key unwrap failed")]
    KeyUnwrap,
}

Source line: 24.

mailbox::canonical_mailbox_roots

#[cfg(feature = "mailbox")]
pub fn canonical_mailbox_roots() -> [&'static str; 8];

Source line: 41.

mailbox::MailboxPath

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MailboxPath(String);

Source line: 46.

mailbox::MailboxPath::new

#[cfg(feature = "mailbox")]
pub fn new(path: impl Into<String>) -> Result<Self, MailboxError>;

Source line: 49.

mailbox::MailboxPath::as_str

#[cfg(feature = "mailbox")]
pub fn as_str(&self) -> &str;

Source line: 62.

mailbox::is_private_mailbox_path

#[cfg(feature = "mailbox")]
pub fn is_private_mailbox_path(path: &str) -> bool;

Source line: 67.

mailbox::pin_public_mail_file

#[cfg(feature = "mailbox")]
pub fn pin_public_mail_file(path: &str) -> Result<(), MailboxError>;

Source line: 73.

mailbox::unpin_public_mail_file

#[cfg(feature = "mailbox")]
pub fn unpin_public_mail_file(path: &str) -> Result<(), MailboxError>;

Source line: 85.

mailbox::MailFolder

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum MailFolder {
    Inbox,
    Sent,
    Drafts,
    Archive,
}

Source line: 91.

mailbox::MailFolder::root

#[cfg(feature = "mailbox")]
pub fn root(self) -> &'static str;

Source line: 99.

mailbox::CiphertextBlob

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CiphertextBlob {
pub algorithm: String,
pub blob_hash: String,
pub nonce_b64: String,
pub ciphertext_b64: String,
pub tag_b64: String
}

Source line: 110.

mailbox::CiphertextBlob::validate

#[cfg(feature = "mailbox")]
pub fn validate(&self, label: &str) -> Result<(), MailboxError>;

Source line: 119.

mailbox::KeyWrap

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct KeyWrap {
pub key_id: String,
pub key_version: u64,
pub algorithm: String,
pub wrapped_dek_b64: String
}

Source line: 152.

mailbox::MailboxContentKey

#[cfg(feature = "mailbox")]
#[derive(Clone)]
pub struct MailboxContentKey(MasterKey);

Source line: 160.

mailbox::MailboxContentKey::from_bytes

#[cfg(feature = "mailbox")]
pub fn from_bytes(bytes: [u8; MEK_LEN]) -> Self;

Source line: 163.

mailbox::MailboxContentKey::as_bytes

#[cfg(feature = "mailbox")]
pub fn as_bytes(&self) -> &[u8; MEK_LEN];

Source line: 167.

mailbox::PlainMailMessageInput

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PlainMailMessageInput {
pub mailbox_id: String,
pub folder: MailFolder,
pub sender_route_commitment: String,
pub sender_signature_b64: String,
pub recipient_key_id: String,
pub recipient_key_version: u64,
pub subject: Vec<u8>,
pub body: Vec<u8>,
pub recipient_metadata: Vec<u8>,
pub attachment_refs: Vec<AttachmentRef>,
pub sigil_delivery_commitment_id: Option<String>,
pub created_at_ms: u64,
pub updated_at_ms: u64,
pub client_nonce: String
}

Source line: 179.

mailbox::decrypt_mailbox_field

#[cfg(feature = "mailbox")]
pub fn decrypt_mailbox_field(
    key: &MailboxContentKey,
    blob: &CiphertextBlob,
) -> Result<Vec<u8>, MailboxError>;

Source line: 232.

mailbox::wrap_mail_content_key

#[cfg(feature = "mailbox")]
pub fn wrap_mail_content_key(
    key_id: &str,
    key_version: u64,
    content_key: &MailboxContentKey,
    recipient_public_key: &[u8; 32],
) -> Result<KeyWrap, MailboxError>;

Source line: 254.

mailbox::unwrap_mail_content_key

#[cfg(feature = "mailbox")]
pub fn unwrap_mail_content_key(
    wrap: &KeyWrap,
    recipient_key_pair: &weave_crypto::EncryptionKeyPair,
) -> Result<MailboxContentKey, MailboxError>;

Source line: 275.

mailbox::AttachmentRef

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AttachmentRef {
pub attachment_id: String,
pub attachment_manifest_ref: String,
pub ciphertext_content_hash: String,
pub key_version: u64
}

Source line: 291.

mailbox::EncryptedMailMessageV1

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct EncryptedMailMessageV1 {
pub message_id: String,
pub mailbox_id: String,
pub folder: MailFolder,
pub sender_route_commitment: String,
pub sender_signature_b64: String,
pub recipient_key_id: String,
pub recipient_key_version: u64,
pub key_wraps: Vec<KeyWrap>,
pub encrypted_subject: CiphertextBlob,
pub encrypted_body: CiphertextBlob,
pub encrypted_recipient_metadata: CiphertextBlob,
pub attachment_refs: Vec<AttachmentRef>,
pub ciphertext_content_hash: String,
pub sigil_delivery_commitment_id: Option<String>,
pub created_at_ms: u64,
pub updated_at_ms: u64
}

Source line: 299.

mailbox::EncryptedMailMessageV1::validate

#[cfg(feature = "mailbox")]
pub fn validate(&self) -> Result<(), MailboxError>;

Source line: 319.

mailbox::AttachmentManifestV1

#[cfg(feature = "mailbox")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AttachmentManifestV1 {
pub attachment_id: String,
pub encrypted_metadata: CiphertextBlob,
pub ciphertext_hash: String,
pub weft_manifest_ref: String,
pub key_wraps: Vec<KeyWrap>
}

Source line: 350.

mailbox::AttachmentManifestV1::validate

#[cfg(feature = "mailbox")]
pub fn validate(&self) -> Result<(), MailboxError>;

Source line: 359.

mailbox::message_id

#[cfg(feature = "mailbox")]
pub fn message_id(
    mailbox_id: &str,
    sender_route_commitment: &str,
    ciphertext_content_hash: &str,
    client_nonce: &str,
) -> Result<String, MailboxError>;

Source line: 376.

mailbox::encrypt_message_v1

#[cfg(feature = "mailbox")]
pub fn encrypt_message_v1(
    input: PlainMailMessageInput,
    content_key: &MailboxContentKey,
) -> Result<EncryptedMailMessageV1, MailboxError>;

Source line: 403.

On this page