Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove clone() calls from library internals #91

Merged
merged 9 commits into from
Jan 16, 2022

Conversation

fjarri
Copy link
Collaborator

@fjarri fjarri commented Jan 16, 2022

Fixes #88

The following API changes were made:

  • Signer::new() consumes the given SecretKey (fixes Should Signer consume SecretKey on creation? #61).
  • KeyFrag::verify() and CapsuleFrag::verify() consume the given kfrag/cfrag.
  • As a consequence, KeyFrag::verify() and CapsuleFrag::verify() return the original frag on error (as a tuple with the error itself), for logging purposes (since the original object is not available anymore).
  • reencrypt() consumes the cfrag (but not the capsule, since it wasn't being cloned inside).
  • VerifiedKeyFrag::to_unverified() and VerifiedCapsuleFrag::to_unverified() were renamed to unverify() and consume the corresponding frag.

@fjarri fjarri added the API Related to public API label Jan 16, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2022

Codecov Report

Merging #91 (ab74c02) into master (cd3266b) will decrease coverage by 0.36%.
The diff coverage is 64.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
- Coverage   68.70%   68.34%   -0.37%     
==========================================
  Files          16       16              
  Lines        1342     1333       -9     
==========================================
- Hits          922      911      -11     
- Misses        420      422       +2     
Impacted Files Coverage Δ
umbral-pre/bench/bench.rs 0.00% <0.00%> (ø)
umbral-pre/src/bindings_python.rs 0.00% <0.00%> (ø)
umbral-pre/src/capsule_frag.rs 88.19% <69.23%> (-1.39%) ⬇️
umbral-pre/src/key_frag.rs 89.94% <86.66%> (-0.56%) ⬇️
umbral-pre/src/capsule.rs 91.26% <100.00%> (-0.21%) ⬇️
umbral-pre/src/keys.rs 77.77% <100.00%> (-0.46%) ⬇️
umbral-pre/src/pre.rs 92.06% <100.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd3266b...ab74c02. Read the comment docs.

@fjarri fjarri added Python Related to Python bindings WASM Related to WASM bindings labels Jan 16, 2022
@fjarri fjarri merged commit b83f9fc into nucypher:master Jan 16, 2022
@fjarri fjarri deleted the clone-wars branch January 16, 2022 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to public API Python Related to Python bindings WASM Related to WASM bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce the amount of cloning in the code? Should Signer consume SecretKey on creation?
2 participants