agent-phone 0.1.0

Minimal sync RPC between two AI agents (Rust port of @p-vbordei/agent-phone). Self-custody keys, Noise-framework handshake, DID-bound WebSocket.
Documentation
//! Post-handshake transport frame cipher.

use crate::error::{Error, Result};
use crate::noise::HandshakeResult;

pub const MAX_PLAINTEXT: usize = 65519;

pub struct FrameCipher {
    pub transport: HandshakeResult,
}

impl FrameCipher {
    pub fn new(transport: HandshakeResult) -> Self {
        Self { transport }
    }

    pub fn seal(&mut self, plaintext: &[u8]) -> Result<Vec<u8>> {
        if plaintext.len() > MAX_PLAINTEXT {
            return Err(Error::PlaintextTooLarge {
                got: plaintext.len(),
                max: MAX_PLAINTEXT,
            });
        }
        self.transport.send(plaintext)
    }

    pub fn open(&mut self, ciphertext: &[u8]) -> Result<Vec<u8>> {
        self.transport.recv(ciphertext)
    }
}