feat(iroh-base)!: reduce external types in the iroh-base API for keys#3529
feat(iroh-base)!: reduce external types in the iroh-base API for keys#3529
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3529/docs/iroh/ Last updated: 2025-10-14T10:20:29Z |
|
Not sure about Edit: And if we need the conversions in downstream crates, maybe make them pub fns with doc_hidden and a doc comment that explains that these may break in semver-compat releases? |
yeah we can do that as alternative |
|
@Frando changed based on your suggestions |
iroh/src/endpoint.rs
Outdated
| let peer_id = VerifyingKey::from_public_key_der(&certs[0]) | ||
| .map_err(|_| RemoteNodeIdSnafu.build())? | ||
| .into(); | ||
| let peer_id = NodeId::from_bytes( |
There was a problem hiding this comment.
This will be validating the key twice, maybe add NodeId::from_public_key_der(&[u8]) -> Result<Self>? But can also be a separate PR, I think this is not changed from before.
We also really should cache the remote's node id on the Connection struct I think, it seems expensive to do this whenever it's accessed. But also separate PR ofc.
iroh/src/key.rs
Outdated
|
|
||
| pub(super) fn public_ed_box(key: &ed25519_dalek::VerifyingKey) -> crypto_box::PublicKey { | ||
| pub(super) fn public_ed_box(key: &PublicKey) -> crypto_box::PublicKey { | ||
| let key = ed25519_dalek::VerifyingKey::from_bytes(key.as_bytes()).expect("valid key"); |
There was a problem hiding this comment.
se could use key.as_verifying_key() here if we keep it pub. I think the only other usage atm is in iroh/src/tls/verifier.rs. So Either let's use as_verifying_key here and there, or make it not pub and use from_bytes/as_bytes in both places. But I think using the pub+doc_hidden fn here is fine.
435e474 to
8a0c16c
Compare
Description
In preparation of stabilizing our APIs, this removes
ed25519_dalektypes from the public API ofiroh-base, except for a few conversions, which aredoc(hidden)to clearly mark them as not stable.Ref #3177
Breaking Changes
iroh_base::Signaturewhich replacesed25519_dalek::Signaturein the public API ofiroh_baseiroh_baseerror types have changedIntoandFromconversions forPublicKey-ed25519_dalek::VerifyingKeyIntoandFromconversions forSecretKey-ed25519_dalek::SigningKey