HayateReceiver is the high-level interface for accepting incoming encrypted file and directory transfers. Like HayateSender, it follows a builder pattern — configure it with chained calls, then invoke .receive() to bind a QUIC listener, wait for an incoming connection, perform the handshake, and save the payload to disk. The receiver supports both Direct Mode (wait for a connection on a known port) and Pairing Mode (find the sender by listening for a matching LAN broadcast).
Builder Methods
HayateReceiver
Creates a new
HayateReceiver with default configuration. Defaults: bind address 0.0.0.0:50001, no pairing code, auto-accept disabled.HayateReceiver
Sets the local socket address the QUIC listener will bind to. Use this to control which network interface and port Hayate listens on. Defaults to
0.0.0.0:50001 if not called.HayateReceiver
Sets the shared passphrase for Pairing Mode. The receiver will listen for UDP broadcast and mDNS announcements whose channel ID matches a hash of this phrase, then connect to the sender automatically. The passphrase is mixed into key derivation — only a sender that knows the same phrase can complete the handshake.
HayateReceiver
When set to
true, the receiver accepts every incoming transfer without invoking the consent_cb. Default: false. Useful for automated pipelines where every incoming transfer is trusted, but should not be used in interactive applications where the user should approve transfers.Receiving
output_dir. Returns (checksum, saved_path) on success.
output_dir— the directory where the received file or directory will be written. The final filename comes from theMetadatatransmitted by the sender.consent_cb: impl FnOnce(&Metadata) -> bool— called once after the handshake, with the decryptedMetadatadescribing the incoming transfer (filename, size, hash algorithm). Returntrueto accept the transfer,falseto reject it. If.auto_accept(true)was set, this callback is not invoked.progress_cb— called periodically with the total number of bytes received so far. ReturnOk(())to continue; returnErr(EngineError::Cancelled(...))to abort.
(String, PathBuf) tuple: the hex checksum of the received payload, and the full filesystem path where it was saved.