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

check credential preview attributes against schema attributes before making credential offer #587

Closed
TimoGlastra opened this issue Dec 22, 2021 · 0 comments · Fixed by #625

Comments

@TimoGlastra
Copy link
Contributor

TimoGlastra commented Dec 22, 2021

When issuing a credential for a schema/credential definition with attribute names that do not match the schema, a vague CommonInvalidStructure error will be thrown when issuing the credential.

We should add a check when offering a credential (CredentialService.createOffer and CredentialService.createOfferAsResponse) to make sure the attributes from the preview match the attributes from the schema.

Implementation in ACA-Py: https://github.com/hyperledger/aries-cloudagent-python/blob/cd5588f79beb7314f03d78bdfb979d1d6b99acd8/aries_cloudagent/protocols/issue_credential/v1_0/manager.py#L274-L283

ERROR [undefined.<anonymous>] Error processing inbound message: IndyError(CommonInvalidStructure): CommonInvalidStructure 
IndySdkError: IndyError(CommonInvalidStructure): CommonInvalidStructure
    at IndyIssuerService.createCredential (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/modules/indy/services/IndyIssuerService.ts:127:15)
    at async CredentialService.createCredential (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/modules/credentials/services/CredentialService.ts:571:26)
    at async RequestCredentialHandler.createCredential (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/modules/credentials/handlers/RequestCredentialHandler.ts:41:43)
    at async RequestCredentialHandler.handle (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/modules/credentials/handlers/RequestCredentialHandler.ts:29:14)
    at async Dispatcher.dispatch (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/agent/Dispatcher.ts:47:25)
    at async MessageReceiver.receiveEncryptedMessage (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/agent/MessageReceiver.ts:134:5)
    at async MessageReceiver.receiveMessage (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/agent/MessageReceiver.ts:73:7)
    at async Agent.receiveMessage (/Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/core/src/agent/Agent.ts:208:12)
    at async /Users/annelein/Animo/afj-demo/demo/node_modules/@aries-framework/node/src/transport/HttpInboundTransport.ts:44:9 {
  cause: IndyError: CommonInvalidStructure
      at Object.callback (/Users/annelein/Animo/afj-demo/node_modules/indy-sdk/src/wrapIndyCallback.js:15:10) {
    indyCode: 113,
    indyName: 'CommonInvalidStructure',
    indyCurrentErrorJson: null
  }
}
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

Successfully merging a pull request may close this issue.

1 participant