MCPcopy Create free account
hub / github.com/Roy3838/Observer / claim

Function claim

api/remote.py:167–177  ·  view source on GitHub ↗

Called from the authenticated whitelist poll. Claims an unowned code for user_id and, if they own it, (re)opens its pairing window. Returns ownership.

(code: str, user_id: str)

Source from the content-addressed store, hash-verified

165
166
167async def claim(code: str, user_id: str) -> bool:
168 """
169 Called from the authenticated whitelist poll. Claims an unowned code for
170 user_id and, if they own it, (re)opens its pairing window. Returns ownership.
171 """
172 r = await get_redis()
173 await r.set(_owner_key(code), user_id, nx=True)
174 if await r.get(_owner_key(code)) != user_id:
175 return False
176 await r.setex(_pairing_key(code), PAIRING_TTL, "1")
177 return True
178
179
180async def owned_address(code: str, channel: str, user_id: str) -> str | None:

Callers

nothing calls this directly

Calls 3

get_redisFunction · 0.90
_owner_keyFunction · 0.85
_pairing_keyFunction · 0.85

Tested by

no test coverage detected