ipfs-shipyard / js-did-ipid

The IPID DID method implementation in JavaScript
MIT License
21 stars 9 forks source link

Support for jwk / multicodec / did:key #20

Open OR13 opened 4 years ago

OR13 commented 4 years ago

The DID Core spec allows the use of JWK keys for all verification methods... because of this, they are a better interoperability target than PEM.

If the representations supported here: https://github.com/w3c-ccg/lds-jws2020

Don't cover the cryptographic primitives needed for IPID, I would be glad to know that.

satazor commented 4 years ago

It seems that libp2p crypto has no support for jwk. Ideally the support should be added there to avoid having adoc integrations here.

//cc @vasco-santos

vasco-santos commented 4 years ago

We have some "on going"/"to start" efforts regarding crypto in libp2p:

We can eventually get jwk keys to the crypto roadmap. @OR13 Can you start by creating an issue in the libp2p/js-libp2p-crypto module?

OR13 commented 4 years ago

does lib p2p support multicodec / base58 ? Its possible that is also a better future facing target than PEM.

I recently implemented support for did:key with secp256k1, and added support for cross conversion from base58 / hex / jwk here: https://github.com/transmute-industries/did-key.js

Seems like from https://github.com/libp2p/js-libp2p-crypto#cryptokeys

Ideally did:ipid would support RSA, Ed25519 and Secp256k1 + NIST Curves as JWKs / base58... base58 might be more in the spirit of IPFS.

There is an intermediary representation for keys which makes support for DIDs easier, here is an example for secp256k1: https://github.com/transmute-industries/did-key.js/blob/master/packages/did-key-secp256k1/src/Secp256k1KeyPair.ts

I would expect ipid to rely on something like this wrapped around libp2p/js-libp2p-crypto.

OR13 commented 4 years ago

I opened: https://github.com/libp2p/js-libp2p-crypto/issues/177

I'm not sure about the best way to layer these things, but I'd personally love to see less PEM and JWK and more multicodec.