Coder Social home page Coder Social logo

ega-archive / crypt4gh-rust Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 2.12 MB

Rust implementation for the Crypt4GH encryption format

Home Page: https://ega-archive.github.io/crypt4gh-rust

License: Apache License 2.0

Rust 99.87% Just 0.13%
crypt4gh ga4gh crg ega ega-archive cryptography cryptography-tools

crypt4gh-rust's People

Contributors

brainstorm avatar mmalenic avatar mrrobb avatar silverdaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

umccr

crypt4gh-rust's Issues

Deprecation notice

    Finished release [optimized] target(s) in 58.80s
warning: the following packages contain code that will be rejected by a future version of Rust: rustc-serialize v0.3.24
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`

Returning a `Result` rather than using `assert!` for error conditions

There's a few places where an assert! is used to check for a condition instead of a Result returning an Err. It might be nice to have these assert!s converted to Crypt4GHErrors.

For example:

crypt4gh-rust/src/header.rs

Lines 319 to 336 in ce0c336

pub fn deconstruct_header_info(
header_info_file: &[u8; std::mem::size_of::<HeaderInfo>()],
) -> Result<HeaderInfo, Crypt4GHError> {
let header_info =
bincode::deserialize::<HeaderInfo>(header_info_file).map_err(|e| Crypt4GHError::ReadHeaderError(e))?;
assert!(
&header_info.magic_number == MAGIC_NUMBER,
"Not a CRYPT4GH formatted file"
);
assert!(
header_info.version == VERSION,
"Unsupported CRYPT4GH version (version = {})",
header_info.version
);
Ok(header_info)
}
could return something like a Crypt4GH::MagicStringError if the magic string is not correct.

This would give the opportunity for library consumers of the crate to choose what to do when encountering an invalid Crypt4GH file.

I'd be happy to fork/PR some changes for this.

/cc @brainstorm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.