MCPcopy Create free account
hub / github.com/StarsTom/mobileCodexHelper / inspect_auth_db

Function inspect_auth_db

mobile_codex_control.py:97–123  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

95
96
97def inspect_auth_db(path: Path) -> tuple[int, set[str]]:
98 if not path.exists():
99 return -1, set()
100
101 try:
102 connection = sqlite3.connect(path)
103 try:
104 tables = {
105 row[0]
106 for row in connection.execute("SELECT name FROM sqlite_master WHERE type = 'table'")
107 }
108 score = 0
109 if "users" in tables:
110 score += 1
111 if "trusted_devices" in tables:
112 score += 3
113 if "device_approval_requests" in tables:
114 score += 3
115 if "users" in tables:
116 user_count = connection.execute("SELECT COUNT(*) FROM users").fetchone()[0]
117 if user_count:
118 score += 2
119 return score, tables
120 finally:
121 connection.close()
122 except sqlite3.Error:
123 return -1, set()
124
125
126def resolve_auth_db_path() -> Path:

Callers 1

resolve_auth_db_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected