openwallet-foundation/credo-ts

Add link secret to agent initalization

Closed this issue · 2 comments

jleach commented

I propose we add the following code:

  // If we don't have any link secrets yet, we will create a
  // default link secret that will be used for all anoncreds
  // credential requests.
  const linkSecretIds = await agent.modules.anoncreds.getLinkSecretIds()
  if (linkSecretIds.length === 0) {
    await agent.modules.anoncreds.createLinkSecret({
      setAsDefault: true,
    })
  }

to Agent.initalize() if agent.modules.anoncreds is not null. It's an important step and hard to debug why credentials cannot be accepted if this step was missed.

I agree on the need of setting it automatically if non existent. However I think it should be directly done during anoncreds-rs module initialization. Maybe we can define an optional configuration parameter for it like autoCreateLinkSecret?

jleach commented

@genaris I added a #1491 to see if I'm on the right track. I'll have to write some code later this week to make sure it works as expected.