openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
277 stars 202 forks source link

Accept Proposal should reuse credential definition id from the Proposal #827

Closed NB-MikeRichardson closed 2 years ago

NB-MikeRichardson commented 2 years ago

accepting a proposal should take the credential definition id from the proposal to send a credential offer (if availalbe on the proposal). This functionality was there for v1 (and still is: https://github.com/hyperledger/aries-framework-javascript/blob/main/packages/core/src/modules/credentials/protocol/v1/V1CredentialService.ts#L204-L205), but itsn't present in v2. We should probably extract this from the proposal in the indy credential format service so we can reuse it across the v1 and v2 implementation. Currently throws an error that it is missing the credential definition id. It also means the user has to retrieve the message and extract the credential definition from the proposal themselves. Same for the attributes, it shouldn't be required to pass the attributes when accepting a proposal as we can take them from the proposal (but should be optional for the case where there was no proposal preview and thus no attributes)

NB-MikeRichardson commented 2 years ago

As per comment from @swcurran we need to ensure that this is valid, ie if the cred-def-id in the proposal is not one the issuer owns, they can't issue such a credential, so that check is a minimum.

TimoGlastra commented 2 years ago

This is fixed