Skip to content

Conversation

@mmaker
Copy link

@mmaker mmaker commented Nov 4, 2025

I'm having trouble being able to clone public keys without wacky work-around via AsRef and From.
Is there any way they could be made clone-able?

In particular, this allows public keys to be Clone-able.
@mmaker mmaker requested a review from a team as a code owner November 4, 2025 14:01
@mmaker
Copy link
Author

mmaker commented Nov 17, 2025

@franziskuskiefer friendly bump here!

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cloning here is generally fine, but we should only do it for non private keys.

@@ -1,5 +1,6 @@
macro_rules! impl_generic_struct {
($name:ident, $doc:expr) => {
#[derive(Clone)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also used for the private keys, which shouldn't make it that easy. Can you move the struct definition out of here? Then you can add clone only for the public keys.

Copy link
Author

@mmaker mmaker Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can, just to understand better the desired feature tho: why are secret keys not clone-able?

Currently it's not possible to use secret keys across threads, or have it be serialized with zerocopy. I don't think cloning secret keys explicitly (differently than, say, Copy) causes security issues, right?

Anyways, going first with the external implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a strong requirement. But copying any secret bytes may be a security issue. Making it easier is just not great. But it's not a huge deal, and this bit is changing anyway. So maybe let's just keep it as is for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants