Spaces:
Sleeping
Sleeping
Update identity_core.py.
Browse files- identity_core.py. +6 -6
identity_core.py.
CHANGED
|
@@ -11,16 +11,16 @@ def create_agent_identity():
|
|
| 11 |
timestamp = str(time.time())
|
| 12 |
signature = hashlib.sha256((agent_id + timestamp).encode()).hexdigest()
|
| 13 |
|
| 14 |
-
|
| 15 |
"agent_id": agent_id,
|
| 16 |
"timestamp": timestamp,
|
| 17 |
"signature": signature,
|
| 18 |
}
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
json.dump(data, f, indent=2)
|
| 24 |
|
| 25 |
print(f"[Identity] Created digital DNA for agent {agent_id}")
|
| 26 |
-
return agent_id
|
|
|
|
|
|
| 11 |
timestamp = str(time.time())
|
| 12 |
signature = hashlib.sha256((agent_id + timestamp).encode()).hexdigest()
|
| 13 |
|
| 14 |
+
identity_data = {
|
| 15 |
"agent_id": agent_id,
|
| 16 |
"timestamp": timestamp,
|
| 17 |
"signature": signature,
|
| 18 |
}
|
| 19 |
|
| 20 |
+
file_path = f"identity_{agent_id}.json"
|
| 21 |
+
with open(file_path, "w") as f:
|
| 22 |
+
json.dump(identity_data, f, indent=2)
|
|
|
|
| 23 |
|
| 24 |
print(f"[Identity] Created digital DNA for agent {agent_id}")
|
| 25 |
+
return agent_id
|
| 26 |
+
|