Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A KeyAgreement key is required to generate a DID document, even though KeyAgreement is an optional field #64

Open
wip-abramson opened this issue Oct 25, 2023 · 1 comment

Comments

@wip-abramson
Copy link

I am attempting to use this library with https://github.com/digitalbazaar/ecdsa-secp256k1-verification-key-2019.

This requires a few tweaks like adding the fromFingerprint method. But after I get round that I run into an error when running:

const secpDidController = await didKeyDriverSecp.fromKeyPair({
    verificationKeyPair: secpKeyPair
});

The error is Error: Cannot derive key agreement key from verification key type "EcdsaSecp256k1VerificationKey2019".
After digging into the code it appears that the error comes from here

default: {

My question is why is this an error, can't you just generate the DID document without a key agreement key?

I added a specific case for EcdsaSecp256k1VerificationKey2019 with just a break, similar to the Multikey case and the DID doc generated fine.

@dlongley
Copy link
Member

I agree that it should be possible to generate a DID doc without a key agreement key. It's not clear what the default behavior ought to be or if it should be different per key type, but we can sort that out over time.

We're trying to make this driver more key agnostic with a plugin-based approach, so adding more special exceptions for certain key types isn't something we want. Ideally we'd just call into the key-specific plugin here and let it do whatever it's going to do. In other words, it's a goal to get any key-specific code out of the core driver code and into plugin space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants