Skip to content

Conversation

varun-doshi
Copy link
Contributor

@varun-doshi varun-doshi commented Aug 15, 2025

Description

Fixes #3437
Implement Deref::[u8,32] for PublicKey and SecretKey

Change checklist

  • Self-review.

@n0bot n0bot bot added this to iroh Aug 15, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Aug 15, 2025
@dignifiedquire
Copy link
Contributor

We shouldn't do this for SecretKey, it is too risky given it is secret material

@varun-doshi varun-doshi changed the title feat: impl Deref for PublicKey and SecretKey feat: impl Deref for PublicKey Aug 15, 2025
@varun-doshi
Copy link
Contributor Author

We shouldn't do this for SecretKey, it is too risky given it is secret material

Understood, changes made

@rklaehn
Copy link
Contributor

rklaehn commented Aug 26, 2025

We shouldn't do this for SecretKey, it is too risky given it is secret material

I am not so sure about this. SecretKey has to_bytes, so it's not like the bytes are hidden. I can see why you don't want to implement Display for SecretKey, but Deref seems pretty harmless.

Nevertheless the place where I find the Deref really useful is the PublicKey/NodeId, so I agree that doing it for SecretKey is not necessary. But it seems that if you have one way to get the bytes adding another slightly more convenient way isn't really bad for security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

NodeId / PublicKey should implement Deref<[u8; 32]>
3 participants