openwallet-foundation/credo-ts

Unable to create Offer / Offer Credential

Closed this issue · 4 comments

sudddy commented

Hello,

DEBUG: Got a credentialProtocol object for version v2
AriesFrameworkError: Unable to create offer. No supported formats
    at V2CredentialProtocol.createOffer (/Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/node_modules/@aries-framework/core/src/modules/credentials/protocol/v2/V2CredentialProtocol.ts:334:13)
    at CredentialsApi.createOffer (/Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/node_modules/@aries-framework/core/src/modules/credentials/CredentialsApi.ts:425:58)
    at /Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/src/index.ts:243:69
    at Generator.next (<anonymous>)
    at /Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/src/index.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/src/index.ts:4:12)
    at offerCrendetials (/Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/src/index.ts:239:71)
    at /Users/sudharsansrinivasan/Desktop/interview-prep/test-backend/src/index.ts:294:3
    at Generator.next (<anonymous>)

Below is the code:
image

I'm quite confused here. Is there a problem with the protocol version? What's the format for credentialFormats?

I'm using bc testnet and the credentialId is
image

Can you paste here your agent initialization (i.e. how you call the constructor)?

This is an unfortunate issue that happens due to the default credentials and proof module configuration, where no proof/credential formats are defined and forces you to explicitly set them up. So for your agent to work I'd suggest to add to the modules field in the config the following fields:

credentials: new CredentialsModule({
      credentialProtocols: [
             new V2CredentialProtocol({
          credentialFormats: [new LegacyIndyCredentialFormatService(), new AnonCredsCredentialFormatService()],
        }),
      ],
    }),
    proofs: new ProofsModule({
      proofProtocols: [
        new V2ProofProtocol({
          proofFormats: [new LegacyIndyProofFormatService(), new AnonCredsProofFormatService()],
        }),
      ],
    }),
sudddy commented

Thank you very much @genaris You saved my day!