WebOfTrust / keria

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

Provide a way to get identifier by prefix #202

Open lenkan opened 4 months ago

lenkan commented 4 months ago

It would be convenient to be able to do GET /identifiers/{prefix} instead of GET /identifiers/{name}. One use case is when you are reading a notification or exchange message. In that case, you only have the prefix of the intended recipient AID. So currently you have to first need an API call to get all identifiers, then pick the identifier you need to work with.

exchange = { ... a: { i: "prefix-1" } }
identifiers = listIdentifiers() // API Request to list all identifiers
identifier = identifiers.find(id => id.prefix === exchange.a.i) // Pick the identifier you needed

If we had a way to get identifier by prefix, we could do

exchange = { ... a: { i: "prefix-1" } }
identifier = getIdentifier(exchange.a.i)

Notes

Currently, you can only get an identifier by their name through the API. This is convenient for manually constructing URLs or when using the kli. When code is constructing the URL, I think using the prefix is more useful.

2byrds commented 2 months ago

From our dev meeting this issue could be closed in favor https://github.com/WebOfTrust/keria/issues/217