Skip to content
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

IPNS pub key size concerns #256

Open
Gozala opened this issue Nov 11, 2021 · 3 comments
Open

IPNS pub key size concerns #256

Gozala opened this issue Nov 11, 2021 · 3 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@Gozala
Copy link

Gozala commented Nov 11, 2021

Recently I was told ed25519 are preferable for IPNS over other keys due to their smaller size. However it is not in the list of supported algorithms in web platform requiring bundling crypto libraries etc...

This got me thinking about potential ways to address this problem, especially since is safe to assume that over time longer keys may proof necessary.

Idea 1.

Right now public keys are endoded IpnsEntry protobuf (which is presumably where we small size is desired). In practice chances are node receiving a record already has a public key because:

  1. IPFS default is to use self key so it was used in handshake.
  2. Recipient has some interest in a IPNS record so key was previously obtained.

If thees assumptions holds, we could make next version of IpnsEntry encode CID for the public key instead. Furthermore small keys and rare keys could use identity hash CIDs. It is also assumed that Sequence 0 record will use identity hash.

Idea 2.

What if instead of basing mutable namespace on the public key we based it on mutex block (genesis block) CID instead that use designated muticodec code. Mutex blocks could encode multiple public keys allowed to perform updates, and also be fairly open ended to allow new or domain specific metadata to be added e.g.

  1. peer ids of nodes that are likely to have latest record.
  2. DNS alias(es)

I think this would also neatly combine IPFS and IPNS namespaces where /ipfs/$cid represents content on creation and /ipns/$cid represents content now. For /ipns/$cid where cid is not for mutex it would be identical to /ipfs/$cid because it's not a mutex so it could never change.

Additional benefit of such mutexes would be that they could cleanly integrate into IPLD as they are addresses by CID.

@Gozala Gozala added the need/triage Needs initial labeling and prioritization label Nov 11, 2021
@hugomrdias
Copy link
Member

idea 2 seems super interesting 🤔

@Stebalien
Copy link
Member

The core issue is that DHT servers need to be able to verify IPNS records without making any network requests. IPNS records used to not include the key (just the peer ID).

Also note: it's not just the key. RSA signatures are the same size as RSA keys (i.e., massive).

IMO, the best solution would be to either:

  1. Convince browsers to support ed25519.
  2. Use ECDSA. go-libp2p, at least, supports this out of the box.

Is a stand-alone ed25519 library really that big? I understand lots of js-crypto libraries are, but I assume a stand-alone unbundled algorithm isn't terrible.

@hugomrdias
Copy link
Member

we now use https://github.com/paulmillr/noble-ed25519 and its small enough IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

3 participants