dove-core 0.1.1

The shared library behind dove — client-side-encrypted, expiring file sharing from a cloud you own.
Documentation
//! Status types for a `dove request` — the PIN-gated ask for someone else to
//! upload a file to you. `share` run backwards: the link's creator is the
//! eventual receiver. `dove-core` reports these; the CLI and the desktop app
//! render them without needing to know how the gate encodes state on the wire.
//! See [`docs/REQUEST.md`](../docs/REQUEST.md) for the full design.

use std::time::Duration;

/// What to create: the ask (description), optional trust metadata (who's
/// asking, why), an optional PIN the gate checks before handing out an
/// upload slot, how long the link stays live, and the upload budget.
/// `SelfHosted::create_request` consumes this; the CLI (and later the desktop
/// app) build it from user input.
#[derive(Debug, Clone)]
pub struct CreateRequest {
    pub description: String,
    pub from: Option<String>,
    pub message: Option<String>,
    pub pin: Option<String>,
    pub expires: Duration,
    pub uploads: u32,
}

/// Where a request stands: nobody's uploaded yet, something arrived, or the
/// one attempt the gate allowed came back bad.
#[derive(Debug, Clone)]
pub enum RequestStatus {
    Waiting,
    Received { name: String, size: u64 },
    Failed { reason: String },
}

/// One request, enough to identify, describe, and show the state of — what
/// `dove requests` lists and `dove requests get` looks up.
#[derive(Debug, Clone)]
pub struct RequestInfo {
    pub id: String,
    pub description: String,
    pub status: RequestStatus,
}

/// The result of creating a request: the id (for the local ledger) and the
/// link to hand to whoever you're asking to upload.
#[derive(Debug, Clone)]
pub struct NewRequest {
    pub id: String,
    pub link: String,
}