phantasmlabs / phantasm

Toolkits to create a human-in-the-loop approval layer to monitor and guide AI agents workflow in real-time.
https://docs.phantasmlabs.com
GNU General Public License v3.0
126 stars 6 forks source link

feat: add client to receiver authentication #16

Closed edwinkys closed 1 week ago

edwinkys commented 1 week ago

Description

Fixes #3

This PR adds an interceptor to the receiver server service to check for the secret key, PHANTASM_SECRET, set as the server environment variable. If the secret environment variable is not set, no authentication is required from the client to execute a method.

How Has This Been Tested?

To test:

  1. Create a .env file with PHANTASM_SECRET set to a value.
  2. Run the server.
  3. Use the Python client to emulate calling the get approval method.
  4. Add the secret as a parameter when instantiating the Phantasm class in Python client.
  5. If not set to the value, it will return an unauthenticated error to the client.

Checklist