feat(zeroize): added zeorizing to Felt
#100
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is feature-gated behind the
zeroing
flagPull Request type
What is the current behavior?
Felt
provides no option to zeroize its memory, which can be an issue when dealing with sensitive cryptographic information such as private keys.Resolves: #99
What is the new behavior?
Felt
through thezeroize
crate. Whilezeroize
is not used directly, Felt implements manually theZeroize
trait in the hopes of making this behavior more 'standard'. This has been gated behind thezeroing
feature.Note
Contrarily to
zeroize
, this is done using safe rust by leveragingcore::mem::take
to replace the in-memory representation of a felt with its default value ofFelt::ZERO
.Does this introduce a breaking change?
No. While the
zeroing
feature has been added todefault
, zeroing has not been implemented on drop, both because this would interfere with theCopy
trait ofFelt
but also because it seems like it should be up to the end user to determine when they are dealing with sensitive information.