digitalbazaar/did-method-key

Return the private key material in the generate API

Closed this issue · 6 comments

It appears the private key material is getting dropped on the floor in the generate API. I expect that I would be able to get the LDKeyPair instance returned along with the DID document. Is that an improper expectation?

https://github.com/digitalbazaar/did-method-key-js/blob/master/lib/driver.js#L88-L91

::facepalms:: Er, merely a dumb oversight on my part.

This does change the return signature of .generate(), so it'll be a fairly major breaking change. However, since we just changed the multicodec encoding of X25519 keys, we already have a major change to propagate downstream, so this'll be good.

@mattcollier Would it be ok to return the generated key inside the DidDocument?

The way did-veres-one handles it is - generate() returns a DID Document instance, and all the generated public/private key pairs are available at didDoc.keys property.

We chould change the return signature of did:key driver's generate to be {keyPair, didDoc}, but would it be ok to match the did:v1 driver and just return didDoc, with the key pair being available on didDoc.keys?

@dmitrizagidulin having all the various methods have some consistent behavior would be great. Maybe we can discuss for a few moments during today's call.

@mattcollier sure thing. (Also, for a (non-binding) example of that would look like, see #22 )

Implemented in PR #22, closing.