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

No way to get the offered attributes for a credential offer #885

Closed
TimoGlastra opened this issue Jun 19, 2022 · 0 comments · Fixed by #877
Closed

No way to get the offered attributes for a credential offer #885

TimoGlastra opened this issue Jun 19, 2022 · 0 comments · Fixed by #877
Milestone

Comments

@TimoGlastra
Copy link
Contributor

Now that the attributes aren't stored anymore in the credential record until after a credential offer has been accepted, there's no easy way to get the credential preview attributes.

E.g. for v1 it looks like this, for v2 it needs a bit different code:

const credentialService = agent.injectionContainer.resolve(V1CredentialService)
const offerMessage = await credentialService.findOfferMessage(route.params.credentialId)

if (!offerMessage) {
 // uh-oh handle error
 }

const attributes = offerMessage.credentialPreview.attributes

I think we should do something like we did in #877 (probably extend the method added in that PR) where we can retrieve the (indy) attributes for a credential exchange. This is only useful for indy credentials, so I'm thinkgin whether we should extend the top level properties:

{
  proposalAttributes: [] 
  proposal: {
     indy: {
       cred_def_id: "cred_def_id",
     }
  },
  offerAttributes: [] 
  offer: {
    indy: {
      cred_def_id: "cred_def_id",
    }
  }
}

Or that we should just add it to the indy data (althoug it won't be strictly the format data then anymore, which it currently is). Both makes sense to me, Only indy uses the attributes, so adding it indy (like we do with the other method (e.g. offerCredential attributes are nested under credentialFormats.indy):

{
  proposal: {
     indy: {
       attributes: [],
       cred_def_id: "cred_def_id",
     }
  },
  offer: {
    indy: {
      cred_def_id: "cred_def_id",
      attributes: [] 
    }
  }
}

I think I'm leaning towards the first approach, but not sure yet.

@jakubkoci, @JamesKEbert, @blu3beri @karimStekelenburg your input is welcome

@TimoGlastra TimoGlastra added this to the v0.2.0 milestone Jun 19, 2022
@TimoGlastra TimoGlastra linked a pull request Jun 20, 2022 that will close this issue
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