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
feat: implement display/debug traits for private keys #30
Conversation
Reviewers: the first commit fixes |
This is perfect @erwanor. It would be super nice to have a test or two. Otherwise, the PR looks good to me! |
Ah yeah good point, added a test for each. |
94f8b9e
to
6371dce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat thanks, I'll refactor with those macros |
Cargo.toml
Outdated
@@ -36,6 +36,7 @@ blst = "0.3.10" | |||
digest = "0.10.3" | |||
once_cell = "1.13.1" | |||
readonly = "0.2.2" | |||
diem-crypto-derive = "0.0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally avoid a diem dependency, especially because this code part is not complex to be ported (copy pasted with a comment reference) without maintainability issues. However, we can do in an upcoming PR. If we do in upcoming PR, please merge and add a github issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do it now, but macros need their own special crate type, so we will have a nested crate fastcrypto::crypto_derive
.
I'll push the changes shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
// Imported from diem-crypto-derive@0.0.3 | ||
// https://github.com/diem/diem/blob/release-1.4.3/crypto/crypto-derive/src/lib.rs#L113 | ||
|
||
#[proc_macro_derive(SilentDisplay)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! thanks
Fixes #14, at least partially! For the public keys, base64 will have to do until #1 is resolved.
For consideration: do you think a
Secret
derive macro that:Zeroize
Display
andDebug
unsafe_write_secret: &self -> String
(for debugging)makes sense? I could slot it into this PR. This would make the code nicer: