n0-computer / iroh

peer-2-peer that just works
https://iroh.computer
Apache License 2.0
2.61k stars 165 forks source link

Move PublicKey and SecretKey to iroh-base #1908

Open rklaehn opened 11 months ago

rklaehn commented 11 months ago

Ed keys are a core concept that is used both as node ids and as authors etc. They really belong into iroh-base. Currently we have quite some code duplication because iroh-sync has it's own key like structs for author and namespace.

But to do that we need to get rid of the global static crypto key cache and make it explicit. This can be done almost transparently, but there is one major change: deserializing a public key would no longer ensure that it is a valid ed public key. You would only know that once you try to use it as a public key.

See discussion here: https://github.com/n0-computer/iroh/pull/1677#pullrequestreview-1689434062

I am not sure how bad the consequences are. Maybe it is a non-issue.

flokli commented 5 months ago

It might make sense to batch this with https://github.com/n0-computer/iroh/issues/2355, which proposes making the signing functionality (and exploring the pubkey) a trait.