Added libs

This commit is contained in:
Lucas
2026-01-25 13:55:46 +10:00
parent 575c682afc
commit f70af3c4ea
229 changed files with 26983 additions and 0 deletions

26
noSys/users.py Normal file
View File

@@ -0,0 +1,26 @@
from .events import Events
class User:
"""Represents a single user in the system."""
def __init__(self, public_key, networks=[]):
self.id = public_key
self.public_key = public_key
self.networks = networks
class UserManager:
"""Handles user creation, storage, and retrieval."""
def __init__(self, nosys_core):
from .noSysCore import NoSysCore
self.nosys_core: NoSysCore = nosys_core
self.users: dict[str, User] = {}
def add_user(self, user: User):
if user.public_key not in self.users:
self.users[user.public_key] = user
self.nosys_core.fire_event(Events.USER_ADDED, user_id = user.id)
def get_user(self, user_id: str):
return self.users.get(user_id)