Closed mmalenic closed 9 months ago
Good catch! As you know I'm currently transitioning away from sodiumoxide towards RustCrypto in our fork here: https://github.com/umccr/crypt4gh-rust. So lets incorporate this change you propose as well, also fix #1 and also potentially introduce API-breaking changes on the public interface such as not having buffers as function arguments, but other builder-type constructs that are more idiomatic that we briefly discussed a couple of weeks ago.
I think I've taken care of most asserts, there's only a few remaining in #3.
There's a few places where an
assert!
is used to check for a condition instead of aResult
returning anErr
. It might be nice to have theseassert!
s converted toCrypt4GHError
s.For example: https://github.com/EGA-archive/crypt4gh-rust/blob/ce0c33695aac6f9275654deb7a263f93cf2b6e1a/src/header.rs#L319-L336 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