digitalbazaar / did-method-key

A did-io driver for the DID "key" method
Other
25 stars 10 forks source link

Improve the description of the breaking changes introduced by the removal of the `generate` API. #67

Open mattcollier opened 3 months ago

mattcollier commented 3 months ago

https://github.com/digitalbazaar/did-method-key/blob/main/CHANGELOG.md#removed

In v5 of this module the generate API was removed. This was done in part to remove any dealings that this module has with private key material. DID documents are designed to be public facing documents and therefore, private key material is never exposed.

The changelog states that the generate method has been replaced by the new method fromKeyPair. This language and the fact that the return value of the two methods appear to be identical {didDocument, keyPairs} would lead one to believe that the keyPairs returned by generate and those returned by fromKeyPair would be identical but this is not the case.

The keyPairs returned by the generate API did return keys that had their private key material intact and therefore a pattern of usage developed that involved using those keys as signers for various purposes. However, the keyPairs returned by the fromKeyPair API do not have private key material and therefore cannot be used as a signer.

Tests are being rev'd up in other libraries that demonstrate the new recommended pattern of usage when using v5 of this module. We will link to those tests here.