Everything increasingly runs on Ed25519 keypairs, but Ed25519 public keys can be encoded as text in dozens of surface-incompatible different ways: hexadecimal, Base64 (OpenSSH), Base32z (iroh, pkdns), Base58 (NEAR), and Multibase (IPFS, libp2p), just for starters.

Edky is a command-line tool and Rust library that converts between these Ed25519 surface encodings, aiding use of the same underlying keypair across e.g. an iroh endpoint, a libp2p peer, or a NEAR Protocol account. (Surprisingly, a conversion utility like this didn't yet exist!)

    $ cargo binstall -y edky

    $ edky convert -f iroh -t libp2p 47pjoycnsrfmxikm95jh13y88e8qnhzu5kungjpxyepgt7a8krpy
    z6MktwupdmLXVVqTzCw4i46r4uGyosGXRnR3XjN4Zq7oMMsw

    $ edky convert -f libp2p -t iroh z6MktwupdmLXVVqTzCw4i46r4uGyosGXRnR3XjN4Zq7oMMsw
    47pjoycnsrfmxikm95jh13y88e8qnhzu5kungjpxyepgt7a8krpy

    $ edky convert -f near -t hex ed25519:FVen3X669xLzsi6N2V91DoiyzHzg1uAgqiT8jZ9nS96Z
    d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a

    $ edky convert -f hex -t near d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a
    ed25519:FVen3X669xLzsi6N2V91DoiyzHzg1uAgqiT8jZ9nS96Z
  • raphinou an hour ago |
    Interesting. I'm using ed25519 keys in my open source project [1] to sign GitHub releases (amongst other things) and the encoding question appeared during the development. I settled on supporting reading ssh keys, but saving keys in a specific format. I'll need to have a look to possible revisit my choices as it is developed in rust too.

    1: https://www.asfaload.com

    Sources at https://github.com/asfaload/asfaload

    • arto an hour ago |
      Cool project! Note that from the encodings currently implemented in Edky, OpenSSH's encoding is the most complicated to encode/decode. If anybody would need to be working with your public keys and signatures outside your own code base, I'd suggest the simplest would be to keep to hexadecimal or Base64(Url).
      • raphinou 12 minutes ago |
        Thanks for the appreciation and the tip! I'll keep an eye on edky!

        Asfaload is easy to selfhost, if it is of any interest to you.