# ava1
<p align="center"><img src="https://raw.githubusercontent.com/phantomptr/ava1/main/branding/png/lockup-horizontal-black.png" alt="AVA1" width="360" /></p>
[](https://github.com/phantomptr/ava1/actions/workflows/ci.yml)
[](https://crates.io/crates/ava1)
[](https://docs.rs/ava1)
[](#license)
The Rust implementation of [AVA1](https://github.com/phantomptr/ava1) (Adaptive Verified
Assembly, version 1), an encrypted, resumable, multi-lane protocol for moving large files and
folders between two devices over TCP. It has a client (connect, pair, upload, download, RPC) and
a node (`server::ServerCtx`, with `host::FolderHost` to serve a folder), and is tested on every
change against the C node in the same repository.
AVA1 was designed for transfers to a PlayStation 5: in
[ps5upload](https://github.com/phantomptr/ps5upload) the C node runs on the console and this
crate is the client on a PC, phone or server. Nothing in it is specific to the PS5, and it works
between any two devices.
- **Fast.** Up to 8 parallel lanes; a governor sets lanes and chunk size from whatever is slowest
at the moment (network, source disk, receiving disk).
- **Resumable.** The receiver journals what is durably written; a dropped connection or a
restarted device picks up where it stopped.
- **Verified.** Every file is checked with BLAKE3 in 1 MiB groups before it counts as written.
- **Encrypted and paired.** Noise XX, ChaCha20-Poly1305 on every frame, and a one-time pairing
code, after which the devices recognise each other's keys.
- **Extensible.** Sessions carry RPCs; applications add their own methods with
[`ava1-gen`](https://crates.io/crates/ava1-gen).
```toml
[dependencies]
ava1 = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
```rust,ignore
let mut session = ava1::session::connect(addr, identity, peers, "my laptop", Timing::default()).await?;
if session.pairing_pending() {
session.confirm_pairing(code_shown_by_the_node).await?;
}
let source = LocalSource::new(folder.into());
[specification](https://github.com/phantomptr/ava1/blob/main/spec/SPEC.md), and the
[repository README](https://github.com/phantomptr/ava1#readme).
## Support
AVA1 is made by [PhantomPtr](https://x.com/phantomptr). Questions are welcome on
[Discord](https://discord.gg/fzK3xddtrM), and if AVA1 is useful to you, you can
[buy me a coffee on Ko-fi](https://ko-fi.com/B0B81S0WUA).
## License
Licensed under either of [Apache License, Version 2.0](https://github.com/phantomptr/ava1/blob/main/LICENSE-APACHE)
or [MIT license](https://github.com/phantomptr/ava1/blob/main/LICENSE-MIT) at your option.