digitalbazaar/did-method-key

Library needs to implement Options from `did:key` v0.7 spec

Opened this issue · 0 comments

The did:key 0.7 spec introduces some options (with defaults) in the document creation algorithm.

The options are:

  • publicKeyFormat (should be multiKey or Ed25519VerificationKey2020)
  • enableExperimentalPublicKeyTypes (defaults to false)
  • defaultContext (defaults to [https://www.w3.org/ns/did/v1])
  • enableEncryptionKeyDerivation (should be true to enable keyAgreementKey )

These options should be passed in on didDocument creation regardless of if creating from from privateKey or publicKey seed.

These options also have some validation rules behind them:

  • If publicKeyFormat is not known to the implementation, an unsupportedPublicKeyType error MUST be raised.
  • If options.enableExperimentalPublicKeyTypes is set to false and publicKeyFormat is not Multikey, JsonWebKey2020, or Ed25519VerificationKey2020, an invalidPublicKeyType error MUST be raised.
  • If options.enableExperimentalPublicKeyTypes is set to false and publicKeyFormat is not Multikey, JsonWebKey2020, or X25519KeyAgreementKey2020, an invalidPublicKeyType error MUST be raised.