aries-framework-go icon indicating copy to clipboard operation
aries-framework-go copied to clipboard

Can not generate a presentation by credential Id

Open adn-misa opened this issue 3 years ago • 1 comments

What I'm trying to do

I trying to generate a presentation by credential Id.

Expected result

I should get back a signed verifiable presentation.

Actual result

I Get a presentation generation error with data not found.

I searched for the cause of the issue and I assume it came down to the following behaviour:

During the creation of the diddoc, the validation methods are hardcoded to either #key-1 or #key-2 into the did doc, but the key pair managed by the KMS saves it with its actual kid with the storage interface.

https://github.com/hyperledger/aries-framework-go/blob/main/pkg/didcomm/protocol/didexchange/keys.go#L49 https://github.com/hyperledger/aries-framework-go/blob/main/pkg/didcomm/protocol/didexchange/keys.go#L76

Same behaviour can also implemented in outofband v2

https://github.com/hyperledger/aries-framework-go/blob/main/pkg/didcomm/protocol/outofbandv2/service.go#L419 https://github.com/hyperledger/aries-framework-go/blob/main/pkg/didcomm/protocol/outofbandv2/service.go#L446

Because of the hardcoded key values, later on during the presentation generation by id, the framework can not find kkey-1 nor kkey-2 (i assume the additional k is to represent a key internally).

I made a fix (only for didexchange) that did make the presentation generation work by actually using the generated kid by the KMS instead of the hardcoded values: https://github.com/adn-misa/aries-framework-go/commit/5531c69a60a0020b4a15b15283be9effae108e79

Before doing a pull request, i would like some feedback on the issue to clear my assumption and to be sure that it is an issue and not me using the framework wrong.

adn-misa avatar Dec 13 '21 07:12 adn-misa

@adn-misa we had similar discussion in this issue, for now we are treating key IDs in DID Document as actual key IDs to make agent work with all kind of DID methods.

Either you have to create key pair inside aries and use the generated key IDs in did document or manually import key into aries KMS using KID mentioned in DIDDocument.

sudeshrshetty avatar Jan 20 '22 03:01 sudeshrshetty