portal-lib 0.5.0

A Secure file transfer library, written in Rust. The library utilizes SPAKE2 for key negotiation over an insecure channel, and ChaCha20Poly1305 Authenticated Encryption to encrypt the file with the derived shared symmetric key. This enables two peers to transfer a file over any channel without needing to trust the intermediary relay.
Documentation
use thiserror::Error;

#[derive(Error, Debug, PartialEq, Eq)]
pub enum PortalError {
    #[error("Value doesn't exist")]
    NoneError,
    #[error("Provided filename doesn't return a base filename")]
    BadFileName,
    #[error("Provided outdir is not a directory")]
    BadDirectory,
    #[error("Cancelled")]
    Cancelled,
    #[error("Incomplete")]
    Incomplete,
    #[error("Underlying crypto error")]
    CryptoError,
    #[error("Incorrect Mutability")]
    Mutability,
    #[error("Provided storage is too small")]
    BufferTooSmall,
    #[error("Bad registration")]
    BadRegistration,
    #[error("No state initialized")]
    BadState,
    #[error("No peer confirmed")]
    NoPeer,
    #[error("KeyDerivationFailed")]
    BadMsg,
    #[error("EncryptError")]
    PeerKeyMismatch,
    #[error("EncryptError")]
    EncryptError,
    #[error("DecryptError")]
    DecryptError,
    #[error("IOError")]
    IOError,
    #[error("Interrupted")]
    Interrupted,
    #[error("WouldBlock")]
    WouldBlock,
    #[error("Object could not be serialized")]
    SerializeError,
}