Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:delete_client #51

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions hivemind_core/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,15 @@ def rename_client(node_id, name):
def delete_client(node_id):
with ClientDatabase() as db:
node_id = node_id or prompt_node_id(db)
for x in db:
if x["client_id"] == int(node_id):
item_id = db.get_item_id(x)
db.update_item(item_id, dict(client_id=-1, api_key="revoked"))
for client in db:
if client.client_id == int(node_id):
db.delete_client(client.api_key)
print(f"Revoked credentials!\n")
print("Node ID:", x["client_id"])
print("Friendly Name:", x["name"])
print("Access Key:", x["api_key"])
print("Password:", x["password"])
print("Encryption Key:", x["crypto_key"])
print("Node ID:", client.client_id)
print("Friendly Name:", client.name)
print("Access Key:", client.api_key)
print("Password:", client.password)
print("Encryption Key:", client.crypto_key)
break
else:
print("Invalid Node ID!")
Expand Down
Loading