API Key Management with Custom Scopes

I am considering using custom Scopes to handle API Key management.
Right now I have a service which has a getKey Effect. Other Effects can use the service to get keys, so far so good.

But I have specific requirements to those keys:
1. they need to be acquired before an Effect and released after an Effect (sounds like Scopes)
2. but sometimes next releasing the keys (which always needs to happen), they need to be flagged as invalid (depending on some Error). this action itself can also fail, it should not, but this is HTTP.
Are scopes the correct tool to use here?

acquireRelease does have an exit type, is there any way to get the Error from there? e.cause._tag just seems to be "Empty" | "Die" | "Interrupt" | "Fail" | "Sequential" | "Parallel"
Was this page helpful?