portal-lib-0.1.0 has been yanked.
portal-lib
A small Protocol Library for Portal - An encrypted file transfer utility
This crate enables a consumer to:
- Create/serialize/deserialize Portal request/response messages.
- Negoticate a symmetric key with a peer using SPAKE2
- Encrypt files with Chacha20poly1305 using the RustCrypto implementation
- Send/receive files through a Portal relay
Example of SPAKE2 key negotiation:
// receiver
let dir = Some;
let pass ="test".to_string;
let = init;
// sender
let dir = Some;
let pass ="test".to_string;
let = init;
receiver.confirm_peer.unwrap;
sender.confirm_peer.unwrap;
assert_eq!;
Example of Sending a file:
// open file read-only for sending
let mut file = portal.load_file?;
// Encrypt the file and share state
file.encrypt?;
file.sync_file_state?;
// Get an iterator over the file in chunks
let chunks = portal.get_chunks;
// Iterate over the chunks sending the via the client TcpStream
for data in chunks.into_iter
Example of Receiving a file:
// create outfile
let mut file = portal.create_file?;
// Receive until connection is done
let len = match file.download_file?;
assert_eq!;
// Decrypt the file
file.decrypt?;