Fixed issue with generating multiple OTP - now prints a nice list for Copy/Paste. Began splitting client / server functionality. Demoted selector and setup to util from service. Fixed some typos.
This commit is contained in:
+30
-1
@@ -141,7 +141,13 @@ class AirlockAPIWrapper:
|
||||
payload = {"status": "0"}
|
||||
result = self._post("/v1/otp/usage", payload)
|
||||
return pd.DataFrame(result["response"]["otpusage"])
|
||||
|
||||
|
||||
def otp_find_by_agent(self, agentid) -> pd.DataFrame:
|
||||
"""Find OTP by agent."""
|
||||
payload = {"agentid": agentid}
|
||||
result = self._post("/v1/otp/usage", payload)
|
||||
return pd.DataFrame(result["response"]["otpusage"])
|
||||
|
||||
def otp_generate(self, agentid: str, duration: int, purpose: str) -> str:
|
||||
"""Generate a new OTP for an agent."""
|
||||
payload = {
|
||||
@@ -157,6 +163,29 @@ class AirlockAPIWrapper:
|
||||
payload = {"otpid": otpid}
|
||||
result = self._post("/v1/otp/activities", payload)
|
||||
return pd.DataFrame(result["response"]["otpactivities"])
|
||||
|
||||
def otp_revoke(self, otpid: str) -> dict:
|
||||
"""
|
||||
Revoke an active OTP.
|
||||
Parameters:
|
||||
- otpid (str): The ID of the OTP to revoke.
|
||||
Returns:
|
||||
- dict: JSON response from the API.
|
||||
"""
|
||||
payload = {"otpid": otpid}
|
||||
return self._post("/v1/otp/revoke", payload)
|
||||
|
||||
def otp_validate(self, otpcode: str) -> dict:
|
||||
"""
|
||||
Validate an OTP code.
|
||||
Parameters:
|
||||
- otpcode (str): The OTP code to validate.
|
||||
Returns:
|
||||
- dict: JSON response indicating validity.
|
||||
"""
|
||||
payload = {"otpcode": otpcode}
|
||||
return self._post("/v1/otp/validate", payload)
|
||||
|
||||
|
||||
# Policy Management
|
||||
def policy_add_path_exclusions(self, groupid: str, paths: List[str]) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user