-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Use case
There has been talk of adding an encryption/decryption solution baked in to INTERSECT to allow for data to be encrypted or decrypted as it goes over the wire. We would like the Services to handle this encryption/decryption automatically (without any real knowledge from the SDK Capability writer). We also want to allow for Clients to be able to call these endpoints as necessary.
A universal Capability is the best approach to handle this specifically, and is also flexible enough to accommodate other use cases.
General principle
The universal Capability can also of course send out generic events as well; it is not restricted to @intersect_message endpoints.
Proposed implementation
We can have a class which looks something like this:
class GlobalIntersectCapability(IntersectBaseCapability):
intersect_sdk_capability_name = 'intersect_sdk'
# parameters can be injected through the Service
def __init__(self, some_parameter: str):
super().__init__()
self.some_parameter = some_parameter # if needed
@intersect_message()
def get_public_key() -> str:
# .., implementation
Then, when we build the schema, we inject the GlobalIntersectCapability BEFORE we inject the user's capabilities. This is important! We want the global capability to consistently have the address space of intersect_sdk so clients can always say destination='intersect_sdk.<YOUR_FUNCTION_NAME_HERE>'.
Other notes
The Service can have some specialized logic which is able to feed in specific arguments to THIS capability as necessary.