Crates.io | downify |
lib.rs | downify |
version | 0.2.1 |
source | src |
created_at | 2019-01-22 12:22:06.385831 |
updated_at | 2019-02-27 19:20:14.456876 |
description | Downify is a small Rust library for downloading, signing, and verifying files. |
homepage | https://github.com/timtom-dev/downify |
repository | https://github.com/timtom-dev/downify |
max_upload_size | |
id | 109999 |
size | 15,991 |
Downify is a small Rust library for downloading, signing, and verifying files. It's intended to be used as part of an application's update mechanism.
The library uses reqwest to download a file from a URL and hashes it with blake2-rfc. Sodiumoxide is then used to verify the file's signed hash before returning a VerifiedFile
handle.
Sodiumoxide's keys and signatures are encoded with base64's URL_SAFE_NO_PAD for storage/transfer.
A command-line interface to the library, with options based on OpenBSD's Signify, is included.
extern crate downify;
// Generate a keypair
let (public_key, secret_key) = downify::gen_keypair();
// Sign a file
let signature = downify::sign("/source/path", &secret_key);
// Verify a local file
let file_handle = downify::verify_open("/source/path", &signature, &public_key).unwrap();
// Verify a remote file
let file_handle = verify_get("https://www.example.com/", "/destination/path", &signature, &public_key).unwrap();