WebOfTrust / keria

KERI Agent in the cloud
https://keria.readthedocs.io/en/latest/
Apache License 2.0
17 stars 26 forks source link

Keria fails to return registry by aid and name when multiple registries created with same name in agent #190

Closed lenkan closed 5 months ago

lenkan commented 5 months ago

This happens when there are two AIDs in a wallet and each of them have their own registry with the same name.

Steps to reproduce:

  1. Create keria agent
  2. Create identifier aid1
  3. Create new registry named registry for aid aid1
  4. Create identifier aid2.
  5. Create new registry also named registry, but for aid aid2.
  6. Do GET /identifiers/aid2/registries/registry

Expected result

Keria returns the registry created for aid aid2.

Actual result

Keria returns HTTP GET /identifiers/aid2/registries/registry - 404 Not Found - {"title": "404 Not Found", "description": "registry is not a valid registry for AID aid2"}.

Notes

See implementation:

https://github.com/WebOfTrust/keria/blob/98a33ae7cf81be5ae49748fd5549cb98e0e51fe7/src/keria/app/credentialing.py#L211-L216

I assume this only finds the first registry with the given name in the agent. So it returns the registry created for aid1 instead of the one created for aid2.

I have verified that both registries do exists and they are returned by the list endpoints for aid1 and aid2 respectively.

See reproduction script in signify-ts here: https://github.com/lenkan/signify-ts/blob/252ec4dd17f5aaf2e2299610f4f17bcb5c71dfcf/examples/integration-scripts/registry.test.ts