AgentOS-Core-V2 / identity_core.py
Tpayne101's picture
Rename identity_core.py. to identity_core.py
52f820d verified
raw
history blame contribute delete
654 Bytes
import uuid
import hashlib
import time
import json
import os
def create_agent_identity():
"""Generate a unique, verifiable identity (digital DNA) for each agent."""
agent_id = str(uuid.uuid4())
timestamp = str(time.time())
signature = hashlib.sha256((agent_id + timestamp).encode()).hexdigest()
identity_data = {
"agent_id": agent_id,
"timestamp": timestamp,
"signature": signature,
}
file_path = f"identity_{agent_id}.json"
with open(file_path, "w") as f:
json.dump(identity_data, f, indent=2)
print(f"[Identity] Created digital DNA for agent {agent_id}")
return agent_id